CVE-2026-16238·PostgreSQL vulnerability
Type confusion in PostgreSQL pg_restore_attribute_stats() allows an object creator to execute arbitrary code as the operating system user running the database, via conflation of range and multirange values. Within major version 18, minor versions before PostgreSQL 18.6 are affected. Versions before PostgreSQL 18 are unaffected.
- Severity
- high
- Software
- PostgreSQL
- Fixed in
- 18.5
- 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.41% — higher than 34% 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-16238 scores 8.8 on CVSS, so a successful attack would be serious — but at 0.41%, 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.5
Fixed in: 18.5
How to fix this CVE
PostgreSQL versions 18.0 through 18.5 contain a type confusion vulnerability in the pg_restore_attribute_stats() function that can allow object creators to execute arbitrary code with database process privileges. Immediately upgrade to PostgreSQL 18.6 or later to patch this high-severity vulnerability. Verify the upgrade by checking the version output after applying patches.
sudo dnf update postgresql postgresql-contribDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check your PostgreSQL version with: psql --version or SELECT version();
- Step 2: Connect to PostgreSQL as a superuser and query: SELECT current_setting('server_version_num'); (values 180000-180005 indicate vulnerable versions)
- Step 3: Search PostgreSQL logs for pg_restore activity: grep -i 'pg_restore\|attribute_stats' /var/log/postgresql/*.log
- Step 4: After upgrading, verify the fix with: psql --version and confirm output shows 18.6 or later
FAQ
What is CVE-2026-16238?
CVE-2026-16238 is a type confusion vulnerability in PostgreSQL's pg_restore_attribute_stats() function that conflates range and multirange value types, allowing database object owners to execute arbitrary code with the privileges of the database process user.
Is CVE-2026-16238 being actively exploited?
No, CVE-2026-16238 is not currently listed as actively exploited in CISA's Known Exploited Vulnerabilities catalog, and no public exploits are available.
What versions of PostgreSQL are affected by CVE-2026-16238?
PostgreSQL versions 18.0 through 18.5 are affected. Versions prior to 18.0 and version 18.6 and later are not vulnerable.
How do I check if my server is vulnerable to CVE-2026-16238?
Run: psql -U postgres -c "SELECT version();" and check if the output shows version 18.0, 18.1, 18.2, 18.3, 18.4, or 18.5. If so, your installation is vulnerable.
Does Defensia detect CVE-2026-16238?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PostgreSQL is installed on a monitored server, CVE-2026-16238 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-16238. Free for 1 server.
Get started free