A critical vulnerability, dubbed "PostGREShell" and tracked as CVE-2026-6471, has been discovered in PostgreSQL, allowing low-privileged attackers to execute arbitrary code and potentially take over database servers. The flaw, which has a CVSS score of 7.2, has been present in all PostgreSQL versions since 9.4, released in 2014, and remained unpatched for 12 years until recent updates.
The vulnerability stems from a missing authorization check within PostgreSQL's logical decoding feature. An attacker with only "Replication" privileges can exploit this by manipulating the choice of a logical decoding plugin. This allows them to load any file accessible to the operating system account running the PostgreSQL server, effectively executing arbitrary code as that account.
According to researchers at Cyera, who discovered the flaw, the issue enables a low-privilege backup account to achieve remote code execution across Windows, Linux, and macOS systems. This initial foothold can then be escalated to full PostgreSQL superuser privileges, providing persistent backdoor access and leading to a complete compromise of the database and the underlying server. Attackers could install a persistent backdoor, access all tables in every database, execute operating system commands, read private keys, and write files anywhere the PostgreSQL process has access.
PostgreSQL's logical replication system is designed to keep database replicas synchronized for backup and recovery purposes. Tools, servers, data pipelines, and monitoring systems often require accounts with "Replication" privileges to function. The vulnerability leverages the process by which PostgreSQL loads output plugins during logical replication. Normally, non-superusers are restricted to loading plugins from administrator-controlled directories. However, the system does not properly validate the plugin name provided by the user during the `CREATE_REPLICATION_SLOT` command, passing it directly to the `dlopen()` function (on Linux/macOS) or `LoadLibrary()` (on Windows). This allows an attacker to specify a full filesystem path to an arbitrary file.
The flaw affects PostgreSQL versions 9.4 through 18. PostgreSQL has confirmed the vulnerability and released patches in versions 18.6, 17.11, 16.15, 15.19, and 14.24. Organizations are strongly advised to update their PostgreSQL instances immediately. Additionally, it is recommended to review all existing "Replication" accounts and remove the "Replication" attribute from any accounts that do not strictly require it to minimize the attack surface.






