CVE-2026-18408·PostgreSQL vulnerability
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.
- Severity
- high
- Software
- PostgreSQL
- Fixed in
- 18.5
- Published
Affected versions
From: 18.0
Until: 18.5
Fixed in: 18.5
How to fix this CVE
Upgrade PostgreSQL to version 18.6 or later, or apply security patches to versions 17.11, 16.15, 15.19, and 14.24 respectively. This vulnerability allows malicious superusers to inject arbitrary code during database restore operations by bypassing the \restrict metacommand protection. Immediate patching is critical if your PostgreSQL instance accepts connections from untrusted administrators or if dump/restore operations are performed in multi-tenant environments.
sudo dnf update postgresql-server postgresql-contrib postgresql-libsDefensia detects this vulnerability
How to check if you are affected
- Check installed PostgreSQL version: psql --version or SELECT version();
- Verify if pg_dump and pg_dumpall binaries are present and in use: which pg_dump && which pg_dumpall
- Search PostgreSQL logs for \unrestrict metacommand usage: grep -i 'unrestrict' /var/log/postgresql/*.log
- Confirm the patch is applied by checking the minor version matches or exceeds: psql -c 'SELECT version();' | grep -E '(18\.[6-9]|17\.1[1-9]|16\.1[5-9]|15\.1[9-9]|14\.2[4-9])'
FAQ
What is CVE-2026-18408?
This vulnerability allows a malicious superuser to inject executable code into PostgreSQL dump files that runs during restore operations under the privileges of the client user executing psql. It exploits incomplete sanitization of the \unrestrict metacommand, which bypasses the \restrict protection mechanism introduced in the previous CVE-2025-8714 patch.
Is CVE-2026-18408 being actively exploited?
No, there is currently no evidence of active exploitation in the wild, and no public exploit code is available. However, the attack requires privileged access and knowledge of dump file manipulation, making it a targeted risk.
What versions of PostgreSQL are affected by CVE-2026-18408?
PostgreSQL versions 18.0 through 18.5, 17.x before 17.11, 16.x before 16.15, 15.x before 15.19, and 14.x before 14.24 are vulnerable. All actively maintained branches are affected.
How do I check if my server is vulnerable to CVE-2026-18408?
Run psql -c 'SELECT version();' and check if your version is older than 18.6, 17.11, 16.15, 15.19, or 14.24 depending on your branch. If it is, your instance is vulnerable.
Does Defensia detect CVE-2026-18408?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PostgreSQL is installed on a monitored server, CVE-2026-18408 will appear in your dashboard with remediation steps.
Related PostgreSQL CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-18408. Free for 1 server.
Get started free