CVE-2026-6477·PostgreSQL vulnerability
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.
- Severity
- high
- Software
- PostgreSQL
- Fixed in
- 18.4
- Published
How likely is exploitation
FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at 0.45% — higher than 37% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.
Read the two together. CVE-2026-6477 scores 8.8 on CVSS, so a successful attack would be serious — but at 0.45%, almost nobody is currently attempting it. That is a different situation from a flaw under mass exploitation, and it is usually the difference between patching on your next maintenance window and patching tonight.
Affected versions
From: 18.0
Until: 18.4
Fixed in: 18.4
How to fix this CVE
Upgrade PostgreSQL to version 18.4 or later to patch a critical buffer overflow vulnerability in the libpq client library. The vulnerable functions (lo_export, lo_read, lo_lseek64, lo_tell64) can be exploited by a malicious server to overwrite client-side stack memory. Immediate patching is strongly recommended, particularly for systems running pg_dump or psql against untrusted PostgreSQL instances.
sudo dnf update postgresql-server postgresql-libs postgresqlDefensia detects this vulnerability
How to check if you are affected
- Check installed PostgreSQL version: psql --version or SELECT version();
- Verify if libpq is linked to client tools: ldd $(which psql) | grep libpq to confirm the vulnerable library is in use
- Review PostgreSQL logs for unusual large data transfers in lo_read or lo_export operations: grep -i 'lo_read\|lo_export' /var/log/postgresql/*.log
- Confirm remediation: After upgrade, run psql --version and verify the version is 18.4 or higher
FAQ
What is CVE-2026-6477?
This vulnerability is a stack buffer overflow in PostgreSQL's libpq library affecting large object (LO) functions. A compromised or malicious PostgreSQL server can send oversized responses that overflow client-side buffers in lo_read(), lo_export(), lo_lseek64(), and lo_tell64(), enabling memory corruption and potential code execution on the client system.
Is CVE-2026-6477 being actively exploited?
No — this vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploits are currently available. However, the high CVSS score (8.8) and the mechanism's severity warrant prompt patching.
What versions of PostgreSQL are affected by CVE-2026-6477?
PostgreSQL 18.0 through 18.3 are affected. Additionally, unpatched versions of 17.x (before 17.10), 16.x (before 16.14), 15.x (before 15.18), and 14.x (before 14.23) are vulnerable.
How do I check if my server is vulnerable to CVE-2026-6477?
Run psql --version or SELECT version() to determine your PostgreSQL release. If it is version 18.3 or earlier (or the corresponding unpatched versions in 14–17 branches), your installation is vulnerable.
Does Defensia detect CVE-2026-6477?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PostgreSQL is installed on a monitored server, CVE-2026-6477 will appear in your dashboard with remediation steps.
Related PostgreSQL CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-6477. Free for 1 server.
Get started free