PostgreSQLDatabase / datastore

CVE-2024-7348

HIGH · 7.5 CVSS v3.1 Published 2024-08-08
Fix available
A fix is available. Upgrade to 12.20 / 13.16 or later.
See remediation →
81/100
Remediation priority · High
Remotely reachable Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
Time-of-check Time-of-use (TOCTOU) race condition in pg_dump in PostgreSQL allows an object creator to execute arbitrary SQL functions as the user running pg_dump, which is often a superuser. The attack involves replacing another relation type with a view or foreign table. The attack requires waiting for pg_dump to start, but winning the race condition is trivial if the attacker retains an open transaction. Versions before PostgreSQL 16.4, 15.8, 14.13, 13.16, and 12.20 are affected.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

TOCTOU race condition in pg_dump where an attacker who creates an object can win the race to replace it with a view or foreign table after pg_dump checks the object type but before dumping it, allowing execution of arbitrary SQL functions as the pg_dump user (often a superuser). The attack is trivial if the attacker maintains an open transaction.

MitigationUpgrade PostgreSQL to version 16.4, 15.8, 14.13, 13.16, 12.20 or later to patch the race condition in pg_dump.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
PostgreSQLDatabase / datastore
Affected:>= 12.0, < 12.20>= 13.0, < 13.16>= 14.0, < 14.13>= 15.0, < 15.8>= 16.0, < 16.4

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
High
Privileges
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

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

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Identify installed PostgreSQL version
    Run 'psql --version' or 'SELECT version();' to get the exact PostgreSQL version number
    Affected if The version falls within these ranges: 12.0-12.19, 13.0-13.15, 14.0-14.12, 15.0-15.7, or 16.0-16.3
  2. Check for untrusted database users
    Query 'SELECT rolname FROM pg_roles WHERE rolsuper = false;' to list non-superuser roles, then review which roles have CREATE permission on databases or schemas via 'SELECT grantee, privilege_type FROM information_schema.usage_privileges WHERE privilege_type = 'USAGE';'
    Affected if There are non-superuser roles with CREATE privileges that an attacker could control to exploit the race condition during pg_dump operations
  3. Determine if pg_dump is in use
    Check for scheduled or active pg_dump processes: 'ps aux | grep pg_dump' on Linux or check SQL Server Agent/Windows Task Scheduler for database backup jobs that use pg_dump
    Affected if pg_dump or any tool using libpq to dump objects is being executed against a database where untrusted users can create objects

You are affected if your PostgreSQL version is in the affected range AND you have non-superuser roles with CREATE permissions that could race against pg_dump operations.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 12.20 / 13.16 / 14.13 or later
Fixed in 12.2013.1614.13
Interim mitigation

Upgrade PostgreSQL to version 16.4, 15.8, 14.13, 13.16, 12.20 or later to patch the race condition in pg_dump.

Recommended fix High confidence

PostgreSQL 12.20, 13.16, 14.13, 15.8, or 16.4+ (choose the appropriate version for your major version line)

  1. 1. Identify the current PostgreSQL version by running: psql --version or SELECT version();
  2. 2. Determine which major version line you are running (12.x, 13.x, 14.x, or 15.x)
  3. 3. For PostgreSQL 12.x: Upgrade to version 12.20 or later
  4. 4. For PostgreSQL 13.x: Upgrade to version 13.16 or later
  5. 5. For PostgreSQL 14.x: Upgrade to version 14.13 or later
  6. 6. For PostgreSQL 15.x: Upgrade to version 15.8 or later
  7. 7. Alternatively, upgrade to PostgreSQL 16.4 or later to get all fixes
  8. 8. Before upgrading in production, backup all databases: pg_dumpall > backup.sql
Caveat Major version upgrades may require migration steps; always review PostgreSQL release notes for breaking changes between minor versions

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in PostgreSQL Scoped from the published advisory
  • Consultation6.0 h
  • Implementation8.0 h
  • Testing6.0 h
  • Review / QA4.0 h
24.0 hours of engineering $4,260
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $6,816.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2024-7348 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2024-7348 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data