CVE-2024-10976: Improper Preservation of Consistency Between Independent Representations of Shared State in PostgreSQL
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.
AI Analysis
Technical Summary
CVE-2024-10976 is a vulnerability in PostgreSQL related to the improper preservation of consistency between independent representations of shared state, specifically in the context of row-level security (RLS) policies. PostgreSQL implements RLS via CREATE POLICY to restrict access to rows based on user roles. Previous vulnerabilities (CVE-2023-2455 and CVE-2016-2193) addressed most issues with RLS and user ID changes, but this new vulnerability reveals that certain query constructs—such as subqueries, WITH queries, security invoker views, and SQL-language functions—can bypass these protections. The root cause is that when a query is planned under one role and then executed under another (common in security definer functions or when queries are reused across multiple SET ROLE commands), the RLS policies applied may be incorrect. This can allow users to read or modify rows they should not have access to, violating confidentiality and integrity. The vulnerability affects PostgreSQL versions before 17.1, 16.5, 15.9, 14.14, 13.17, and 12.21, and only impacts databases that have implemented RLS policies. Exploitation requires knowledge of the application's query planning and role usage patterns, making it a targeted attack vector rather than a broad exploit. The CVSS 3.1 score is 4.2 (medium), reflecting network attack vector, high attack complexity, low privileges required, no user interaction, and limited confidentiality and integrity impact without availability impact. No known exploits have been reported in the wild as of publication.
Potential Impact
For European organizations, the impact of CVE-2024-10976 can be significant in environments where PostgreSQL databases enforce row-level security policies to segregate data access by user roles. Unauthorized data disclosure or modification could lead to breaches of sensitive personal data, intellectual property, or regulatory non-compliance, especially under GDPR requirements. Organizations relying on security definer functions or query plan reuse across roles are particularly at risk. The vulnerability undermines the trustworthiness of RLS as a security control, potentially allowing attackers or malicious insiders to bypass intended access restrictions. While exploitation requires some sophistication, the risk is elevated in multi-tenant applications, SaaS platforms, or internal systems with complex role-based access controls. The absence of known exploits suggests a window for proactive patching to prevent data breaches. Disruption to data integrity could also affect business operations and decision-making processes.
Mitigation Recommendations
European organizations should immediately assess their PostgreSQL deployments for the use of row-level security policies via CREATE POLICY. They must upgrade affected PostgreSQL versions to the fixed releases: 17.1, 16.5, 15.9, 14.14, 13.17, or 12.21 or later. In parallel, review application code for use of security definer functions, subqueries, WITH queries, and SQL-language functions that access RLS-protected tables, and audit query plan reuse patterns involving SET ROLE commands. Implement strict role management policies to minimize unnecessary role switching and query reuse across roles. Enable detailed logging of role changes and query executions to detect anomalous access patterns. Conduct penetration testing focused on RLS bypass scenarios. Where immediate patching is not feasible, consider disabling RLS or limiting its use until patched, though this may reduce security. Finally, ensure that database backups and monitoring are in place to detect and respond to potential exploitation attempts.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain, Poland, Belgium
CVE-2024-10976: Improper Preservation of Consistency Between Independent Representations of Shared State in PostgreSQL
Description
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.
AI-Powered Analysis
Technical Analysis
CVE-2024-10976 is a vulnerability in PostgreSQL related to the improper preservation of consistency between independent representations of shared state, specifically in the context of row-level security (RLS) policies. PostgreSQL implements RLS via CREATE POLICY to restrict access to rows based on user roles. Previous vulnerabilities (CVE-2023-2455 and CVE-2016-2193) addressed most issues with RLS and user ID changes, but this new vulnerability reveals that certain query constructs—such as subqueries, WITH queries, security invoker views, and SQL-language functions—can bypass these protections. The root cause is that when a query is planned under one role and then executed under another (common in security definer functions or when queries are reused across multiple SET ROLE commands), the RLS policies applied may be incorrect. This can allow users to read or modify rows they should not have access to, violating confidentiality and integrity. The vulnerability affects PostgreSQL versions before 17.1, 16.5, 15.9, 14.14, 13.17, and 12.21, and only impacts databases that have implemented RLS policies. Exploitation requires knowledge of the application's query planning and role usage patterns, making it a targeted attack vector rather than a broad exploit. The CVSS 3.1 score is 4.2 (medium), reflecting network attack vector, high attack complexity, low privileges required, no user interaction, and limited confidentiality and integrity impact without availability impact. No known exploits have been reported in the wild as of publication.
Potential Impact
For European organizations, the impact of CVE-2024-10976 can be significant in environments where PostgreSQL databases enforce row-level security policies to segregate data access by user roles. Unauthorized data disclosure or modification could lead to breaches of sensitive personal data, intellectual property, or regulatory non-compliance, especially under GDPR requirements. Organizations relying on security definer functions or query plan reuse across roles are particularly at risk. The vulnerability undermines the trustworthiness of RLS as a security control, potentially allowing attackers or malicious insiders to bypass intended access restrictions. While exploitation requires some sophistication, the risk is elevated in multi-tenant applications, SaaS platforms, or internal systems with complex role-based access controls. The absence of known exploits suggests a window for proactive patching to prevent data breaches. Disruption to data integrity could also affect business operations and decision-making processes.
Mitigation Recommendations
European organizations should immediately assess their PostgreSQL deployments for the use of row-level security policies via CREATE POLICY. They must upgrade affected PostgreSQL versions to the fixed releases: 17.1, 16.5, 15.9, 14.14, 13.17, or 12.21 or later. In parallel, review application code for use of security definer functions, subqueries, WITH queries, and SQL-language functions that access RLS-protected tables, and audit query plan reuse patterns involving SET ROLE commands. Implement strict role management policies to minimize unnecessary role switching and query reuse across roles. Enable detailed logging of role changes and query executions to detect anomalous access patterns. Conduct penetration testing focused on RLS bypass scenarios. Where immediate patching is not feasible, consider disabling RLS or limiting its use until patched, though this may reduce security. Finally, ensure that database backups and monitoring are in place to detect and respond to potential exploitation attempts.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- PostgreSQL
- Date Reserved
- 2024-11-07T19:27:02.623Z
- Cisa Enriched
- true
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 682d9817c4522896dcbd7375
Added to database: 5/21/2025, 9:08:39 AM
Last enriched: 11/3/2025, 11:15:08 PM
Last updated: 12/4/2025, 6:44:43 AM
Views: 44
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-13513: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in codejunkie Clik stats
MediumCVE-2025-11727: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in codisto Omnichannel for WooCommerce: Google, Amazon, eBay & Walmart Integration – Powered by Codisto
HighCVE-2025-11379: CWE-200 Exposure of Sensitive Information to an Unauthorized Actor in roselldk WebP Express
MediumHow I Reverse Engineered a Billion-Dollar Legal AI Tool and Found 100k+ Confidential Files
MediumNation-State Attack or Compromised Government? [Guest Diary], (Thu, Dec 4th)
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.