CVE-2024-0985: PostgreSQL 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. As part of exploiting this vulnerability, the attacker creates functions that use CREATE RULE to convert the internally-built temporary table to a view. Versions before PostgreSQL 15.6, 14.11, 13.14, and 12.18 are affected. The only known exploit does not work in PostgreSQL 16 and later. For defense in depth, PostgreSQL 16.2 adds the protections that older branches are using to fix their vulnerability.
Other sources
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.
— NVD
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-0985?
CVE-2024-0985 is classified as a medium severity vulnerability.
How do I fix CVE-2024-0985?
To fix CVE-2024-0985, upgrade your PostgreSQL installation to version 12.18, 14.11, 15.6, or 16.2 or later.
Who is affected by CVE-2024-0985?
CVE-2024-0985 affects various versions of PostgreSQL, including 12.x, 13.x, 14.x, 15.x, and 16.x.
What does CVE-2024-0985 exploit?
CVE-2024-0985 allows an object creator to execute arbitrary SQL functions as the command issuer during the refresh of materialized views.
What software packages are vulnerable to CVE-2024-0985?
The vulnerable software packages include postgresql-12, postgresql-13, postgresql-14, postgresql-15, and postgresql-16 across various operating systems.