Cloudanix VulnDB

CVE-2025-8715

High · 8.8

CVSS

8.8

EPSS

0.4%

Published

Aug 14, 2025

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A problem in PostgreSQL backup tools lets someone who creates certain database objects hide harmful instructions inside a backup file so that those instructions run automatically when another person restores the file, potentially taking control of their computer or database.

Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Moderate
Impact
Remote Code Execution
Component
Application
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Improper neutralization of newlines in pg_dump allows injection of arbitrary psql meta-commands or SQL statements via crafted object names, resulting in code execution as the OS account running psql during restore or SQL injection as a superuser on the target server; pg_dumpall, pg_restore, and pg_upgrade are also affected.

Why it matters to the business

Organizations using affected PostgreSQL versions risk remote code execution or database compromise when restoring untrusted dumps, potentially leading to data breaches or system control; low EPSS and absence from KEV indicate limited immediate exploitation risk but still require prompt patching across linux-lts deployments.

How an attack unfolds

An attacker with object creation rights on the origin server embeds newlines and psql meta-commands inside object names; a subsequent dump is restored on a target system using vulnerable psql, causing the injected commands to execute with client OS privileges or as superuser SQL on the restore target.

How to fix it

Upgrade PostgreSQL to 17.6, 16.10, 15.14, 14.19, or 13.22 or later. For the listed linux-lts packages apply the fixed version 6.12.41-r0 on both Alpaquita:stream and Alpaquita:25 streams.

How to confirm the fix worked

Confirm the installed PostgreSQL version meets or exceeds the listed fixed releases; attempt restore of a test dump containing newline-injected object names and verify that no meta-commands or SQL statements execute unexpectedly.

Typical attack path

  1. Obtain ability to create objects on an origin PostgreSQL server running an affected version.
  2. Craft object names containing newlines followed by psql meta-commands or SQL injection payloads.
  3. Generate a database dump using pg_dump, pg_dumpall, or related tools.
  4. Induce the victim to restore the dump using vulnerable psql, pg_restore, or pg_upgrade on the target system.
  5. Injected code executes at restore time with privileges of the psql process or target superuser.

How to detect it

Review PostgreSQL client logs, shell histories, and process execution records for pg_dump, psql, pg_restore, and pg_upgrade invocations that reference object names containing literal newline characters or sequences such as backslash-exclamation or COPY statements originating from dump content.

What your security team should do

  • Apply the listed fixed package versions immediately on all affected linux-lts deployments.
  • Restrict object creation privileges on databases whose dumps may be restored by other parties.
  • Establish a process to scan dumps for suspicious newlines or psql meta-commands before restore.
  • Update internal restore procedures to use only patched PostgreSQL client tools.

The record

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 packages

