· via dev.to (home feed)
PostgreSQL closes 22-year-old type confusion flaw that let low-privilege users run server code
A type confusion bug present in PostgreSQL since 2004 was fixed in the November 9 security release; a low-privilege login role could crash the server, and the flaw opens a path to code execution.

PostgreSQL's November 9 security release fixed 52 vulnerabilities, and the most serious of them turns out to be one of the oldest bugs the project has ever shipped. CVE-2026-6460, a type confusion flaw rated 8.8 on the CVSS scale, has been present in every PostgreSQL release since May 5, 2004. According to security researcher Mehmet Ince, who discovered and documented it, the crash is reachable by a login role with essentially no privileges, and the flaw opens a path to executing code on the server with the operating system rights of the PostgreSQL process for users able to create objects.
How four statements break the server
The flaw lives in composite types, the user-defined record types built from named fields with individual data types. As described in a dev.to analysis of Ince's writeup, the problem appears when a field's type changes while an older value of that type is still held inside a prepared statement.
The reproducer takes four statements: define a composite type with a single UUID field, prepare a statement embedding a crafted UUID literal cast to that type, alter the field's type to bytea, and execute. At prepare time the server stores the literal as 16 binary UUID bytes. After the type change, the output routine looks up the field's output function using the new descriptor, so those UUID bytes are handed to bytea's output routine as though they were a varlena pointer, a variable-length datum that begins with a header rather than raw bytes. Bytes chosen to resemble an expanded-object header lead the server to dereference an effectively null pointer, and the backend crashes with a segmentation fault.
One detail separates this from a mere curiosity: the crafted literal must live inside the prepared statement itself. Passed as a bound parameter instead, it is parsed at execute time, after the type change, and converts cleanly. The bug is exactly the gap between what the prepared plan captured and what the type system reports when the statement runs.
Ince published the crashing SQL and a second stage that leaks memory addresses, but stopped short of publishing the final step that achieves command execution. He did demonstrate a working exploit against PostgreSQL 18.6, and notes that the code execution technique depends on a second change that landed on May 14, 2015.
The rest of the November release
The type confusion bug is the headline, but it is not the only fix worth attention. Of the 52 flaws, 32 carry the release's highest score, 8.8. One server-side vulnerability, CVE-2026-116322, requires neither a login nor any user action: an unauthenticated client can trigger a restart of PostgreSQL 18 servers. The client tools received fixes as well. A crafted archive can make pg_restore execute code as the user running it, and a compromised source server can push code through the restore script embedded in pg_dump's tar output, which matters for anyone restoring backups from sources they do not fully trust.
Coordinated disclosure
Ince adapted the exploit for managed PostgreSQL services and privately shared proofs of concept with their security teams in August. The providers contacted include AWS (Aurora and RDS), Microsoft (Azure PostgreSQL), Google (AlloyDB), Supabase, Databricks, and Ubicloud. The writeup does not report each service's current patch status, so anyone on a managed offering should check their provider's console or status page rather than assume the patch landed on their instance.
What to do
Fixed versions are 18.7, 17.12, 16.16, 15.20, and 14.25; everything earlier is affected. The patch adds version checks that let the server detect a value that no longer matches its type, so the same four statements now return a clean error, "row type of datum tuple was altered after the datum's creation," instead of a crash. PostgreSQL also recommends rebuilding or updating C-language extensions together with the server, which the dev.to analysis flags as the step most likely to be skipped in a hurry.
PostgreSQL 14 users should note that 14.25 is that major version's final release, and older major versions received no update in this cycle.
There are no reports of attacks using the flaw, and the CVE record carries CISA's assessment of exploitation as none. The crash reproducer is public, however, and the writeup is detailed.
Why it matters
The bug survived 22 years of review in one of the most carefully audited open source codebases because the dangerous combination, a prepared statement holding a composite value across a type change, is not something anyone thought to test. Per the dev.to analysis, the same month produced an 11-year-old HTTP/2 bug in nginx, a 12-year-old flaw in the Linux NFS server, and a long-lived bug in Java's Base64 decoder. The pattern is that significant vulnerabilities cluster in old, trusted code that nobody re-reads.
It is also a reminder that prepared statements are snapshots. They capture a plan, a type and a value at a moment in time; if the underlying schema changes between prepare and execute, the snapshot can lie. PostgreSQL now checks for that lie, and most systems do not check for theirs. For anyone operating multi-tenant PostgreSQL, where untrusted users hold login roles on a shared server, this flaw was a direct route from a minimal account toward host-level code execution, and patching, plus verifying that a managed provider actually patched, is the only real mitigation.
- #postgresql
- #security
- #vulnerability
- #database
- #open-source