Full Report
PostgreSQL has released updates to address a security flaw that allows an account with the REPLICATION attribute to run arbitrary code as the operating-system user running the database server. The flaw, tracked as CVE-2026-6471 (CVSS score: 7.2), has been present since logical decoding was introduced in PostgreSQL 9.4 in 2014. Versions before PostgreSQL 18.6, 17.11, 16.15, 15.19, and 14.24 are
Analysis Summary
# Vulnerability: PostGREShell - Arbitrary Code Execution via Logical Decoding
## CVE Details
- **CVE ID:** CVE-2026-6471
- **CVSS Score:** 7.2 (High)
- **CWE:** Not explicitly listed (Involves Path Traversal and Unrestricted Upload/Loading of Code)
## Affected Systems
- **Products:** PostgreSQL Database Server
- **Versions:**
- Versions prior to 18.6, 17.11, 16.15, 15.19, and 14.24.
- The flaw exists in all versions since PostgreSQL 9.4 (introduced in 2014).
- **Configurations:**
- Server must have `wal_level = logical` enabled.
- The attacker must have an account with the `REPLICATION` attribute.
## Vulnerability Description
The flaw, dubbed **PostGREShell**, stems from how PostgreSQL handles logical decoding output plugins. Previously, the `CREATE_REPLICATION_SLOT` command passed the plugin name directly to the library loader without applying standard path restrictions or validation.
An attacker can use double-quoted strings to include path separators (`/` or `\`) and directory traversal sequences (`../`). This allows the loading of arbitrary libraries from the local filesystem or, in specific OS configurations (Windows via SMB or Linux/macOS via NFS automount), from a remote attacker-controlled network path. Once loaded, the code executes with the privileges of the `postgres` operating-system user.
## Exploitation
- **Status:** PoC described by researchers (Cyera Research); no reported exploitation in the wild at the time of the report.
- **Complexity:** Medium
- **Attack Vector:** Network (requires authenticated replication access)
## Impact
- **Confidentiality:** High (Full access to database content)
- **Integrity:** High (Ability to modify role catalogs, gain Superuser status, and establish persistence)
- **Availability:** High (Ability to crash the process or alter system state)
## Remediation
### Patches
Update to the following versions released August 13, 2026:
- **PostgreSQL 18.6**
- **PostgreSQL 17.11**
- **PostgreSQL 16.15**
- **PostgreSQL 15.19**
- **PostgreSQL 14.24**
### Workarounds
- **Strict User Management:** Audit all users with the `REPLICATION` attribute and remove the attribute from any accounts that do not strictly require it.
- **Network Filtering:** Block outbound SMB (port 445) and NFS traffic from database servers to prevent remote library loading.
## Detection
- **Pre-Update Audit:** Run `SELECT DISTINCT plugin FROM pg_replication_slots WHERE plugin IS NOT NULL;` to identify legitimate plugins currently in use.
- **Indicators of Compromise:**
- Monitor server logs for `ERROR: library "..." may not be used as an output plugin`.
- Check for unusual library files in the `$libdir/plugins` directory or unexpected directory traversal characters in replication logs.
- Monitor for unauthorized elevation of privileges (e.g., a replication user suddenly gaining `superuser` status).
## References
- **Vendor Advisory:** [https://www.postgresql.org/docs/release/18.6/]
- **Research Write-up:** [https://www.cyera.com/research/postgreshell-the-database-powering-much-of-the-internet-had-an-open-door-for-12-years]
- **Commit History:** [https://git.postgresql.org/pg/commitdiff/226e49cbed592eaf7a08320efecb814b7492972e]