CVEfocus › CVE database › CVE-2024-0985

CVE-2024-0985PostgreSQL non-owner REFRESH MATERIALIZED VIEW CONCURRENTLY executes arbitrary SQL

CVSS 8.0 HighEPSS 1.2% (higher than 69% of CVEs)Published 2024-02-08Updated 2025-06-13Assigner: PostgreSQL

Late privilege drop in REFRESH MATERIALIZED VIEW CONCURRENTLY in PostgreSQL allows an object creator to execute arbitrary SQL functions as the command issuer. The command intends to run SQL functions as the owner of the materialized view, enabling safe refresh of untrusted materialized views. The victim is a superuser or member of one of the attacker's roles. The attack requires luring the victim into running REFRESH MATERIALIZED VIEW CONCURRENTLY on the attacker's materialized view. Versions before PostgreSQL 16.2, 15.6, 14.11, 13.14, and 12.18 are affected.

CWE-271

What to do

Fixed builds are available from AlmaLinux, Alpine, Debian, Red Hat, Rocky Linux, Ubuntu: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

107Fixed
4Fix pending
10Will not fix
12Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 24.04postgresql-16Fixed16.2-1UBUNTU-CVE-2024-0985
Ubuntu 22.04postgresql-14Fixed14.11-0ubuntu0.22.04.1UBUNTU-CVE-2024-0985
Ubuntu 20.04postgresql-12Fixed12.18-0ubuntu0.20.04.1UBUNTU-CVE-2024-0985
Ubuntu 18.04postgresql-10Fix pendingUBUNTU-CVE-2024-0985
Ubuntu 16.04postgresql-9.5Fix pending9.5.25-0ubuntu0.16.04.1+esm7 (Ubuntu Pro)UBUNTU-CVE-2024-0985
Ubuntu 14.04postgresql-9.1Fix pending
Ubuntu 14.04postgresql-9.3Fix pendingUBUNTU-CVE-2024-0985
Debian 12postgresql-15Fixed15.6-0+deb12u1DEBIAN-CVE-2024-0985
Red Hat Enterprise Linux 9pg_repackFixed0:1.4.8-1.module+el9.2.0+17405+aeb9ec60RHSA-2024:0950
Red Hat Enterprise Linux 9pgauditFixed0:1.7.0-1.module+el9.2.0+17405+aeb9ec60RHSA-2024:0950
Red Hat Enterprise Linux 9postgres-decoderbufsFixed0:1.9.7-1.Final.module+el9.2.0+17405+aeb9ec60RHSA-2024:0950
Red Hat Enterprise Linux 9postgresqlFixed0:13.14-1.el9_3RHSA-2024:0950
Red Hat Enterprise Linux 9postgresql-contribFixed0:13.14-1.el9_3RHSA-2024:0950
Red Hat Enterprise Linux 9postgresql-docsFixed0:15.6-1.module+el9.3.0+21283+b0ea34b6RHSA-2024:0951
Red Hat Enterprise Linux 9postgresql-plperlFixed0:15.6-1.module+el9.3.0+21283+b0ea34b6RHSA-2024:0951
Red Hat Enterprise Linux 9postgresql-plpython3Fixed0:15.6-1.module+el9.3.0+21283+b0ea34b6RHSA-2024:0951
Red Hat Enterprise Linux 9postgresql-pltclFixed0:13.14-1.el9_3RHSA-2024:0950
Red Hat Enterprise Linux 9postgresql-private-develFixed0:15.6-1.module+el9.3.0+21283+b0ea34b6RHSA-2024:0951
Red Hat Enterprise Linux 9postgresql-private-libsFixed0:13.14-1.el9_3RHSA-2024:0950
Red Hat Enterprise Linux 9postgresql-serverFixed0:13.14-1.el9_3RHSA-2024:0950
Red Hat Enterprise Linux 9postgresql-server-develFixed0:13.14-1.el9_3RHSA-2024:0950
Red Hat Enterprise Linux 9postgresql-staticFixed0:15.6-1.module+el9.3.0+21283+b0ea34b6RHSA-2024:0951
Red Hat Enterprise Linux 9postgresql-testFixed0:13.14-1.el9_3RHSA-2024:0950
Red Hat Enterprise Linux 9postgresql-test-rpm-macrosFixed0:15.6-1.module+el9.3.0+21283+b0ea34b6RHSA-2024:0950
Red Hat Enterprise Linux 9postgresql-upgradeFixed0:15.6-1.module+el9.3.0+21283+b0ea34b6RHSA-2024:0951
Red Hat Enterprise Linux 9postgresql-upgrade-develFixed0:13.14-1.el9_3RHSA-2024:0950
Red Hat Enterprise Linux 8pg_repackFixed0:1.4.8-1.module+el8.9.0+19797+c4ce5969RHSA-2024:0974
Red Hat Enterprise Linux 8pgauditFixed0:1.7.0-1.module+el8.9.0+19797+c4ce5969RHSA-2024:0974
Red Hat Enterprise Linux 8postgres-decoderbufsFixed0:0.10.0-2.module+el8.9.0+19330+c97ddbdfRHSA-2024:0975
Red Hat Enterprise Linux 8postgresqlFixed0:13.14-1.module+el8.9.0+21288+3d364c44RHSA-2024:0974
Red Hat Enterprise Linux 8postgresql-contribFixed0:10.23-4.module+el8.9.0+21317+d2c6bf8aRHSA-2024:0975
Red Hat Enterprise Linux 8postgresql-docsFixed0:13.14-1.module+el8.9.0+21288+3d364c44RHSA-2024:0973
Red Hat Enterprise Linux 8postgresql-plperlFixed0:15.6-1.module+el8.9.0+21287+d0eecfe6RHSA-2024:0956
Red Hat Enterprise Linux 8postgresql-plpython3Fixed0:15.6-1.module+el8.9.0+21287+d0eecfe6RHSA-2024:0974
Red Hat Enterprise Linux 8postgresql-pltclFixed0:15.6-1.module+el8.9.0+21287+d0eecfe6RHSA-2024:0975
Red Hat Enterprise Linux 8postgresql-private-develFixed0:15.6-1.module+el8.9.0+21287+d0eecfe6RHSA-2024:0973
Red Hat Enterprise Linux 8postgresql-private-libsFixed0:15.6-1.module+el8.9.0+21287+d0eecfe6RHSA-2024:0973
Red Hat Enterprise Linux 8postgresql-serverFixed0:13.14-1.module+el8.9.0+21288+3d364c44RHSA-2024:0956
Red Hat Enterprise Linux 8postgresql-server-develFixed0:10.23-4.module+el8.9.0+21317+d2c6bf8aRHSA-2024:0974
Red Hat Enterprise Linux 8postgresql-staticFixed0:15.6-1.module+el8.9.0+21287+d0eecfe6RHSA-2024:0974
Red Hat Enterprise Linux 8postgresql-testFixed0:15.6-1.module+el8.9.0+21287+d0eecfe6RHSA-2024:0975
Red Hat Enterprise Linux 8postgresql-test-rpm-macrosFixed0:13.14-1.module+el8.9.0+21288+3d364c44RHSA-2024:0974
Red Hat Enterprise Linux 8postgresql-upgradeFixed0:12.18-1.module+el8.9.0+21289+7c796f9dRHSA-2024:0973
Red Hat Enterprise Linux 8postgresql-upgrade-develFixed0:13.14-1.module+el8.9.0+21288+3d364c44RHSA-2024:0974
Red Hat Enterprise Linux 7postgresqlNot affected
Red Hat Enterprise Linux 7postgresql-contribNot affected
Red Hat Enterprise Linux 7postgresql-develNot affected
Red Hat Enterprise Linux 7postgresql-docsNot affected
Red Hat Enterprise Linux 7postgresql-libsNot affected
Red Hat Enterprise Linux 7postgresql-plperlNot affected
Red Hat Enterprise Linux 7postgresql-plpythonNot affected
Red Hat Enterprise Linux 7postgresql-pltclNot affected
Red Hat Enterprise Linux 7postgresql-serverNot affected
Red Hat Enterprise Linux 7postgresql-staticNot affected
Red Hat Enterprise Linux 7postgresql-testNot affected
Red Hat Enterprise Linux 7postgresql-upgradeNot affected
Red Hat Enterprise Linux 6postgresqlWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-contribWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-develWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-docsWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-libsWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-plperlWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-plpythonWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-pltclWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-serverWill not fix
Out of support scope
Red Hat Enterprise Linux 6postgresql-testWill not fix
Out of support scope
AlmaLinux 9pg_repackFixed1.4.8-1.module_el9.2.0+22+09653793ALSA-2024:0950
AlmaLinux 9pgauditFixed1.7.0-1.module_el9.2.0+22+09653793ALSA-2024:0950
AlmaLinux 9postgres-decoderbufsFixed1.9.7-1.Final.module_el9.2.0+22+09653793ALSA-2024:0950
AlmaLinux 9postgresqlFixed15.6-1.module_el9.3.0+55+d62f4779ALSA-2024:0951
AlmaLinux 9postgresql-contribFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 9postgresql-docsFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 9postgresql-plperlFixed15.6-1.module_el9.3.0+55+d62f4779ALSA-2024:0951
AlmaLinux 9postgresql-plpython3Fixed15.6-1.module_el9.3.0+55+d62f4779ALSA-2024:0951
AlmaLinux 9postgresql-pltclFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 9postgresql-private-develFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 9postgresql-private-libsFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 9postgresql-serverFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 9postgresql-server-develFixed15.6-1.module_el9.3.0+55+d62f4779ALSA-2024:0951
AlmaLinux 9postgresql-staticFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 9postgresql-testFixed15.6-1.module_el9.3.0+55+d62f4779ALSA-2024:0951
AlmaLinux 9postgresql-test-rpm-macrosFixed15.6-1.module_el9.3.0+55+d62f4779ALSA-2024:0950
AlmaLinux 9postgresql-upgradeFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 9postgresql-upgrade-develFixed13.14-1.el9_3ALSA-2024:0950
AlmaLinux 8pg_repackFixed1.4.6-3.module_el8.6.0+2758+4f4474dfALSA-2024:0974
AlmaLinux 8pgauditFixed1.4.0-7.module_el8.9.0+3740+0e74851f.alma.1ALSA-2024:0973
AlmaLinux 8postgres-decoderbufsFixed0.10.0-2.module_el8.6.0+2758+4f4474dfALSA-2024:0974
AlmaLinux 8postgresqlFixed10.23-4.module_el8.9.0+3736+952d0ed7.alma.1ALSA-2024:0974
AlmaLinux 8postgresql-contribFixed13.14-1.module_el8.9.0+3738+d55e2165.alma.1ALSA-2024:0974
AlmaLinux 8postgresql-docsFixed10.23-4.module_el8.9.0+3736+952d0ed7.alma.1ALSA-2024:0973
AlmaLinux 8postgresql-plperlFixed12.18-1.module_el8.9.0+3740+0e74851f.alma.1ALSA-2024:0956
AlmaLinux 8postgresql-plpython3Fixed15.6-1.module_el8.9.0+3739+514705ed.alma.1ALSA-2024:0956
AlmaLinux 8postgresql-pltclFixed12.18-1.module_el8.9.0+3740+0e74851f.alma.1ALSA-2024:0973
AlmaLinux 8postgresql-private-develFixed15.6-1.module_el8.9.0+3739+514705ed.alma.1ALSA-2024:0973
AlmaLinux 8postgresql-private-libsFixed15.6-1.module_el8.9.0+3739+514705ed.alma.1ALSA-2024:0973
AlmaLinux 8postgresql-serverFixed13.14-1.module_el8.9.0+3738+d55e2165.alma.1ALSA-2024:0956
AlmaLinux 8postgresql-server-develFixed13.14-1.module_el8.9.0+3738+d55e2165.alma.1ALSA-2024:0956
AlmaLinux 8postgresql-staticFixed15.6-1.module_el8.9.0+3739+514705ed.alma.1ALSA-2024:0975
AlmaLinux 8postgresql-testFixed12.18-1.module_el8.9.0+3740+0e74851f.alma.1ALSA-2024:0975
AlmaLinux 8postgresql-test-rpm-macrosFixed13.14-1.module_el8.9.0+3738+d55e2165.alma.1ALSA-2024:0956
AlmaLinux 8postgresql-upgradeFixed12.18-1.module_el8.9.0+3740+0e74851f.alma.1ALSA-2024:0973
AlmaLinux 8postgresql-upgrade-develFixed12.18-1.module_el8.9.0+3740+0e74851f.alma.1ALSA-2024:0956
Rocky Linux 9pgauditFixed0:1.7.0-1.module+el9.5.0+30637+4391fccaRLSA-2024:0950
Rocky Linux 9postgres-decoderbufsFixed0:1.9.7-1.Final.module+el9.5.0+30637+4391fccaRLSA-2024:0950
Rocky Linux 9postgresqlFixed0:13.14-1.el9_3RLSA-2024:0951
Rocky Linux 8pg_repackFixed0:1.4.6-3.module+el8.10.0+1862+29bef648RLSA-2024:0973
Rocky Linux 8pgauditFixed0:1.4.0-7.module+el8.9.0+1735+a332307bRLSA-2024:0975
Rocky Linux 8postgres-decoderbufsFixed0:1.9.7-1.Final.module+el8.9.0+1525+fc91df60RLSA-2024:0975
Rocky Linux 8postgresqlFixed0:10.23-4.module+el8.9.0+1734+74bd286cRLSA-2024:0973
Alpine Linux 3.24postgresql16Fixed16.2-r0ALPINE-CVE-2024-0985
Alpine Linux 3.23postgresql16Fixed16.2-r0ALPINE-CVE-2024-0985
Alpine Linux 3.22postgresql15Fixed15.6-r0ALPINE-CVE-2024-0985
Alpine Linux 3.22postgresql16Fixed16.2-r0ALPINE-CVE-2024-0985
Alpine Linux 3.21postgresql15Fixed15.6-r0ALPINE-CVE-2024-0985
Alpine Linux 3.21postgresql16Fixed16.2-r0ALPINE-CVE-2024-0985
Alpine Linux 3.20postgresql14Fixed14.11-r0ALPINE-CVE-2024-0985
Alpine Linux 3.20postgresql15Fixed15.6-r0ALPINE-CVE-2024-0985
Alpine Linux 3.20postgresql16Fixed16.2-r0ALPINE-CVE-2024-0985
Alpine Linux 3.19postgresql13Fixed13.14-r0ALPINE-CVE-2024-0985
Alpine Linux 3.19postgresql14Fixed14.11-r0ALPINE-CVE-2024-0985
Alpine Linux 3.19postgresql15Fixed15.6-r0ALPINE-CVE-2024-0985
Alpine Linux 3.19postgresql16Fixed16.2-r0ALPINE-CVE-2024-0985
Alpine Linux 3.18postgresql12Fixed12.18-r0ALPINE-CVE-2024-0985
Alpine Linux 3.18postgresql13Fixed13.14-r0ALPINE-CVE-2024-0985
Alpine Linux 3.18postgresql14Fixed14.11-r0ALPINE-CVE-2024-0985
Alpine Linux 3.18postgresql15Fixed15.6-r0ALPINE-CVE-2024-0985
Alpine Linux 3.17postgresql12Fixed12.18-r0ALPINE-CVE-2024-0985
Alpine Linux 3.17postgresql13Fixed13.14-r0ALPINE-CVE-2024-0985
Alpine Linux 3.17postgresql14Fixed14.11-r0ALPINE-CVE-2024-0985
Alpine Linux 3.17postgresql15Fixed15.6-r0ALPINE-CVE-2024-0985
Alpine Linux 3.16postgresql12Fixed12.18-r0ALPINE-CVE-2024-0985
Alpine Linux 3.16postgresql13Fixed13.14-r0ALPINE-CVE-2024-0985
Alpine Linux 3.16postgresql14Fixed14.11-r0ALPINE-CVE-2024-0985

What the vendor says

As published in the CVE record by PostgreSQL, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

Workaround: Use REFRESH MATERIALIZED VIEW without CONCURRENTLY.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.