---
name: rt-exploit-postgresql
description: "PostgreSQL security assessment skill for authorized configuration review, role/privilege analysis, extension risk, schema permissions, application query review, and remediation."
---

# rt-exploit-postgresql - PostgreSQL Assessment

## Overview

PostgreSQL risk centers on role inheritance, overly broad schema permissions, unsafe extensions, exposed administrative ports, weak `pg_hba.conf` policy, and application injection. This skill structures safe validation.

## Prerequisites

- In-scope database or application endpoint.
- Approved account and role.
- Read/write boundaries.
- Permission to inspect configuration where available.

## Assessment Areas

| Area | Checks |
|---|---|
| Exposure | Listener address, firewall, cloud security groups. |
| Authentication | `pg_hba.conf` intent, password methods, SSO/IAM integration. |
| Roles | Inheritance, superuser, createdb, createrole, replication. |
| Schemas | Public schema permissions, default privileges. |
| Extensions | Unneeded or risky extensions. |
| Transport | TLS and certificate verification. |
| App Layer | Parameterization and ORM escape hatches. |

## Workflow

1. Confirm scope and account role.
2. Inventory version, roles, schemas, and extensions.
3. Review public schema and default permissions.
4. Validate injection or privilege concerns with harmless test queries.
5. Map business impact to data classes and application features.
6. Recommend role redesign and query fixes.

## Evidence

Use role summaries, schema permission snippets, redacted screenshots, and paired app requests. Avoid broad table exports.

## Remediation

- Remove unnecessary superuser/createrole rights.
- Lock down public schema.
- Use parameterized queries.
- Enforce TLS.
- Review extensions.
- Separate migration/admin/application roles.


## Finding Examples

| Finding | Severity Driver |
|---|---|
| Application role owns schema | Integrity and privilege risk. |
| Public schema writable | Object shadowing and data integrity risk. |
| No TLS for remote DB access | Credential and data interception risk. |
| Unsafe query construction | Injection and data access risk. |

## Autodoc

```bash
python _rtexit/scripts/autodoc_engine.py log --skill rt-exploit-postgresql --phase exploitation --cmd "PostgreSQL posture review" --output "redacted database risk summary"
```
