PostgreSQL CVE-2026-6460: When a 22-Year-Old Bug Becomes RCE — The Checklist (2026)
CVE-2026-6460: a 22-year-old PostgreSQL type-confusion bug now runs OS code. Who is exposed, the fixed versions, and a patch checklist.
By Bongyeon Kim · Researched from primary sources, verified by hand, and produced with AI assistance on a production stack this site actually operates (Vercel · Neon · Cloudflare R2).
This is not a routine Postgres minor update. On November 12, 2026, the PostgreSQL Global Development Group shipped 18.7, 17.12, 16.16, 15.20, and 14.25 — a release closing 52 security vulnerabilities. The headline item is CVE-2026-6460: a type-confusion bug that security researcher Mehmet Ince turned into reliable remote code execution as the OS user running the database. The primitive, per his writeup, has sat in PostgreSQL for about 22 years, and it needs no superuser, no extension, and no race condition — just a login role, four SQL statements, and one session. CVSS 3.1: 8.8 (High). If you have ever let an application or a tenant run SQL against a Postgres server, this is your patch cycle now — same playbook as "Apache HTTP Server Critical RCE (CVE-2026-119618): The Patch Checklist."
TL;DR
- CVE-2026-6460 is a type confusion (CWE-843) in PostgreSQL core: values captured by a query are read back under a new type definition after
ALTER ... SET DATA TYPE-style DDL, so attacker-controlled bytes get reinterpreted as an internal structure — which led to OS-level code execution. - Preconditions are minimal: an authenticated role that can create objects — and
pg_temptemporary objects are permitted to any user by default. No superuser, no extension, single session, no race. - Affected: every supported branch before the November 12, 2026 release. Fixed in: 18.7, 17.12, 16.16, 15.20, 14.25. PostgreSQL 14 is now end-of-life — that is its final release.
- The fix is invasive, not a one-liner: it adds "composite attribute versioning" and changes the C-extension ABI. Server and compiled extensions must be updated together.
- On managed Postgres (Neon, Supabase, RDS/Aurora) you cannot patch the binary yourself — the provider was in the disclosure loop and controls the rollout. Your job is verification.
- Run
SELECT version();on every instance you control before anything else. Checklist below.
What the vulnerability actually is

