22-Year-Old PostgreSQL Bug Turned into Remote Code Execution mehmetince.net · 43...

@best

22-Year-Old PostgreSQL Bug Turned into Remote Code Execution mehmetince.net · 43 points · 2 comments · HN thread

TL;DR Mehmet Ince describes how, while exploiting a pg_clickhouse extension bug, he found a type-confusion primitive in PostgreSQL core that dates back to 2004 and builds on a 2015 feature. By changing a composite type's attribute type after a prepared statement is created, he could make PostgreSQL misread stored bytes, leading to a crash and then a path to arbitrary command execution. It was assigned CVE-2026-6460 and fixed in a November 2026 release with 52 CVEs.

  • A prepared statement holding a composite-type value kept old UUID bytes after ALTER TYPE changed the attribute from uuid to bytea, so output functions read them as a bytea varlena.
  • The bytes could be crafted to point to a fake ExpandedObject whose method table held function addresses, letting PostgreSQL call system() with an attacker-chosen command.
  • A similar confusion with arrays (text element read as bigint) was used to leak a heap pointer and defeat ASLR.
  • Reported by the author to managed PostgreSQL vendors (Databricks, Google AlloyDB, Supabase, AWS, Azure, Ubicloud/ClickHouse), with some vendors shipping their own mitigations before upstream.
  • The upstream fix was CVE-2026-6460, an umbrella fix adding composite attribute versioning, plus related CVEs; the author reported 21 variants in total.
  • The author says a low-privileged login role can trigger the crash, which he frames as the main reason the primitive is serious.

Discussion Only two comments, both brief. One commenter thanks the author for sharing the path to the zero-day and says the context and story help. There is no technical debate, so the mood is appreciative and the thread offers little beyond that reaction.

  • Appreciates the detailed account of the research path (most): The single commenter values the narrative and context the author gave for how the zero-day was reached, rather than just the bug itself.

#PostgreSQL #security #vulnerabilities #RCE #typeConfusion