{"id":"UBUNTU-CVE-2024-7348","details":"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.","modified":"2026-04-22T18:53:38.592703Z","published":"2024-08-08T13:15:00Z","related":["USN-6968-1","USN-6968-2","USN-6968-3"],"upstream":["CVE-2024-7348"],"references":[{"type":"REPORT","url":"https://ubuntu.com/security/CVE-2024-7348"},{"type":"REPORT","url":"https://www.cve.org/CVERecord?id=CVE-2024-7348"},{"type":"REPORT","url":"https://www.postgresql.org/about/news/postgresql-164-158-1413-1316-1220-and-17-beta-3-released-2910/"},{"type":"REPORT","url":"https://www.postgresql.org/support/security/CVE-2024-7348/"},{"type":"ADVISORY","url":"https://ubuntu.com/security/notices/USN-6968-1"},{"type":"ADVISORY","url":"https://ubuntu.com/security/notices/USN-6968-2"},{"type":"ADVISORY","url":"https://ubuntu.com/security/notices/USN-6968-3"}],"affected":[{"package":{"name":"postgresql-9.3","ecosystem":"Ubuntu:Pro:14.04:LTS","purl":"pkg:deb/ubuntu/postgresql-9.3@9.3.24-0ubuntu0.14.04+esm1?arch=source&distro=trusty/esm"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.3.24-0ubuntu0.14.04+esm1"}]}],"versions":["9.3.1-1","9.3.2-1","9.3.2-1ubuntu1","9.3.2-1ubuntu2","9.3.3-1","9.3.3-1bzr1","9.3.3-1bzr2","9.3.4-1","9.3.5-0ubuntu0.14.04.1","9.3.6-0ubuntu0.14.04","9.3.7-0ubuntu0.14.04","9.3.8-0ubuntu0.4.04","9.3.9-0ubuntu0.14.04","9.3.10-0ubuntu0.14.04","9.3.11-0ubuntu0.14.04","9.3.12-0ubuntu0.14.04","9.3.13-0ubuntu0.14.04","9.3.14-0ubuntu0.14.04","9.3.15-0ubuntu0.14.04","9.3.16-0ubuntu0.14.04","9.3.17-0ubuntu0.14.04","9.3.18-0ubuntu0.14.04.1","9.3.19-0ubuntu0.14.04","9.3.20-0ubuntu0.14.04","9.3.21-0ubuntu0.14.04","9.3.22-0ubuntu0.14.04","9.3.23-0ubuntu0.14.04","9.3.24-0ubuntu0.14.04"],"ecosystem_specific":{"availability":"Available with Ubuntu Pro (Infra-only): https://ubuntu.com/pro","binaries":[{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"libecpg-compat3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"libecpg6"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"libpgtypes3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"libpq5"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-9.3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-client-9.3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-contrib-9.3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-doc-9.3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-plperl-9.3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-plpython-9.3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-plpython3-9.3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-pltcl-9.3"},{"binary_version":"9.3.24-0ubuntu0.14.04+esm1","binary_name":"postgresql-server-dev-9.3"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2024/UBUNTU-CVE-2024-7348.json"}},{"package":{"name":"postgresql-9.5","ecosystem":"Ubuntu:Pro:16.04:LTS","purl":"pkg:deb/ubuntu/postgresql-9.5@9.5.25-0ubuntu0.16.04.1+esm8?arch=source&distro=esm-infra/xenial"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.5.25-0ubuntu0.16.04.1+esm8"}]}],"versions":["9.5.0-1","9.5.0-2","9.5.0-3","9.5.1-1","9.5.2-1","9.5.3-0ubuntu0.16.04","9.5.4-0ubuntu0.16.04","9.5.5-0ubuntu0.16.04","9.5.6-0ubuntu0.16.04","9.5.7-0ubuntu0.16.04","9.5.8-0ubuntu0.16.04.1","9.5.9-0ubuntu0.16.04","9.5.10-0ubuntu0.16.04","9.5.11-0ubuntu0.16.04","9.5.12-0ubuntu0.16.04","9.5.13-0ubuntu0.16.04","9.5.14-0ubuntu0.16.04","9.5.16-0ubuntu0.16.04.1","9.5.17-0ubuntu0.16.04.1","9.5.18-0ubuntu0.16.04.1","9.5.19-0ubuntu0.16.04.1","9.5.21-0ubuntu0.16.04.1","9.5.23-0ubuntu0.16.04.1","9.5.24-0ubuntu0.16.04.1","9.5.25-0ubuntu0.16.04.1","9.5.25-0ubuntu0.16.04.1+esm1","9.5.25-0ubuntu0.16.04.1+esm2","9.5.25-0ubuntu0.16.04.1+esm3","9.5.25-0ubuntu0.16.04.1+esm4","9.5.25-0ubuntu0.16.04.1+esm5","9.5.25-0ubuntu0.16.04.1+esm6","9.5.25-0ubuntu0.16.04.1+esm7"],"ecosystem_specific":{"availability":"Available with Ubuntu Pro (Infra-only): https://ubuntu.com/pro","binaries":[{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"libecpg-compat3"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"libecpg6"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"libpgtypes3"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"libpq5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-9.5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-client-9.5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-contrib-9.5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-doc-9.5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-plperl-9.5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-plpython-9.5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-plpython3-9.5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-pltcl-9.5"},{"binary_version":"9.5.25-0ubuntu0.16.04.1+esm8","binary_name":"postgresql-server-dev-9.5"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2024/UBUNTU-CVE-2024-7348.json"}},{"package":{"name":"postgresql-10","ecosystem":"Ubuntu:Pro:18.04:LTS","purl":"pkg:deb/ubuntu/postgresql-10@10.23-0ubuntu0.18.04.2+esm2?arch=source&distro=esm-infra/bionic"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"10.23-0ubuntu0.18.04.2+esm2"}]}],"versions":["10.1-1","10.1-2","10.2-1","10.3-1","10.4-0ubuntu0.18.04","10.5-0ubuntu0.18.04","10.6-0ubuntu0.18.04.1","10.7-0ubuntu0.18.04.1","10.8-0ubuntu0.18.04.1","10.9-0ubuntu0.18.04.1","10.10-0ubuntu0.18.04.1","10.12-0ubuntu0.18.04.1","10.14-0ubuntu0.18.04.1","10.15-0ubuntu0.18.04.1","10.16-0ubuntu0.18.04.1","10.17-0ubuntu0.18.04.1","10.18-0ubuntu0.18.04.1","10.19-0ubuntu0.18.04.1","10.20-0ubuntu0.18.04.1","10.21-0ubuntu0.18.04.1","10.22-0ubuntu0.18.04.1","10.23-0ubuntu0.18.04.1","10.23-0ubuntu0.18.04.2","10.23-0ubuntu0.18.04.2+esm1"],"ecosystem_specific":{"availability":"Available with Ubuntu Pro (Infra-only): https://ubuntu.com/pro","binaries":[{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"libecpg-compat3"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"libecpg6"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"libpgtypes3"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"libpq5"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"postgresql-10"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"postgresql-client-10"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"postgresql-doc-10"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"postgresql-plperl-10"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"postgresql-plpython-10"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"postgresql-plpython3-10"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"postgresql-pltcl-10"},{"binary_version":"10.23-0ubuntu0.18.04.2+esm2","binary_name":"postgresql-server-dev-10"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2024/UBUNTU-CVE-2024-7348.json"}},{"package":{"name":"postgresql-12","ecosystem":"Ubuntu:20.04:LTS","purl":"pkg:deb/ubuntu/postgresql-12@12.20-0ubuntu0.20.04.1?arch=source&distro=focal"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"12.20-0ubuntu0.20.04.1"}]}],"versions":["12.0-1","12.1-1","12.1-2build1","12.2-1","12.2-1ubuntu2","12.2-4","12.4-0ubuntu0.20.04.1","12.5-0ubuntu0.20.04.1","12.6-0ubuntu0.20.04.1","12.7-0ubuntu0.20.04.1","12.8-0ubuntu0.20.04.1","12.9-0ubuntu0.20.04.1","12.10-0ubuntu0.20.04.1","12.11-0ubuntu0.20.04.1","12.12-0ubuntu0.20.04.1","12.13-0ubuntu0.20.04.1","12.14-0ubuntu0.20.04.1","12.15-0ubuntu0.20.04.1","12.16-0ubuntu0.20.04.1","12.17-0ubuntu0.20.04.1","12.18-0ubuntu0.20.04.1","12.19-0ubuntu0.20.04.1"],"ecosystem_specific":{"availability":"No subscription required","binaries":[{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"libecpg-compat3"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"libecpg6"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"libpgtypes3"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"libpq5"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"postgresql-12"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"postgresql-client-12"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"postgresql-doc-12"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"postgresql-plperl-12"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"postgresql-plpython3-12"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"postgresql-pltcl-12"},{"binary_version":"12.20-0ubuntu0.20.04.1","binary_name":"postgresql-server-dev-12"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2024/UBUNTU-CVE-2024-7348.json"}},{"package":{"name":"postgresql-14","ecosystem":"Ubuntu:22.04:LTS","purl":"pkg:deb/ubuntu/postgresql-14@14.13-0ubuntu0.22.04.1?arch=source&distro=jammy"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"14.13-0ubuntu0.22.04.1"}]}],"versions":["14.1-1ubuntu1","14.2-1","14.2-1ubuntu1","14.3-0ubuntu0.22.04.1","14.4-0ubuntu0.22.04.1","14.5-0ubuntu0.22.04.1","14.6-0ubuntu0.22.04.1","14.7-0ubuntu0.22.04.1","14.8-0ubuntu0.22.04.1","14.9-0ubuntu0.22.04.1","14.10-0ubuntu0.22.04.1","14.11-0ubuntu0.22.04.1","14.12-0ubuntu0.22.04.1"],"ecosystem_specific":{"availability":"No subscription required","binaries":[{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"libecpg-compat3"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"libecpg6"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"libpgtypes3"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"libpq5"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"postgresql-14"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"postgresql-client-14"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"postgresql-doc-14"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"postgresql-plperl-14"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"postgresql-plpython3-14"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"postgresql-pltcl-14"},{"binary_version":"14.13-0ubuntu0.22.04.1","binary_name":"postgresql-server-dev-14"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2024/UBUNTU-CVE-2024-7348.json"}},{"package":{"name":"postgresql-16","ecosystem":"Ubuntu:24.04:LTS","purl":"pkg:deb/ubuntu/postgresql-16@16.4-0ubuntu0.24.04.1?arch=source&distro=noble"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"16.4-0ubuntu0.24.04.1"}]}],"versions":["16.0-2","16.1-1","16.1-1build1","16.1-1build3","16.2-1","16.2-1ubuntu2","16.2-1ubuntu3","16.2-1ubuntu4","16.3-0ubuntu0.24.04.1"],"ecosystem_specific":{"availability":"No subscription required","binaries":[{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"libecpg-compat3"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"libecpg6"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"libpgtypes3"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"libpq5"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"postgresql-16"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"postgresql-client-16"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"postgresql-doc-16"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"postgresql-plperl-16"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"postgresql-plpython3-16"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"postgresql-pltcl-16"},{"binary_version":"16.4-0ubuntu0.24.04.1","binary_name":"postgresql-server-dev-16"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2024/UBUNTU-CVE-2024-7348.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"},{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"},{"type":"Ubuntu","score":"medium"}]}