PostgreSQL relation replacement during pg_dump executes arbitrary SQL (CVE-2024-7348)
A TOCTOU race condition vulnerability in PostgreSQL's pg_dump utility allows an attacker who can create database objects to execute arbitrary SQL commands with the privileges of the pg_dump user, often a superuser. The attack involves replacing a relation with a view or foreign table during the dump process. This vulnerability affects multiple PostgreSQL versions prior to 12.20, 13.16, 14.13, 15.8, and 16.4. A patch is available to address this issue.
AI Analysis
Technical Summary
CVE-2024-7348 describes a time-of-check to time-of-use (TOCTOU) race condition in the pg_dump utility of PostgreSQL. An attacker capable of creating objects in the database can exploit this by replacing a relation type with a view or foreign table during the dump process, causing arbitrary SQL functions to be executed as the user running pg_dump, which is often a superuser. The race condition is trivial to win if the attacker maintains an open transaction. Affected versions include all PostgreSQL releases before 12.20, 13.16, 14.13, 15.8, and 16.4. Red Hat has issued an important security advisory with patches for affected packages.
Potential Impact
Successful exploitation allows an attacker with the ability to create objects in the database to execute arbitrary SQL commands with the privileges of the pg_dump user, which is typically a superuser. This could lead to unauthorized data access, modification, or other privileged actions within the database environment.
Mitigation Recommendations
A patch is available and should be applied to affected PostgreSQL versions as soon as possible. Refer to the Red Hat advisory RHSA-2024:8495 and the PostgreSQL update channels for the appropriate security updates. No additional mitigation steps are required beyond applying the official fixes.
PostgreSQL relation replacement during pg_dump executes arbitrary SQL (CVE-2024-7348)
Description
A TOCTOU race condition vulnerability in PostgreSQL's pg_dump utility allows an attacker who can create database objects to execute arbitrary SQL commands with the privileges of the pg_dump user, often a superuser. The attack involves replacing a relation with a view or foreign table during the dump process. This vulnerability affects multiple PostgreSQL versions prior to 12.20, 13.16, 14.13, 15.8, and 16.4. A patch is available to address this issue.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2024-7348 describes a time-of-check to time-of-use (TOCTOU) race condition in the pg_dump utility of PostgreSQL. An attacker capable of creating objects in the database can exploit this by replacing a relation type with a view or foreign table during the dump process, causing arbitrary SQL functions to be executed as the user running pg_dump, which is often a superuser. The race condition is trivial to win if the attacker maintains an open transaction. Affected versions include all PostgreSQL releases before 12.20, 13.16, 14.13, 15.8, and 16.4. Red Hat has issued an important security advisory with patches for affected packages.
Potential Impact
Successful exploitation allows an attacker with the ability to create objects in the database to execute arbitrary SQL commands with the privileges of the pg_dump user, which is typically a superuser. This could lead to unauthorized data access, modification, or other privileged actions within the database environment.
Mitigation Recommendations
A patch is available and should be applied to affected PostgreSQL versions as soon as possible. Refer to the Red Hat advisory RHSA-2024:8495 and the PostgreSQL update channels for the appropriate security updates. No additional mitigation steps are required beyond applying the official fixes.
Technical Details
- Gcve Source
- db.gcve.eu
- Csaf Category
- csaf_security_advisory
- Csaf Version
- 2.0
- Publisher
- Red Hat Product Security
- Advisory Id
- RHSA-2024:8495
- Cve Count
- 1
Threat ID: 6a3da1ed4853345fc1830fa1
Added to database: 06/25/2026, 21:47:25 UTC
Last enriched: 09/08/2026, 15:16:04 UTC
Last updated: 09/10/2026, 19:36:49 UTC
Views: 67
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.