Vulnerability · Published Aug 8, 2024 · Assigned by PostgreSQL

CVE-2024-7348PostgreSQL relation replacement during pg_dump executes arbitrary SQL

High 8.8

In plain English

A high-severity security flaw in PostgreSQL. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 1.6% (higher than 75% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)8.8High
Exploit odds (30 days)1.6%top 24.6% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:8pg_repack1.4.6-3.module_el8.6.0+3095+ee60d910ALSA-2024:6018
AlmaLinux:8pg_repack1.4.6-3.module_el8.9.0+3704+f1f917ceALSA-2024:6000
AlmaLinux:8pg_repack1.4.8-1.module_el8.9.0+3706+885c732eALSA-2024:6001
AlmaLinux:8pg_repack1.4.8-1.module_el8.10.0+3798+606ebb9fALSA-2024:5927
AlmaLinux:8pg_repack1.4.6-3.module_el8.6.0+2760+1746ec94ALSA-2024:6018
AlmaLinux:9pg_repack1.4.8-1.module_el9.4.0+66+eb9878bcALSA-2024:5929
AlmaLinux:9pg_repack1.4.8-1.module_el9.3.0+52+21733919ALSA-2024:6020
AlmaLinux:8pgaudit1.4.0-7.module_el8.9.0+3740+0e74851f.alma.1ALSA-2024:6000
AlmaLinux:8pgaudit1.7.0-1.module_el8.9.0+3706+885c732eALSA-2024:6001
AlmaLinux:8pgaudit1.5.0-1.module_el8.6.0+3095+ee60d910ALSA-2024:6018
AlmaLinux:8pgaudit1.5.0-1.module_el8.6.0+2760+1746ec94ALSA-2024:6018
AlmaLinux:8pgaudit16.0-1.module_el8.10.0+3798+606ebb9fALSA-2024:5927
AlmaLinux:9pgaudit16.0-1.module_el9.4.0+66+eb9878bcALSA-2024:5929
AlmaLinux:9pgaudit1.7.0-1.module_el9.3.0+52+21733919ALSA-2024:6020
AlmaLinux:8postgres-decoderbufs1.9.7-1.Final.module_el8.9.0+3706+885c732eALSA-2024:6001
AlmaLinux:8postgres-decoderbufs2.4.0-1.Final.module_el8.10.0+3798+606ebb9fALSA-2024:5927
AlmaLinux:8postgres-decoderbufs0.10.0-2.module_el8.9.0+3704+f1f917ceALSA-2024:6000
AlmaLinux:8postgres-decoderbufs0.10.0-2.module_el8.6.0+2760+1746ec94ALSA-2024:6018
AlmaLinux:8postgres-decoderbufs0.10.0-2.module_el8.6.0+3095+ee60d910ALSA-2024:6018
AlmaLinux:9postgres-decoderbufs1.9.7-1.Final.module_el9.3.0+52+21733919ALSA-2024:6020
AlmaLinux:9postgres-decoderbufs2.4.0-1.Final.module_el9.4.0+66+eb9878bcALSA-2024:5929
AlmaLinux:8postgresql16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:9postgresql15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:9postgresql13.16-1.el9_4ALSA-2024:5999
AlmaLinux:8postgresql-contrib15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-contrib16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-contrib12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:8postgresql-contrib13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:9postgresql-contrib13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-contrib15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-contrib16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-docs16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-docs15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-docs13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-docs12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:9postgresql-docs13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-docs16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:9postgresql-docs15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:8postgresql-plperl16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-plperl12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:8postgresql-plperl15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-plperl13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:9postgresql-plperl15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-plperl13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-plperl16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-plpython316.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-plpython315.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-plpython313.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-plpython312.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:9postgresql-plpython315.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-plpython313.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-plpython316.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-pltcl15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-pltcl12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:8postgresql-pltcl13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-pltcl16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:9postgresql-pltcl13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-pltcl15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-pltcl16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-private-devel15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-private-devel16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:9postgresql-private-devel13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-private-devel15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-private-devel16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-private-libs15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-private-libs16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:9postgresql-private-libs15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-private-libs13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-private-libs16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-server15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-server12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:8postgresql-server13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-server16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:9postgresql-server15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-server16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:9postgresql-server13.16-1.el9_4ALSA-2024:5999
AlmaLinux:8postgresql-server-devel12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:8postgresql-server-devel13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-server-devel16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-server-devel15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:9postgresql-server-devel15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-server-devel13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-server-devel16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-static16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-static12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:8postgresql-static13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-static15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:9postgresql-static16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:9postgresql-static15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-static13.16-1.el9_4ALSA-2024:5999
AlmaLinux:8postgresql-test15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-test16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-test13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-test12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:9postgresql-test16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:9postgresql-test15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-test13.16-1.el9_4ALSA-2024:5999
AlmaLinux:8postgresql-test-rpm-macros15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-test-rpm-macros16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-test-rpm-macros12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:8postgresql-test-rpm-macros13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:9postgresql-test-rpm-macros15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-test-rpm-macros16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-upgrade16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:8postgresql-upgrade15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-upgrade13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-upgrade12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:9postgresql-upgrade15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
AlmaLinux:9postgresql-upgrade13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-upgrade16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:8postgresql-upgrade-devel15.8-1.module_el8.10.0+3888+1aead837ALSA-2024:6001
AlmaLinux:8postgresql-upgrade-devel12.20-1.module_el8.10.0+3886+1dfe41d7ALSA-2024:6000
AlmaLinux:8postgresql-upgrade-devel13.16-1.module_el8.10.0+3887+93e5d125ALSA-2024:6018
AlmaLinux:8postgresql-upgrade-devel16.4-1.module_el8.10.0+3884+a79fbae6ALSA-2024:5927
AlmaLinux:9postgresql-upgrade-devel16.4-1.module_el9.4.0+109+624ac33aALSA-2024:5929
AlmaLinux:9postgresql-upgrade-devel13.16-1.el9_4ALSA-2024:5999
AlmaLinux:9postgresql-upgrade-devel15.8-1.module_el9.4.0+111+667b9e9eALSA-2024:6020
Alpine:v3.20postgresql1414.13-r0ALPINE-CVE-2024-7348
Alpine:v3.20postgresql1515.8-r0ALPINE-CVE-2024-7348
Alpine:v3.21postgresql1515.8-r0ALPINE-CVE-2024-7348
Alpine:v3.22postgresql1515.8-r0ALPINE-CVE-2024-7348
Alpine:v3.20postgresql1616.4-r0ALPINE-CVE-2024-7348
Alpine:v3.21postgresql1616.4-r0ALPINE-CVE-2024-7348
Alpine:v3.22postgresql1616.4-r0ALPINE-CVE-2024-7348
Alpine:v3.23postgresql1616.4-r0ALPINE-CVE-2024-7348
Alpine:v3.24postgresql1616.4-r0ALPINE-CVE-2024-7348
Debian:12postgresql-1515.8-0+deb12u1DEBIAN-CVE-2024-7348
Debian:12postgresql-1515.8-0+deb12u1DSA-5745-1
Rocky Linux:8pg_repack0:1.4.6-3.module+el8.9.0+1603+444d1b54RLSA-2024:6018
Rocky Linux:8pg_repack0:1.4.8-1.module+el8.10.0+1622+bd25b19cRLSA-2024:5927
Rocky Linux:8pg_repack0:1.4.6-3.module+el8.10.0+1862+29bef648RLSA-2024:6000
Rocky Linux:8pg_repack0:1.4.8-1.module+el8.10.0+1622+bd25b19cRLSA-2024:6001
Rocky Linux:8pg_repack0:1.4.8-1.module+el8.10.0+1858+fcc46a79RLSA-2024:6001
Rocky Linux:8pg_repack0:1.4.8-1.module+el8.9.0+1525+fc91df60RLSA-2024:6001
Rocky Linux:8pg_repack0:1.4.6-3.module+el8.10.0+1862+29bef648RLSA-2024:6018
Rocky Linux:8pg_repack0:1.4.6-3.module+el8.9.0+1594+4a6adae9RLSA-2024:6018
Rocky Linux:8pgaudit0:1.4.0-7.module+el8.9.0+1735+a332307bRLSA-2024:6000
Rocky Linux:8pgaudit0:1.7.0-1.module+el8.9.0+1525+fc91df60RLSA-2024:6001
Rocky Linux:8pgaudit0:1.5.0-1.module+el8.9.0+1594+4a6adae9RLSA-2024:6018
Rocky Linux:8pgaudit0:16.0-1.module+el8.10.0+1622+bd25b19cRLSA-2024:5927
Rocky Linux:9pgaudit0:1.7.0-1.module+el9.5.0+30637+4391fccaRLSA-2024:6020
Rocky Linux:9pgaudit0:16.0-1.module+el9.5.0+30638+72f697e1RLSA-2024:5929
Rocky Linux:8postgres-decoderbufs0:2.4.0-1.Final.module+el8.10.0+1622+bd25b19cRLSA-2024:5927
Rocky Linux:8postgres-decoderbufs0:0.10.0-2.module+el8.10.0+1862+29bef648RLSA-2024:6018
Rocky Linux:8postgres-decoderbufs0:0.10.0-2.module+el8.9.0+1594+4a6adae9RLSA-2024:6018
Rocky Linux:8postgres-decoderbufs0:0.10.0-2.module+el8.9.0+1603+444d1b54RLSA-2024:6018
Rocky Linux:8postgres-decoderbufs0:1.9.7-1.Final.module+el8.9.0+1525+fc91df60RLSA-2024:6001
Rocky Linux:8postgres-decoderbufs0:0.10.0-2.module+el8.10.0+1862+29bef648RLSA-2024:6000
Rocky Linux:9postgres-decoderbufs0:1.9.7-1.Final.module+el9.5.0+30637+4391fccaRLSA-2024:6020
Rocky Linux:9postgres-decoderbufs0:2.4.0-1.Final.module+el9.5.0+30638+72f697e1RLSA-2024:5929
Rocky Linux:8postgresql0:15.8-1.module+el8.10.0+1864+f5aa9248RLSA-2024:6001
Rocky Linux:8postgresql0:16.4-1.module+el8.10.0+1858+fcc46a79RLSA-2024:5927
Rocky Linux:8postgresql0:12.20-1.module+el8.10.0+1862+29bef648RLSA-2024:6000
Rocky Linux:8postgresql0:13.16-1.module+el8.10.0+1863+86f282f3RLSA-2024:6018
Rocky Linux:9postgresql0:13.16-1.el9_4RLSA-2024:5999
Ubuntu:22.04:LTSpostgresql-1414.13-0ubuntu0.22.04.1UBUNTU-CVE-2024-7348
Ubuntu:22.04:LTSpostgresql-1414.13-0ubuntu0.22.04.1USN-6968-1
Ubuntu:24.04:LTSpostgresql-1616.4-0ubuntu0.24.04.1USN-6968-1
Ubuntu:24.04:LTSpostgresql-1616.4-0ubuntu0.24.04.1UBUNTU-CVE-2024-7348

Affected products (as reported)

VendorProductVersions
n/a PostgreSQL 16 – before 16.415 – before 15.814 – before 14.1313 – before 13.160 – before 12.20

Weakness: CWE-367 · Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

References