Type confusion means the database hands a value to code that interprets it under the wrong type. What follows is a conceptual-level summary of what Mehmet Ince published in "Part 3/6: How I Ended Up Turning a 22-Year-Old PostgreSQL Type-Confusion Primitive into RCE (CVE-2026-6460)" — read it for the full story.
PostgreSQL stores values as raw bytes plus a current type descriptor. The confusion starts with composite types — user-defined row types whose attribute types you can change after the fact. The researcher's proof of concept:
CREATE TYPE pg_temp.poc AS (key uuid);
PREPARE pc_crash AS
SELECT '(01020000-0000-0000-0000-000000000000)'
::pg_temp.poc;
ALTER TYPE pg_temp.poc
ALTER ATTRIBUTE key TYPE bytea CASCADE;
EXECUTE pc_crash;
Here is the gap. At PREPARE time, the query captures a value whose bytes were laid out as a UUID — 16 bytes the caller fully controls. ALTER TYPE changes the attribute's type from uuid to bytea, but nothing rewrites the already-captured bytes. At EXECUTE time, PostgreSQL reads the current descriptor, sees bytea, and hands those same 16 bytes to the bytea output routine as if they were a pointer-bearing varlena structure — inline data suddenly treated as a pointer. In the PoC, the crafted bytes made PostgreSQL follow a NULL "expanded object" pointer and segfault the backend.
That is the crash demo. The weaponized version, as published, goes further — and ends with an ordinary SQL login escalating to native code execution as the OS user running the database:
- Fake object, hijacked call. Choosing the 16 bytes instead of leaving zeros, the attacker forges an internal object header pointing to a fake "methods" table, so an indirect call inside PostgreSQL executes an attacker-chosen command — conveniently placed inside the forged object itself.
- ASLR defeat with the same primitive. Three UUID fields give 48 fully controlled bytes — enough to forge a fake array. After altering the attribute type,
unnest()returns a pointer-valued element that the surrounding SQL reads as a plainbigint, printing a heap address as an integer.
The official advisory describes the root cause soberly: "The system had inadequate tracking of typed values, and values were not self-identifying. Stale values could appear in data dictionary entries, PL/pgSQL variables, and many other parts of the system." The primary DDL route is ALTER ... SET DATA TYPE; other routes exist, including an ALTER TABLE ... ADD COLUMN; ROLLBACK; ALTER TABLE ... ADD COLUMN sequence.
Ince found this while exploiting an extension (pg_clickhouse), got curious about how PostgreSQL knows what a value is, and found the core bug underneath — reporting 21 related cases, six of which became CVEs in this release. The release notes also credit the OpenAI Security Research Team, the Anthropic OSS program, Claude, and Ada Logics. About twenty people found overlapping issues in the same quarter: the bug class was findable by anyone paying attention. Patch this week, not this quarter.
Preconditions: who can trigger it
The CVSS vector is AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H — network-reachable, low complexity, Privileges Required: Low, no user interaction. Concretely, the attacker needs:
- A valid database login (or any way to get SQL executed — SQL injection in your app counts), and
- Permission to create objects.
The second part is the uncomfortable one. As pganalyze's analysis points out, creating temporary objects in pg_temp is permitted for any user by default — and the entire published exploit runs inside pg_temp. A role with zero grants beyond "can connect" is enough: no superuser, no extensions, no file access, no race, single session.
If your threat model includes any untrusted SQL — multi-tenant SaaS, admin dashboards that expose queries, a public-facing app with an injection bug anywhere in it — your exposure is not theoretical. Red Hat rates this Important for exactly that reason: authenticated with object-creation privileges, leading to full compromise of the host as the postgres OS user. Where every database user is a trusted engineer, the risk is much lower — but "trusted engineers only" is a claim that ages badly.
"Am I even exposed?" — the triage table
This blog runs its own database on Neon, so the managed-provider case is not an abstraction here — and most readers are in the same boat: you do not compile Postgres, you rent it. Triage first.
| Your setup | Exposed? | Action |
|---|---|---|
| Managed Postgres (Neon, Supabase, RDS, Aurora, AlloyDB) | Probably yes until the provider confirms patched engine versions | Check your engine version in the dashboard; verify provider has rolled out the Nov 12, 2026 release; ask support if unclear. |
| Multi-tenant Postgres (tenants can run arbitrary SQL) | Yes, worst case | This is the exact scenario the researcher weaponized. Patch immediately and confirm every shared cluster restarted on the new version. |
| Self-hosted Postgres (VM, container, bare metal) | Yes if below fixed versions | Upgrade per checklist below. Update compiled extensions in the same operation. |
| Single-user DB, only trusted humans have logins | Lower risk, still affected | Patch in your normal window. Privileges are low, not zero. |
| Unpatched PostgreSQL 14 | Yes — and stranded | 14.25 is the final release; plan a major-version upgrade, do not stop at 14.25 forever. |
| Not using Postgres at all | No | Close the ticket. |
Note for the managed row: the researcher privately shared reproducible PoCs with the major managed providers before publication, and reports that he has not seen a vendor unaffected. Your provider has therefore known about this, with working exploit code, for weeks.
The fix
Upgrade to the November 12, 2026 release of your major version: 18.7, 17.12, 16.16, 15.20, or 14.25. There is no configuration workaround that makes a vulnerable version safe.
Understand what you are installing, because this is not a normal minor release. The fix introduces composite attribute versioning — every composite datum is stamped with the version of the type descriptor it was created under, and PostgreSQL refuses to read it when the world has changed underneath. On a patched 17.12, the four-statement PoC no longer crashes; it answers:
ERROR: row type of datum tuple was altered after the datum's creation
HINT: See server log for additional details.
Two follow-on facts matter for your runbook:
- The extension ABI changed.
DatumGetHeapTupleHeader()went from macro to function, and compiled extensions embed the new headers. Per the PGDG packagers: an old extension on a new server still loads but is not protected; a new extension on an old server fails to load. Server and extensions must move together. - Some extensions need more than a rebuild — pganalyze notes that pgrx released an API update and PostGIS needs special handling around
pg_upgrade. A newcomposite_type_mismatchparameter can also disable the checks entirely, but the release notes say doing so carries security risks — an emergency valve, not a plan.
The patch checklist
1. Inventory: find every instance and its version
SELECT version();
-- or, for a cleaner string:
SHOW server_version;
Run it on every instance — including replicas, CI databases, docker-compose leftovers, and the staging box nobody remembers. Compare against the fixed list: 18.7, 17.12, 16.16, 15.20, 14.25.
2. Back up before you touch anything
Minor upgrades do not change the on-disk format, but a patch this invasive is when you want a verified escape route:
pg_dump -Fc -d mydb -f mydb_pre_upgrade.dump
Verify the dump exists before proceeding; on managed Postgres, trigger a fresh snapshot now.
3. Upgrade server and compiled extensions together
Via PGDG packages, this is the packagers' explicit instruction — one transaction, no splitting:
# RHEL-family, example for PG18 — server + all extensions in the same dnf run
sudo dnf update postgresql18-server postgresql18-libs 'postgresql18-*'
sudo systemctl restart postgresql-18
On Debian/Ubuntu, update the server and extension packages in the same apt run and restart. Distro packages backport fixes on their own schedules — check your distro's security tracker for the fixed package version. Upgrade the client-side tooling too (pg_dump, pg_restore, reindexdb, vacuumdb), including copies baked into CI images and backup containers.
4. Managed Postgres: verify, don't assume
You cannot patch the binary on Neon, Supabase, or RDS — that is the provider's side of the responsibility split. Your side:
- Confirm the engine version your project is actually running (dashboard or
SELECT version();). - Watch the provider's status page or changelog for the November 2026 rollout.
- For Neon specifically: minor-version upgrades are handled platform-side, but the deciding fact is the version string your connection reports after the rollout — verify it yourself, and open a support ticket if it still shows a pre-fix version. [unverified — Neon's specific rollout timing was not published at writing time]
- Where the provider offers a maintenance window or version pin, use it deliberately rather than assuming "managed means patched."
5. Reduce the attack surface while you wait
If you must run a vulnerable version for a while, narrow who can trigger it. Red Hat's suggested mitigation:
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
Know its limits: the published exploit lives in pg_temp, and temporary-object creation is permitted to users by default (subject to database-level TEMP privileges). Revoking schema CREATE shrinks the surface; it does not eliminate it. Restricting network reachability — private networking, no public endpoint — is the stronger interim control, and anything that lets end-user input become DDL should be shut off.
6. After the upgrade, verify the fix behaves
Re-run the four-statement PoC pattern from a low-privilege test role on a staging instance. On a fixed build you should get the "row type of datum tuple was altered" error instead of a dropped connection, with zero segfaults in the server log. If a compiled extension misbehaves, look for a rebuilt release before reaching for composite_type_mismatch.
Wrap-up
- A 22-year-old core bug is now a working RCE chain from an ordinary login. Every supported Postgres branch was affected; the fix shipped November 12, 2026 in 18.7 / 17.12 / 16.16 / 15.20 / 14.25.
- Preconditions were minimal: any role that can create objects — including the default-allowed
pg_temp— could reach OS code execution in one session. If any part of your stack lets untrusted input become SQL, patching is not optional. - The fix changed the extension ABI, so "upgrade the server" is only half the job. Server and compiled extensions move together, client tools move too, and managed-Postgres users should treat provider verification (
SELECT version();, status page, support ticket) as their patch step.
Sources
- Mehmet Ince — "Part 3/6 | How I Ended Up Turning a 22-Year-Old PostgreSQL Type-Confusion Primitive into RCE (CVE-2026-6460)" (the original research writeup)
- PostgreSQL — CVE-2026-6460: PostgreSQL type confusion after ALTER ... SET DATA TYPE executes arbitrary code (official security page; affected/fixed versions and CVSS)
- NVD — CVE-2026-6460 (national vulnerability database entry)
- PostgreSQL — PostgreSQL 18.7, 17.12, 16.16, 15.20, 14.25, and 19 RC 2 Released (release announcement, 52 CVEs)
- pganalyze — Postgres 18.7 Security Release: The Impact of CVE-2026-6460 (extension ABI impact analysis)