CVE-2023-5869 Overview
CVE-2023-5869 is an integer overflow vulnerability [CWE-190] in PostgreSQL that allows authenticated database users to execute arbitrary code. The flaw stems from missing overflow checks during SQL array value modification. An authenticated user can supply specially crafted array data to trigger the overflow, write arbitrary bytes to memory, and read extensive portions of server memory. The vulnerability affects PostgreSQL across multiple supported branches and downstream distributions including Red Hat Enterprise Linux, Debian, and NetApp products.
Critical Impact
Authenticated attackers can achieve arbitrary code execution within the PostgreSQL server process, compromising confidentiality, integrity, and availability of the database and underlying host.
Affected Products
- PostgreSQL versions prior to 16.1, 15.5, 14.10, 13.13, 12.17, and 11.22
- Red Hat Enterprise Linux 7, 8, and 9 (including EUS, AUS, and TUS variants)
- Red Hat Software Collections 1.0 and CodeReady Linux Builder editions
Discovery Timeline
- 2023-12-10 - CVE-2023-5869 published to the National Vulnerability Database
- 2023-11 - PostgreSQL releases 16.1, 15.5, 14.10, 13.13, 12.17, and 11.22 with the fix
- 2024-01-19 - NetApp publishes security advisory NTAP-20240119-0003
- 2025-11-04 - Last updated in the NVD database
Technical Details for CVE-2023-5869
Vulnerability Analysis
The vulnerability resides in PostgreSQL's array modification logic. When the server processes SQL statements that modify array values, internal size calculations fail to verify that intermediate results remain within representable integer bounds. An authenticated user submits crafted array dimensions or subscripts that cause an arithmetic operation to wrap around. The wrapped value is then used as a length or offset for subsequent memory operations.
Because PostgreSQL stores array data inside its shared backend process memory, the resulting out-of-bounds write occurs in a privileged context. An attacker can manipulate the overflow to corrupt adjacent structures, redirect execution flow, or harvest server memory contents such as cached query results, credentials, and other tenants' data. Exploitation requires only standard database login privileges with the ability to issue SQL commands against an array column.
Root Cause
The root cause is an integer overflow [CWE-190] in the array length and offset computations used during SQL array value modification. The affected code path performs multiplication and addition on user-controlled dimension and subscript values without bounds validation. When the computed result exceeds the maximum value of the underlying signed integer type, it wraps to a small or negative value. The runtime then allocates an undersized buffer or performs a write using the attacker-influenced offset, producing the memory corruption primitive.
Attack Vector
Exploitation is network-reachable but requires authenticated access to the PostgreSQL instance with privileges sufficient to execute SQL statements modifying array values. The attacker connects to the database, issues SQL commands that operate on an array with crafted dimensions, and triggers the overflow. No user interaction is needed. Multi-tenant database services and applications that grant low-privilege SQL access to untrusted users carry the highest exposure.
No public proof-of-concept exploit has been released. Detailed technical mechanics are described in the PostgreSQL CVE-2023-5869 Security Note and the Red Hat Bugzilla Report #2247169.
Detection Methods for CVE-2023-5869
Indicators of Compromise
- Unexpected PostgreSQL backend crashes with SIGSEGV or SIGBUS signals recorded in the server log, particularly correlated with array-manipulation queries.
- SQL statements from low-privilege accounts that construct very large array dimensions or subscripts, for example calls to array_set_slice, UPDATE ... SET arr[...] = ..., or large multi-dimensional ARRAY[] literals.
- Anomalous PostgreSQL process behavior such as spawning shells, outbound network connections, or file writes to non-data directories.
- PostgreSQL versions reported by SELECT version(); that are older than 16.1, 15.5, 14.10, 13.13, 12.17, or 11.22 on internet-exposed or multi-tenant instances.
Detection Strategies
- Enable PostgreSQL log_statement = 'mod' or 'all' and audit logs of array operations issued by non-administrative roles.
- Hunt for backend termination messages such as server process was terminated by signal 11 in postgresql.log and correlate with the originating session and SQL statement.
- Inventory PostgreSQL build versions across the estate and flag instances running pre-patch releases for prioritized remediation.
Monitoring Recommendations
- Forward PostgreSQL logs to a centralized analytics platform and alert on repeated backend crashes from the same role or client address.
- Monitor the host running PostgreSQL for unexpected child processes of postgres, new outbound connections, and writes outside PGDATA.
- Track authentication and role-grant changes that expand SQL execution privileges to new accounts.
How to Mitigate CVE-2023-5869
Immediate Actions Required
- Upgrade PostgreSQL to a fixed release: 16.1, 15.5, 14.10, 13.13, 12.17, or 11.22 or later within the same major branch.
- Apply vendor packages for downstream distributions, including the Red Hat advisories listed in the references and the Debian LTS Announce Email.
- Audit database roles and revoke SQL execution privileges from accounts that do not require them, particularly on multi-tenant or internet-facing instances.
- Review PostgreSQL logs for prior backend crashes that may indicate exploitation attempts before patching.
Patch Information
The PostgreSQL project addressed CVE-2023-5869 in the November 2023 minor releases. See the PostgreSQL Release Announcement 16.1 and the PostgreSQL CVE-2023-5869 Security Note. Red Hat published more than two dozen errata covering RHEL 7, 8, and 9 streams, beginning with Red Hat Security Advisory RHSA-2023:7545 and continuing through Red Hat Security Advisory RHSA-2024:0337. NetApp customers should consult NetApp Security Advisory NTAP-20240119-0003.
Workarounds
- Restrict PostgreSQL network exposure to trusted application servers using pg_hba.conf and firewall rules until patching completes.
- Limit SQL privileges of application roles to the minimum required, denying array-modification operations on sensitive tables where feasible.
- Isolate PostgreSQL instances per tenant when serving multiple untrusted parties to constrain the blast radius of any successful exploitation.
# Verify PostgreSQL version and upgrade on a Red Hat-based host
psql -U postgres -c "SELECT version();"
# Apply the vendor update
sudo dnf update postgresql postgresql-server postgresql-contrib
# Restart the service after patching
sudo systemctl restart postgresql
# Confirm the patched version is in use
psql -U postgres -c "SHOW server_version;"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


