CVE-2024-0985PostgreSQL non-owner REFRESH MATERIALIZED VIEW CONCURRENTLY executes arbitrary SQL
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.
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
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.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | postgresql-16 | Fixed | 16.2-1 | UBUNTU-CVE-2024-0985 |
| Ubuntu 22.04 | postgresql-14 | Fixed | 14.11-0ubuntu0.22.04.1 | UBUNTU-CVE-2024-0985 |
| Ubuntu 20.04 | postgresql-12 | Fixed | 12.18-0ubuntu0.20.04.1 | UBUNTU-CVE-2024-0985 |
| Ubuntu 18.04 | postgresql-10 | Fix pending | UBUNTU-CVE-2024-0985 | |
| Ubuntu 16.04 | postgresql-9.5 | Fix pending | 9.5.25-0ubuntu0.16.04.1+esm7 (Ubuntu Pro) | UBUNTU-CVE-2024-0985 |
| Ubuntu 14.04 | postgresql-9.1 | Fix pending | ||
| Ubuntu 14.04 | postgresql-9.3 | Fix pending | UBUNTU-CVE-2024-0985 | |
| Debian 12 | postgresql-15 | Fixed | 15.6-0+deb12u1 | DEBIAN-CVE-2024-0985 |
| Red Hat Enterprise Linux 9 | pg_repack | Fixed | 0:1.4.8-1.module+el9.2.0+17405+aeb9ec60 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | pgaudit | Fixed | 0:1.7.0-1.module+el9.2.0+17405+aeb9ec60 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgres-decoderbufs | Fixed | 0:1.9.7-1.Final.module+el9.2.0+17405+aeb9ec60 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql | Fixed | 0:13.14-1.el9_3 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql-contrib | Fixed | 0:13.14-1.el9_3 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql-docs | Fixed | 0:15.6-1.module+el9.3.0+21283+b0ea34b6 | RHSA-2024:0951 |
| Red Hat Enterprise Linux 9 | postgresql-plperl | Fixed | 0:15.6-1.module+el9.3.0+21283+b0ea34b6 | RHSA-2024:0951 |
| Red Hat Enterprise Linux 9 | postgresql-plpython3 | Fixed | 0:15.6-1.module+el9.3.0+21283+b0ea34b6 | RHSA-2024:0951 |
| Red Hat Enterprise Linux 9 | postgresql-pltcl | Fixed | 0:13.14-1.el9_3 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql-private-devel | Fixed | 0:15.6-1.module+el9.3.0+21283+b0ea34b6 | RHSA-2024:0951 |
| Red Hat Enterprise Linux 9 | postgresql-private-libs | Fixed | 0:13.14-1.el9_3 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql-server | Fixed | 0:13.14-1.el9_3 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql-server-devel | Fixed | 0:13.14-1.el9_3 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql-static | Fixed | 0:15.6-1.module+el9.3.0+21283+b0ea34b6 | RHSA-2024:0951 |
| Red Hat Enterprise Linux 9 | postgresql-test | Fixed | 0:13.14-1.el9_3 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql-test-rpm-macros | Fixed | 0:15.6-1.module+el9.3.0+21283+b0ea34b6 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 9 | postgresql-upgrade | Fixed | 0:15.6-1.module+el9.3.0+21283+b0ea34b6 | RHSA-2024:0951 |
| Red Hat Enterprise Linux 9 | postgresql-upgrade-devel | Fixed | 0:13.14-1.el9_3 | RHSA-2024:0950 |
| Red Hat Enterprise Linux 8 | pg_repack | Fixed | 0:1.4.8-1.module+el8.9.0+19797+c4ce5969 | RHSA-2024:0974 |
| Red Hat Enterprise Linux 8 | pgaudit | Fixed | 0:1.7.0-1.module+el8.9.0+19797+c4ce5969 | RHSA-2024:0974 |
| Red Hat Enterprise Linux 8 | postgres-decoderbufs | Fixed | 0:0.10.0-2.module+el8.9.0+19330+c97ddbdf | RHSA-2024:0975 |
| Red Hat Enterprise Linux 8 | postgresql | Fixed | 0:13.14-1.module+el8.9.0+21288+3d364c44 | RHSA-2024:0974 |
| Red Hat Enterprise Linux 8 | postgresql-contrib | Fixed | 0:10.23-4.module+el8.9.0+21317+d2c6bf8a | RHSA-2024:0975 |
| Red Hat Enterprise Linux 8 | postgresql-docs | Fixed | 0:13.14-1.module+el8.9.0+21288+3d364c44 | RHSA-2024:0973 |
| Red Hat Enterprise Linux 8 | postgresql-plperl | Fixed | 0:15.6-1.module+el8.9.0+21287+d0eecfe6 | RHSA-2024:0956 |
| Red Hat Enterprise Linux 8 | postgresql-plpython3 | Fixed | 0:15.6-1.module+el8.9.0+21287+d0eecfe6 | RHSA-2024:0974 |
| Red Hat Enterprise Linux 8 | postgresql-pltcl | Fixed | 0:15.6-1.module+el8.9.0+21287+d0eecfe6 | RHSA-2024:0975 |
| Red Hat Enterprise Linux 8 | postgresql-private-devel | Fixed | 0:15.6-1.module+el8.9.0+21287+d0eecfe6 | RHSA-2024:0973 |
| Red Hat Enterprise Linux 8 | postgresql-private-libs | Fixed | 0:15.6-1.module+el8.9.0+21287+d0eecfe6 | RHSA-2024:0973 |
| Red Hat Enterprise Linux 8 | postgresql-server | Fixed | 0:13.14-1.module+el8.9.0+21288+3d364c44 | RHSA-2024:0956 |
| Red Hat Enterprise Linux 8 | postgresql-server-devel | Fixed | 0:10.23-4.module+el8.9.0+21317+d2c6bf8a | RHSA-2024:0974 |
| Red Hat Enterprise Linux 8 | postgresql-static | Fixed | 0:15.6-1.module+el8.9.0+21287+d0eecfe6 | RHSA-2024:0974 |
| Red Hat Enterprise Linux 8 | postgresql-test | Fixed | 0:15.6-1.module+el8.9.0+21287+d0eecfe6 | RHSA-2024:0975 |
| Red Hat Enterprise Linux 8 | postgresql-test-rpm-macros | Fixed | 0:13.14-1.module+el8.9.0+21288+3d364c44 | RHSA-2024:0974 |
| Red Hat Enterprise Linux 8 | postgresql-upgrade | Fixed | 0:12.18-1.module+el8.9.0+21289+7c796f9d | RHSA-2024:0973 |
| Red Hat Enterprise Linux 8 | postgresql-upgrade-devel | Fixed | 0:13.14-1.module+el8.9.0+21288+3d364c44 | RHSA-2024:0974 |
| Red Hat Enterprise Linux 7 | postgresql | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-contrib | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-devel | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-docs | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-libs | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-plperl | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-plpython | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-pltcl | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-server | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-static | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-test | Not affected | ||
| Red Hat Enterprise Linux 7 | postgresql-upgrade | Not affected | ||
| Red Hat Enterprise Linux 6 | postgresql | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-contrib | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-devel | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-docs | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-libs | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-plperl | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-plpython | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-pltcl | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-server | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | postgresql-test | Will not fix Out of support scope | ||
| AlmaLinux 9 | pg_repack | Fixed | 1.4.8-1.module_el9.2.0+22+09653793 | ALSA-2024:0950 |
| AlmaLinux 9 | pgaudit | Fixed | 1.7.0-1.module_el9.2.0+22+09653793 | ALSA-2024:0950 |
| AlmaLinux 9 | postgres-decoderbufs | Fixed | 1.9.7-1.Final.module_el9.2.0+22+09653793 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql | Fixed | 15.6-1.module_el9.3.0+55+d62f4779 | ALSA-2024:0951 |
| AlmaLinux 9 | postgresql-contrib | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-docs | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-plperl | Fixed | 15.6-1.module_el9.3.0+55+d62f4779 | ALSA-2024:0951 |
| AlmaLinux 9 | postgresql-plpython3 | Fixed | 15.6-1.module_el9.3.0+55+d62f4779 | ALSA-2024:0951 |
| AlmaLinux 9 | postgresql-pltcl | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-private-devel | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-private-libs | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-server | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-server-devel | Fixed | 15.6-1.module_el9.3.0+55+d62f4779 | ALSA-2024:0951 |
| AlmaLinux 9 | postgresql-static | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-test | Fixed | 15.6-1.module_el9.3.0+55+d62f4779 | ALSA-2024:0951 |
| AlmaLinux 9 | postgresql-test-rpm-macros | Fixed | 15.6-1.module_el9.3.0+55+d62f4779 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-upgrade | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 9 | postgresql-upgrade-devel | Fixed | 13.14-1.el9_3 | ALSA-2024:0950 |
| AlmaLinux 8 | pg_repack | Fixed | 1.4.6-3.module_el8.6.0+2758+4f4474df | ALSA-2024:0974 |
| AlmaLinux 8 | pgaudit | Fixed | 1.4.0-7.module_el8.9.0+3740+0e74851f.alma.1 | ALSA-2024:0973 |
| AlmaLinux 8 | postgres-decoderbufs | Fixed | 0.10.0-2.module_el8.6.0+2758+4f4474df | ALSA-2024:0974 |
| AlmaLinux 8 | postgresql | Fixed | 10.23-4.module_el8.9.0+3736+952d0ed7.alma.1 | ALSA-2024:0974 |
| AlmaLinux 8 | postgresql-contrib | Fixed | 13.14-1.module_el8.9.0+3738+d55e2165.alma.1 | ALSA-2024:0974 |
| AlmaLinux 8 | postgresql-docs | Fixed | 10.23-4.module_el8.9.0+3736+952d0ed7.alma.1 | ALSA-2024:0973 |
| AlmaLinux 8 | postgresql-plperl | Fixed | 12.18-1.module_el8.9.0+3740+0e74851f.alma.1 | ALSA-2024:0956 |
| AlmaLinux 8 | postgresql-plpython3 | Fixed | 15.6-1.module_el8.9.0+3739+514705ed.alma.1 | ALSA-2024:0956 |
| AlmaLinux 8 | postgresql-pltcl | Fixed | 12.18-1.module_el8.9.0+3740+0e74851f.alma.1 | ALSA-2024:0973 |
| AlmaLinux 8 | postgresql-private-devel | Fixed | 15.6-1.module_el8.9.0+3739+514705ed.alma.1 | ALSA-2024:0973 |
| AlmaLinux 8 | postgresql-private-libs | Fixed | 15.6-1.module_el8.9.0+3739+514705ed.alma.1 | ALSA-2024:0973 |
| AlmaLinux 8 | postgresql-server | Fixed | 13.14-1.module_el8.9.0+3738+d55e2165.alma.1 | ALSA-2024:0956 |
| AlmaLinux 8 | postgresql-server-devel | Fixed | 13.14-1.module_el8.9.0+3738+d55e2165.alma.1 | ALSA-2024:0956 |
| AlmaLinux 8 | postgresql-static | Fixed | 15.6-1.module_el8.9.0+3739+514705ed.alma.1 | ALSA-2024:0975 |
| AlmaLinux 8 | postgresql-test | Fixed | 12.18-1.module_el8.9.0+3740+0e74851f.alma.1 | ALSA-2024:0975 |
| AlmaLinux 8 | postgresql-test-rpm-macros | Fixed | 13.14-1.module_el8.9.0+3738+d55e2165.alma.1 | ALSA-2024:0956 |
| AlmaLinux 8 | postgresql-upgrade | Fixed | 12.18-1.module_el8.9.0+3740+0e74851f.alma.1 | ALSA-2024:0973 |
| AlmaLinux 8 | postgresql-upgrade-devel | Fixed | 12.18-1.module_el8.9.0+3740+0e74851f.alma.1 | ALSA-2024:0956 |
| Rocky Linux 9 | pgaudit | Fixed | 0:1.7.0-1.module+el9.5.0+30637+4391fcca | RLSA-2024:0950 |
| Rocky Linux 9 | postgres-decoderbufs | Fixed | 0:1.9.7-1.Final.module+el9.5.0+30637+4391fcca | RLSA-2024:0950 |
| Rocky Linux 9 | postgresql | Fixed | 0:13.14-1.el9_3 | RLSA-2024:0951 |
| Rocky Linux 8 | pg_repack | Fixed | 0:1.4.6-3.module+el8.10.0+1862+29bef648 | RLSA-2024:0973 |
| Rocky Linux 8 | pgaudit | Fixed | 0:1.4.0-7.module+el8.9.0+1735+a332307b | RLSA-2024:0975 |
| Rocky Linux 8 | postgres-decoderbufs | Fixed | 0:1.9.7-1.Final.module+el8.9.0+1525+fc91df60 | RLSA-2024:0975 |
| Rocky Linux 8 | postgresql | Fixed | 0:10.23-4.module+el8.9.0+1734+74bd286c | RLSA-2024:0973 |
| Alpine Linux 3.24 | postgresql16 | Fixed | 16.2-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.23 | postgresql16 | Fixed | 16.2-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.22 | postgresql15 | Fixed | 15.6-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.22 | postgresql16 | Fixed | 16.2-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.21 | postgresql15 | Fixed | 15.6-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.21 | postgresql16 | Fixed | 16.2-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.20 | postgresql14 | Fixed | 14.11-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.20 | postgresql15 | Fixed | 15.6-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.20 | postgresql16 | Fixed | 16.2-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.19 | postgresql13 | Fixed | 13.14-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.19 | postgresql14 | Fixed | 14.11-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.19 | postgresql15 | Fixed | 15.6-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.19 | postgresql16 | Fixed | 16.2-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.18 | postgresql12 | Fixed | 12.18-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.18 | postgresql13 | Fixed | 13.14-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.18 | postgresql14 | Fixed | 14.11-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.18 | postgresql15 | Fixed | 15.6-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.17 | postgresql12 | Fixed | 12.18-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.17 | postgresql13 | Fixed | 13.14-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.17 | postgresql14 | Fixed | 14.11-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.17 | postgresql15 | Fixed | 15.6-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.16 | postgresql12 | Fixed | 12.18-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.16 | postgresql13 | Fixed | 13.14-r0 | ALPINE-CVE-2024-0985 |
| Alpine Linux 3.16 | postgresql14 | Fixed | 14.11-r0 | ALPINE-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.
- PostgreSQL: affected: 16 to before 16.2, 15 to before 15.6, 14 to before 14.11, 13 to before 13.14, before 12.18; fixed in
16.2,15.6,14.11,13.14,12.18
Workaround: Use REFRESH MATERIALIZED VIEW without CONCURRENTLY.
References
- https://www.postgresql.org/support/security/CVE-2024-0985/
- https://lists.debian.org/debian-lts-announce/2024/03/msg00017.html
- https://saites.dev/projects/personal/postgres-cve-2024-0985/
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.