PostgreSQL libpq lo_* functions let server superuser overwrite client stack memory (CVE-2026-6477)
Use of inherently dangerous function PQfn(..., result_is_int=0, ...) in PostgreSQL libpq lo_export(), lo_read(), lo_lseek64(), and lo_tell64() functions allows the server superuser to overwrite a client stack buffer with an arbitrarily-large response. Like gets(), PQfn(..., result_is_int=0, ...) stores arbitrary-length, server-determined data into a buffer of unspecified size. Because both the \lo_export command in psql and pg_dump call lo_read(), the server superuser can overwrite pg_dump or psql stack memory. Versions before PostgreSQL 18.4, 17.10, 16.14, 15.18, and 14.23 are affected.
AI Analysis
Technical Summary
The vulnerability arises from the use of the inherently unsafe PQfn function in PostgreSQL's libpq client library, specifically when result_is_int=0 is used. This function stores server-determined data of arbitrary length into a client buffer without size checks, similar to the unsafe gets() function. The affected client functions (lo_export(), lo_read(), lo_lseek64(), lo_tell64()) can be exploited by a server superuser to send oversized responses that overwrite the client's stack memory. This impacts client tools such as psql and pg_dump, potentially allowing arbitrary code execution on the client system. The vulnerability affects PostgreSQL versions before 18.4, 17.10, 16.14, 15.18, and 14.23. Red Hat's advisory confirms the issue and provides updated libpq packages to remediate the flaw. Exploitation requires user interaction (connecting to a malicious server), and the scope is changed as the attack affects the client rather than the server.
Potential Impact
The vulnerability allows a PostgreSQL server superuser to cause a buffer overflow on the client side, overwriting stack memory in client applications such as psql and pg_dump. This can lead to arbitrary code execution on the client system, compromising confidentiality, integrity, and availability. The attack requires the client to connect to a malicious or compromised server, meaning the threat is primarily to clients connecting to untrusted servers. The CVSS v3.1 score is 8.8 (high), reflecting network attack vector, low complexity, high privileges required on the server side, user interaction required, and high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
A fix is available and has been released by Red Hat in updated libpq packages for affected Red Hat Enterprise Linux versions (notably RHEL 8.6). Users should apply these updates promptly. Additionally, clients should avoid connecting to untrusted or potentially compromised PostgreSQL servers to mitigate risk. The vendor advisory explicitly recommends only connecting to trusted servers and updating to patched versions. No other mitigations are specified.
PostgreSQL libpq lo_* functions let server superuser overwrite client stack memory (CVE-2026-6477)
Description
Use of inherently dangerous function PQfn(..., result_is_int=0, ...) in PostgreSQL libpq lo_export(), lo_read(), lo_lseek64(), and lo_tell64() functions allows the server superuser to overwrite a client stack buffer with an arbitrarily-large response. Like gets(), PQfn(..., result_is_int=0, ...) stores arbitrary-length, server-determined data into a buffer of unspecified size. Because both the \lo_export command in psql and pg_dump call lo_read(), the server superuser can overwrite pg_dump or psql stack memory. Versions before PostgreSQL 18.4, 17.10, 16.14, 15.18, and 14.23 are affected.
Affected software
pkg:bitnami/postgresqlRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises from the use of the inherently unsafe PQfn function in PostgreSQL's libpq client library, specifically when result_is_int=0 is used. This function stores server-determined data of arbitrary length into a client buffer without size checks, similar to the unsafe gets() function. The affected client functions (lo_export(), lo_read(), lo_lseek64(), lo_tell64()) can be exploited by a server superuser to send oversized responses that overwrite the client's stack memory. This impacts client tools such as psql and pg_dump, potentially allowing arbitrary code execution on the client system. The vulnerability affects PostgreSQL versions before 18.4, 17.10, 16.14, 15.18, and 14.23. Red Hat's advisory confirms the issue and provides updated libpq packages to remediate the flaw. Exploitation requires user interaction (connecting to a malicious server), and the scope is changed as the attack affects the client rather than the server.
Potential Impact
The vulnerability allows a PostgreSQL server superuser to cause a buffer overflow on the client side, overwriting stack memory in client applications such as psql and pg_dump. This can lead to arbitrary code execution on the client system, compromising confidentiality, integrity, and availability. The attack requires the client to connect to a malicious or compromised server, meaning the threat is primarily to clients connecting to untrusted servers. The CVSS v3.1 score is 8.8 (high), reflecting network attack vector, low complexity, high privileges required on the server side, user interaction required, and high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
A fix is available and has been released by Red Hat in updated libpq packages for affected Red Hat Enterprise Linux versions (notably RHEL 8.6). Users should apply these updates promptly. Additionally, clients should avoid connecting to untrusted or potentially compromised PostgreSQL servers to mitigate risk. The vendor advisory explicitly recommends only connecting to trusted servers and updating to patched versions. No other mitigations are specified.
Technical Details
- Gcve Source
- db.gcve.eu
- Csaf Category
- csaf_security_advisory
- Csaf Version
- 2.0
- Publisher
- Red Hat Product Security
- Advisory Id
- RHSA-2026:47090
- Cve Count
- 1
- State
- PUBLISHED
Threat ID: 6a710678bf32cb7a3439688c
Added to database: 08/03/2026, 21:22:00 UTC
Last enriched: 08/14/2026, 21:21:33 UTC
Last updated: 09/17/2026, 10:01:33 UTC
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.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.