CVE-2026-18408 PUBLISHED

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

Assigner: PostgreSQL
Reserved: 30.07.2026 Published: 13.08.2026 Updated: 13.08.2026

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.

Metrics

CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CVSS Score: 8.8

Product Status

Vendor n/a
Product PostgreSQL
Versions Default: unaffected
  • affected from 18 to 18.5 (excl.)
  • affected from 17 to 17.11 (excl.)
  • affected from 16 to 16.15 (excl.)
  • affected from 15 to 15.19 (excl.)
  • affected from 0 to 14.24 (excl.)

Affected Configurations

attacker can direct pg_dump et al. to a malicious origin server

Workarounds

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

Credits

  • The PostgreSQL project thanks Lucas Velgus, Filip Janus, and Daniel Bakker for reporting this problem.

References

Problem Types

  • Inclusion of Functionality from Untrusted Control Sphere CWE