PostgreSQLDatabase / datastore

CVE-2024-10976

MEDIUM · 5.4 CVSS v3.1 Published 2024-11-14
Fix available
A fix is available. Upgrade to 12.21 / 13.17 or later.
See remediation →
60/100
Remediation priority · Elevated
Remotely reachable Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
Incomplete tracking in PostgreSQL of tables with row security allows a reused query to view or change different rows from those intended. CVE-2023-2455 and CVE-2016-2193 fixed most interaction between row security and user ID changes. They missed cases where a subquery, WITH query, security invoker view, or SQL-language function references a table with a row-level security policy. This has the same consequences as the two earlier CVEs. That is to say, it leads to potentially incorrect policies being applied in cases where role-specific policies are used and a given query is planned under one role and then executed under other roles. This scenario can happen under security definer functions or when a common user and query is planned initially and then re-used across multiple SET ROLEs. Applying an incorrect policy may permit a user to complete otherwise-forbidden reads and modifications. This affects only databases that have used CREATE POLICY to define a row security policy. An attacker must tailor an attack to a particular application's pattern of query plan reuse, user ID changes, and role-specific row security policies. Versions before PostgreSQL 17.1, 16.5, 15.9, 14.14, 13.17, and 12.21 are affected.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

PostgreSQL has an incomplete tracking issue with row security policies where queries with subqueries, WITH queries, security invoker views, or SQL-language functions referencing tables with row-level security can apply incorrect policies when planned under one role and executed under another. This allows unauthorized row access/modification in security definer functions or when queries are reused across multiple SET ROLE operations.

MitigationUpgrade PostgreSQL to version 17.1, 16.5, 15.9, 14.14, 13.17, or 12.21 or later. Review existing row security policies and applications using SET ROLE or security definer functions to verify correct behavior after patching.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
PostgreSQLDatabase / datastore
Affected:>= 12.0, < 12.21>= 13.0, < 13.17>= 14.0, < 14.14>= 15.0, < 15.9>= 16.0, < 16.5>= 17.0, < 17.1

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
Low
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Check PostgreSQL version
    Run: SELECT version(); or psql --version
    Affected if The installed version falls within the affected ranges: 12.0-12.20, 13.0-13.16, 14.0-14.13, 15.0-15.8, 16.0-16.4, or 17.0-17.0
  2. Identify tables with row-level security enabled
    Query pg_tables with: SELECT schemaname, tablename FROM pg_tables WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND EXISTS (SELECT 1 FROM pg_policies WHERE pg_policies.tablename = pg_tables.tablename);
    Affected if Row-level security policies exist on any tables in the database
  3. Check for security definer functions
    Query pg_proc: SELECT proname, prosrc FROM pg_proc WHERE proisstrict = false AND prosrc LIKE '%<table_name>%'; or review functions with SECURITY DEFINER attribute via: SELECT proname, prosrc FROM pg_proc WHERE proisstrict = false;
    Affected if Security definer functions exist that reference tables with RLS policies
  4. Check for views with security_invoker attribute
    Query pg_views: SELECT schemaname, viewname FROM pg_views WHERE security_invoker = true;
    Affected if Security invoker views are present in the database
  5. Review SET ROLE usage patterns
    Audit application code and database session configurations for SET ROLE, SET SESSION AUTHORIZATION, or ALTER ROLE ... SET ROLE statements that may switch between roles within the same session
    Affected if The application or database uses SET ROLE operations that could cause a query planned under one role to execute under a different role

You are affected if your PostgreSQL version is vulnerable AND you use row-level security policies combined with security definer functions, security invoker views, or SET ROLE operations that switch execution contexts.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 12.21 / 13.17 / 14.14 or later
Fixed in 12.2113.1714.14
Interim mitigation

Upgrade PostgreSQL to version 17.1, 16.5, 15.9, 14.14, 13.17, or 12.21 or later. Review existing row security policies and applications using SET ROLE or security definer functions to verify correct behavior after patching.

Recommended fix High confidence

Upgrade to PostgreSQL 12.21, 13.17, 14.14, 15.9, 16.5, or 17.1+ (matching your current major version)

  1. 1. Identify the current PostgreSQL version by running: psql --version or SELECT version();
  2. 2. Identify the operating system and package manager (e.g., yum/apt for Linux, Docker, or homebrew)
  3. 3. For yum/rpm-based systems (RHEL, CentOS, Fedora): Run 'sudo yum update postgresql' or 'sudo dnf update postgresql'
  4. 4. For apt/deb-based systems (Debian, Ubuntu): Run 'sudo apt update' followed by 'sudo apt install postgresql'
  5. 5. For Docker: Pull the fixed image (e.g., postgres:15.9, postgres:14.14, postgres:13.17, postgres:12.21) and recreate the container with the same volume data
  6. 6. For Homebrew: Run 'brew update' then 'brew upgrade postgresql'
  7. 7. After upgrading, verify the new version with 'psql --version' to confirm it matches a fixed release (12.21, 13.17, 14.14, 15.9, 16.5, or 17.1+)
  8. 8. Test application functionality to ensure row security policies work correctly with the upgrade
Caveat Minor version upgrades within the same major version (e.g., 15.8 to 15.9) typically have no breaking changes; test your application row security policies after upgrade

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in PostgreSQL Scoped from the published advisory
  • Consultation3.0 h
  • Implementation4.0 h
  • Testing8.0 h
  • Review / QA3.0 h
18.0 hours of engineering $3,060
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $4,896.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2024-10976 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2024-10976 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data