Skip to content

CVE-2025-8715 PostgreSQL pg_dump newline in object name executes arbitrary code in psql client and in restore target server

HighCVSS 8.8 EPSS 0.49%
Published
Updated
Exploit status
No public exploit known

Description

Improper neutralization of newlines in pg_dump in PostgreSQL allows a user 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 meta-commands inside a purpose-crafted object name. The same attacks can achieve SQL injection as a superuser of the restore target server. pg_dumpall, pg_restore, and pg_upgrade are also affected. Versions before PostgreSQL 17.6, 16.10, 15.14, 14.19, and 13.22 are affected. Versions before 11.20 are unaffected. CVE-2012-0868 had fixed this class of problem, but version 11.20 reintroduced it.

Affected products

ProductAffected versionsFixed in
cbl-mariner postgresql(CBL-Mariner:2.0) < 14.19-1 14.19-1
azure linux postgresql(Azure Linux:3.0) < 16.10-1 16.10-1
debian/postgresql-15(Debian:12) < 15.14-0+deb12u1 15.14-0+deb12u1
debian/postgresql-15(Debian:12) = 15.10-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.11-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.12-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.12-0+deb12u2 No fix listed
debian/postgresql-15(Debian:12) = 15.13-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.3-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.3-1 No fix listed
debian/postgresql-15(Debian:12) = 15.4-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.4-1 No fix listed
debian/postgresql-15(Debian:12) = 15.4-2 No fix listed
debian/postgresql-15(Debian:12) = 15.4-3 No fix listed
debian/postgresql-15(Debian:12) = 15.5-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.6-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.7-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.8-0+deb12u1 No fix listed
debian/postgresql-15(Debian:12) = 15.9-0+deb12u1 No fix listed
debian/postgresql-17(Debian:13) < 17.6-0+deb13u1 17.6-0+deb13u1
debian/postgresql-17(Debian:13) = 17.5-1 No fix listed
ubuntu/postgresql-14(Ubuntu:22.04) < 14.19-0ubuntu0.22.04.1 14.19-0ubuntu0.22.04.1
alpine/postgresql15(Alpine:v3.19) < 15.14-r0 15.14-r0
alpine/postgresql15(Alpine:v3.20) < 15.14-r0 15.14-r0
alpine/postgresql15(Alpine:v3.21) < 15.17-r0 15.17-r0
Show 12 more
ProductAffected versionsFixed in
alpine/postgresql15(Alpine:v3.22) < 15.14-r0 15.14-r0
alpine/postgresql16(Alpine:v3.19) < 16.10-r0 16.10-r0
alpine/postgresql16(Alpine:v3.20) < 16.10-r0 16.10-r0
alpine/postgresql16(Alpine:v3.21) < 16.10-r0 16.10-r0
alpine/postgresql16(Alpine:v3.22) < 16.10-r0 16.10-r0
alpine/postgresql16(Alpine:v3.23) < 16.10-r0 16.10-r0
alpine/postgresql16(Alpine:v3.24) < 16.10-r0 16.10-r0
alpine/postgresql17(Alpine:v3.21) < 17.6-r0 17.6-r0
alpine/postgresql17(Alpine:v3.22) < 17.6-r0 17.6-r0
alpine/postgresql17(Alpine:v3.23) < 17.6-r0 17.6-r0
alpine/postgresql17(Alpine:v3.24) < 17.6-r0 17.6-r0
ubuntu/postgresql-16(Ubuntu:24.04) < 16.10-0ubuntu0.24.04.1 16.10-0ubuntu0.24.04.1

References