Ecosystem Package Introduced Fixed
AlmaLinux:10 postgresql 0 16.10-1.el10_0
AlmaLinux:10 postgresql-contrib 0 16.10-1.el10_0
AlmaLinux:10 postgresql-docs 0 16.10-1.el10_0
AlmaLinux:10 postgresql-plperl 0 16.10-1.el10_0
AlmaLinux:10 postgresql-plpython3 0 16.10-1.el10_0
AlmaLinux:10 postgresql-pltcl 0 16.10-1.el10_0
AlmaLinux:10 postgresql-private-devel 0 16.10-1.el10_0
AlmaLinux:10 postgresql-private-libs 0 16.10-1.el10_0
AlmaLinux:10 postgresql-server 0 16.10-1.el10_0
AlmaLinux:10 postgresql-server-devel 0 16.10-1.el10_0
AlmaLinux:10 postgresql-static 0 16.10-1.el10_0
AlmaLinux:10 postgresql-test 0 16.10-1.el10_0
AlmaLinux:10 postgresql-test-rpm-macros 0 16.10-1.el10_0
AlmaLinux:10 postgresql-upgrade 0 16.10-1.el10_0
AlmaLinux:10 postgresql-upgrade-devel 0 16.10-1.el10_0
AlmaLinux:8 pg_repack 0 1.5.1-1.module_el8.10.0+3930+ecf33554
AlmaLinux:8 pg_repack 0 1.4.6-3.module_el8.6.0+2760+1746ec94
AlmaLinux:8 pg_repack 0 1.4.6-3.module_el8.6.0+3095+ee60d910
AlmaLinux:8 pg_repack 0 1.4.8-1.module_el8.9.0+3706+885c732e
AlmaLinux:8 pg_repack 0 1.4.6-3.module_el8.9.0+3704+f1f917ce
AlmaLinux:8 pgaudit 0 16.0-1.module_el8.10.0+3798+606ebb9f
AlmaLinux:8 pgaudit 0 1.5.0-1.module_el8.6.0+2760+1746ec94
AlmaLinux:8 pgaudit 0 1.5.0-1.module_el8.6.0+3095+ee60d910
AlmaLinux:8 pgaudit 0 1.7.0-1.module_el8.9.0+3706+885c732e
AlmaLinux:8 pgaudit 0 1.4.0-7.module_el8.10.0+3889+48cb11fb.alma.1
AlmaLinux:8 pgaudit 0 1.4.0-7.module_el8.9.0+3740+0e74851f.alma.1
AlmaLinux:8 postgres-decoderbufs 0 2.4.0-1.Final.module_el8.10.0+3798+606ebb9f
AlmaLinux:8 postgres-decoderbufs 0 0.10.0-2.module_el8.6.0+2760+1746ec94
AlmaLinux:8 postgres-decoderbufs 0 0.10.0-2.module_el8.6.0+3095+ee60d910
AlmaLinux:8 postgres-decoderbufs 0 1.9.7-1.Final.module_el8.9.0+3706+885c732e
AlmaLinux:8 postgres-decoderbufs 0 0.10.0-2.module_el8.9.0+3704+f1f917ce
AlmaLinux:8 postgresql 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-contrib 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-contrib 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-contrib 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-contrib 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-docs 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-docs 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-docs 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-docs 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-plperl 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-plperl 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-plperl 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-plperl 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-plpython3 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-plpython3 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-plpython3 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-plpython3 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-pltcl 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-pltcl 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-pltcl 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-pltcl 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-private-devel 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-private-devel 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-private-libs 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-private-libs 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-server 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-server 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-server 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-server 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-server-devel 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-server-devel 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-server-devel 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-server-devel 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-static 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-static 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-static 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-static 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-test 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-test 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-test 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-test 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-test-rpm-macros 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-test-rpm-macros 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-test-rpm-macros 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-test-rpm-macros 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-upgrade 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-upgrade 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-upgrade 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-upgrade 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:8 postgresql-upgrade-devel 0 16.10-1.module_el8.10.0+4038+0fbad93c
AlmaLinux:8 postgresql-upgrade-devel 0 13.22-1.module_el8.10.0+4042+cb252986
AlmaLinux:8 postgresql-upgrade-devel 0 15.14-1.module_el8.10.0+4041+afd30bb4
AlmaLinux:8 postgresql-upgrade-devel 0 12.22-5.module_el8.10.0+4043+6cac3079
AlmaLinux:9 pg_repack 0 1.5.1-1.module_el9.6.0+146+c54fdeca
AlmaLinux:9 pg_repack 0 1.4.8-2.module_el9.5.0+119+18833d03
AlmaLinux:9 pgaudit 0 16.0-1.module_el9.4.0+66+eb9878bc
AlmaLinux:9 pgaudit 0 1.7.0-1.module_el9.3.0+52+21733919
AlmaLinux:9 pgvector 0 0.6.2-2.module_el9.6.0+167+4e561146
AlmaLinux:9 postgres-decoderbufs 0 2.4.0-1.Final.module_el9.4.0+66+eb9878bc
AlmaLinux:9 postgres-decoderbufs 0 1.9.7-1.Final.module_el9.3.0+52+21733919
AlmaLinux:9 postgresql 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql 0 13.22-1.el9_6
AlmaLinux:9 postgresql-contrib 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-contrib 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-contrib 0 13.22-1.el9_6
AlmaLinux:9 postgresql-docs 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-docs 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-docs 0 13.22-1.el9_6
AlmaLinux:9 postgresql-plperl 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-plperl 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-plperl 0 13.22-1.el9_6
AlmaLinux:9 postgresql-plpython3 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-plpython3 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-plpython3 0 13.22-1.el9_6
AlmaLinux:9 postgresql-pltcl 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-pltcl 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-pltcl 0 13.22-1.el9_6
AlmaLinux:9 postgresql-private-devel 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-private-devel 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-private-devel 0 13.22-1.el9_6
AlmaLinux:9 postgresql-private-libs 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-private-libs 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-private-libs 0 13.22-1.el9_6
AlmaLinux:9 postgresql-server 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-server 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-server 0 13.22-1.el9_6
AlmaLinux:9 postgresql-server-devel 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-server-devel 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-server-devel 0 13.22-1.el9_6
AlmaLinux:9 postgresql-static 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-static 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-static 0 13.22-1.el9_6
AlmaLinux:9 postgresql-test 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-test 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-test 0 13.22-1.el9_6
AlmaLinux:9 postgresql-test-rpm-macros 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-test-rpm-macros 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-test-rpm-macros 0 13.22-1.el9_6
AlmaLinux:9 postgresql-upgrade 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-upgrade 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-upgrade 0 13.22-1.el9_6
AlmaLinux:9 postgresql-upgrade-devel 0 16.10-1.module_el9.6.0+174+80cb77f0
AlmaLinux:9 postgresql-upgrade-devel 0 15.14-1.module_el9.6.0+176+c508cfa2
AlmaLinux:9 postgresql-upgrade-devel 0 13.22-1.el9_6
Alpine:v3.19 postgresql15 0 15.14-r0
Alpine:v3.19 postgresql16 0 16.10-r0
Alpine:v3.20 postgresql15 0 15.14-r0
Alpine:v3.20 postgresql16 0 16.10-r0
Alpine:v3.21 postgresql16 0 16.10-r0
Alpine:v3.21 postgresql17 0 17.6-r0
Alpine:v3.22 postgresql16 0 16.10-r0
Alpine:v3.22 postgresql17 0 17.6-r0
Bitnami postgresql 11.20.0 13.22.0
Debian:11 postgresql-13 0 13.22-0+deb11u1
Debian:12 postgresql-15 0 No fix
Debian:13 postgresql-17 0 No fix
Debian:14 postgresql-17 0 No fix
Mageia:9 postgresql13 0 13.22-1.mga9
Mageia:9 postgresql15 0 15.14-1.mga9
SUSE:Linux Enterprise Module for Basesystem 15 SP6 postgresql16 0 16.10-150600.16.21.1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 postgresql17 0 17.6-150600.13.16.1
SUSE:Linux Enterprise Module for Basesystem 15 SP7 postgresql17 0 17.6-150600.13.16.1
SUSE:Linux Enterprise Module for Legacy 15 SP6 postgresql14 0 14.19-150600.16.20.1
SUSE:Linux Enterprise Module for Legacy 15 SP6 postgresql15 0 15.14-150600.16.20.1
SUSE:Linux Enterprise Module for Legacy 15 SP7 postgresql14 0 14.19-150600.16.20.1
SUSE:Linux Enterprise Module for Legacy 15 SP7 postgresql15 0 15.14-150600.16.20.1
SUSE:Linux Enterprise Module for Legacy 15 SP7 postgresql16 0 16.10-150600.16.21.1
SUSE:Linux Enterprise Module for Package Hub 15 SP6 postgresql14 0 14.19-150600.16.20.1
SUSE:Linux Enterprise Module for Package Hub 15 SP6 postgresql16 0 16.10-150600.16.21.1
SUSE:Linux Enterprise Module for Package Hub 15 SP6 postgresql17 0 17.6-150600.13.16.1
SUSE:Linux Enterprise Module for Package Hub 15 SP7 postgresql14 0 14.19-150600.16.20.1
SUSE:Linux Enterprise Module for Package Hub 15 SP7 postgresql16 0 16.10-150600.16.21.1
SUSE:Linux Enterprise Module for Package Hub 15 SP7 postgresql17 0 17.6-150600.13.16.1
SUSE:Linux Enterprise Module for Server Applications 15 SP6 postgresql16 0 16.10-150600.16.21.1
SUSE:Linux Enterprise Module for Server Applications 15 SP6 postgresql17 0 17.6-150600.13.16.1
SUSE:Linux Enterprise Module for Server Applications 15 SP7 postgresql16 0 16.10-150600.16.21.1
SUSE:Linux Enterprise Module for Server Applications 15 SP7 postgresql17 0 17.6-150600.13.16.1
SUSE:Linux Enterprise Server 12 SP5-LTSS postgresql14 0 14.19-3.60.1
SUSE:Linux Enterprise Server LTSS Extended Security 12 SP5 postgresql14 0 14.19-3.60.1
openSUSE:Leap 15.6 postgresql13 0 13.22-150600.14.11.1
openSUSE:Leap 15.6 postgresql14 0 14.19-150600.16.20.1
openSUSE:Leap 15.6 postgresql15 0 15.14-150600.16.20.1
openSUSE:Leap 15.6 postgresql16 0 16.10-150600.16.21.1
openSUSE:Leap 15.6 postgresql17 0 17.6-150600.13.16.1
openSUSE:Tumbleweed postgresql13 0 13.22-1.1
openSUSE:Tumbleweed postgresql14 0 14.19-1.1
openSUSE:Tumbleweed postgresql15 0 15.14-1.1
openSUSE:Tumbleweed postgresql16 0 16.10-1.1
openSUSE:Tumbleweed postgresql17 0 17.6-1.1

Related vulnerabilities