CVE-2026-18408

PostgreSQL psql \unrestrict lets superuser of pg_dump origin server execute arbitrary code in psql client

Published Aug 13, 2026 CVSS 3.1 · 8.8 High EPSS < 1% KEV · Not listed
Description
Untrusted data inclusion in pg_dump in PostgreSQL allows a malicious superuser of the origin server to inject arbitrary code for restore-time execution as the client operating system account running psql to restore the dump, via psql \restrict meta-command input expansion. The fix for CVE-2025-8714 introduced \restrict and \unrestrict to block this attack, but \unrestrict itself was sufficient for an attack. pg_dumpall is also affected. pg_restore is affected when used to generate a plain-format dump. Non-core use of \restrict would be affected, but we've not identified non-core use. Versions before PostgreSQL 18.6, 17.11, 16.15, 15.19, and 14.24 are affected.

Analysis

AI-generated

Technical impact

Untrusted data inclusion in PostgreSQL's pg_dump lets a database superuser embed arbitrary shell commands into a plain‑format dump. When that dump is restored with the psql client, the injected code expands through the \unrestrict meta‑command and runs under the operating‑system account that launched psql, granting the attacker remote code execution on the client machine.

Affected Systems

Versions prior to PostgreSQL 18.6, 17.11, 16.15, 15.19, and 14.24 are vulnerable. The flaw affects the core server, psql, pg_dump, pg_dumpall, and pg_restore when used to generate a plain‑format dump, and requires the origin server to have a superuser creating the dump.

Risk and Exploitability

The CVSS score of 8.8 signals high severity, while the EPSS score of less than 1% indicates a low probability of exploitation at this time. The vulnerability is not listed in the CISA KEV catalog. Exploitation requires a superuser to craft a malicious dump and a victim to restore it with psql; the attack succeeds only during that restore operation. Administrators should act promptly to limit the attack surface.

Remediation

Vendor Workaround

use "pg_restore --dbname" instead of restore methods that involve "psql"


OpenCVE Recommended Actions

  • Upgrade PostgreSQL to any public release 18.6 or newer, or 17.11 or newer, or 16.15 or newer, or 15.19 or newer, or 14.24 or newer.
  • Until the upgrade is applied, avoid restoring plain‑format dumps through psql; instead use pg_restore with the --dbname option or another method that does not invoke psql.
  • Inspect existing dump files and restore scripts for the \unrestrict command and remove or neutralize any instance before executing restores.
  • Restrict superuser privileges on the PostgreSQL instance so that only trusted administrators can generate potentially malicious dumps.

Generated by OpenCVE AI on August 30, 2026 at 01:08 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-4740-1 postgresql-15 security update
Debian DSA Debian DSA DSA-6438-1 postgresql-17 security update
Ubuntu USN Ubuntu USN USN-8653-1 PostgreSQL vulnerabilities
History
Type Values Removed Values Added
Description Untrusted data inclusion in pg_dump in PostgreSQL allows a malicious superuser of the origin server to inject arbitrary code for restore-time execution as the client operating system account running psql to restore the dump, via psql \restrict meta-command input expansion. The fix for CVE-2025-8714 introduced \restrict and \unrestrict to block this attack, but \unrestrict itself was sufficient for an attack. pg_dumpall is also affected. pg_restore is affected when used to generate a plain-format dump. Non-core use of \restrict would be affected, but we've not identified non-core use. Versions before PostgreSQL 18.5, 17.11, 16.15, 15.19, and 14.24 are affected. Untrusted data inclusion in pg_dump in PostgreSQL allows a malicious superuser of the origin server to inject arbitrary code for restore-time execution as the client operating system account running psql to restore the dump, via psql \restrict meta-command input expansion. The fix for CVE-2025-8714 introduced \restrict and \unrestrict to block this attack, but \unrestrict itself was sufficient for an attack. pg_dumpall is also affected. pg_restore is affected when used to generate a plain-format dump. Non-core use of \restrict would be affected, but we've not identified non-core use. Versions before PostgreSQL 18.6, 17.11, 16.15, 15.19, and 14.24 are affected.
Type Values Removed Values Added
CPEs cpe:2.3:a:postgresql:postgresql:*:*:*:*:*:*:*:*
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Postgresql
Postgresql postgresql
Vendors & Products Postgresql
Postgresql postgresql
Type Values Removed Values Added
Description Untrusted data inclusion in pg_dump in PostgreSQL allows a malicious superuser of the origin server to inject arbitrary code for restore-time execution as the client operating system account running psql to restore the dump, via psql \restrict meta-command input expansion. The fix for CVE-2025-8714 introduced \restrict and \unrestrict to block this attack, but \unrestrict itself was sufficient for an attack. pg_dumpall is also affected. pg_restore is affected when used to generate a plain-format dump. Non-core use of \restrict would be affected, but we've not identified non-core use. Versions before PostgreSQL 18.5, 17.11, 16.15, 15.19, and 14.24 are affected.
Title PostgreSQL psql \unrestrict lets superuser of pg_dump origin server execute arbitrary code in psql client
Weaknesses CWE-829
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}

Weaknesses
  • CWE-829

    Inclusion of Functionality from Untrusted Control Sphere

Sources

Status
PUBLISHED
Assigner
PostgreSQL
Published
Updated
Aug 29, 2026, 11:07 PM
Reserved
Jul 30, 2026, 4:28 PM
Status
Modified
Published
Aug 13, 2026, 1:17 PM
Modified
Aug 29, 2026, 11:17 PM