PostgreSQL libpq Functions Stack Buffer Overflow Vulnerability for Superusers

Vulnerability

A stack buffer overflow vulnerability has been identified in PostgreSQL's libpq library, specifically within the lo_export, lo_read, lo_lseek64, and lo_tell64 functions. This vulnerability allows a server superuser to overwrite a client's stack memory by sending an arbitrarily large response. The issue arises because the PQfn function, when called with result_is_int set to 0, transfers variable-length data determined by the server into a buffer of undefined size. Both the lo_export command in psql and pg_dump utilize lo_read(), creating a vector for superusers to manipulate the stack memory of these tools. Affected versions include those prior to PostgreSQL 18.4, 17.10, 16.14, 15.18, and 14.23.

Impact

Exploitation of this vulnerability allows for a stack buffer overflow, where a server superuser can overwrite the stack memory of a client application, such as psql or pg_dump.

Remediation

Users can upgrade to PostgreSQL versions 18.4, 17.10, 16.14, 15.18, or 14.23 to address this vulnerability.

Added: May 14, 2026, 2:33 PM
Updated: May 14, 2026, 2:33 PM

Vulnerability Rating

Custom Algorithm
spread
8.1
impact
7.5
exploitability
5.2
remediation
7.7
relevance
8.3
threat
0.0
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.