CVE-2025-8714

8.8 HIGH

📋 TL;DR

This vulnerability allows a malicious PostgreSQL superuser on the source server to inject arbitrary code into database dumps. When the dump is restored using psql or pg_restore, the injected code executes with the privileges of the client's operating system account. This affects PostgreSQL installations where dumps are created by untrusted superusers and restored by other users.

💻 Affected Systems

Products:
  • PostgreSQL
  • pg_dump
  • pg_dumpall
  • pg_restore
Versions: All versions before PostgreSQL 17.6, 16.10, 15.14, 14.19, and 13.22
Operating Systems: All operating systems running PostgreSQL
Default Config Vulnerable: ⚠️ Yes
Notes: Requires a malicious superuser on the source server and a client restoring the dump. pg_restore is only affected when generating plain-format dumps.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of the client system restoring the dump, allowing arbitrary code execution as the OS user running the restore, potentially leading to full system takeover.

🟠

Likely Case

Privilege escalation from database superuser to OS-level access on client systems, enabling data theft, lateral movement, or persistence mechanisms.

🟢

If Mitigated

Limited impact if only trusted superusers create dumps and restores are performed in isolated environments with minimal privileges.

🌐 Internet-Facing: LOW
🏢 Internal Only: HIGH

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires superuser privileges on the source database server and a victim restoring the malicious dump. Similar to MySQL CVE-2024-21096.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: PostgreSQL 17.6, 16.10, 15.14, 14.19, or 13.22

Vendor Advisory: https://www.postgresql.org/support/security/CVE-2025-8714/

Restart Required: No

Instructions:

1. Identify PostgreSQL version with 'SELECT version();'. 2. Upgrade to patched version using your package manager (apt, yum, etc.) or compile from source. 3. Verify upgrade with version check. No database restart needed for pg_dump tools.

🔧 Temporary Workarounds

Restrict dump creation to trusted users

all

Only allow trusted database superusers to create dumps that will be restored by other users.

Use custom format dumps with pg_restore

all

When using pg_restore, avoid plain-format dumps (-Fp) and use custom format (-Fc) which is not affected.

pg_dump -Fc dbname > dumpfile.custom

🧯 If You Can't Patch

  • Audit all database superusers and remove unnecessary privileges
  • Implement strict controls on who can create dumps and where they can be restored

🔍 How to Verify

Check if Vulnerable:

Check PostgreSQL version: if before 17.6, 16.10, 15.14, 14.19, or 13.22, you are vulnerable.

Check Version:

SELECT version();

Verify Fix Applied:

After patching, verify version is 17.6, 16.10, 15.14, 14.19, 13.22 or higher.

📡 Detection & Monitoring

Log Indicators:

  • Unusual pg_dump/pg_dumpall activity from superuser accounts
  • Large or abnormal dump files being transferred

Network Indicators:

  • Unexpected database dump transfers between systems

SIEM Query:

source="postgresql" AND (event="pg_dump" OR event="pg_dumpall") AND user="superuser"

🔗 References

📤 Share & Export