A security researcher has disclosed a vulnerability in PostgreSQL’s core that allows remote code execution through type-confusion attacks. According to a detailed blog post documenting the discovery, the vulnerability stems from how PostgreSQL handles composite types when field types are changed after values are stored.

The researcher’s investigation began while exploiting vulnerabilities in pg_clickhouse, a PostgreSQL extension that translates ClickHouse values into native PostgreSQL values. While studying how the extension converted data types, the researcher developed questions about PostgreSQL’s fundamental understanding of its own data representation.
The core issue involves PostgreSQL’s Datum system—an 8-byte generic data carrier that does not inherently know what type of value it represents. Instead, PostgreSQL relies on an Object Identifier (OID) pointing to metadata in the pg_type system catalog to understand how to interpret and process a Datum’s contents. The vulnerability occurs when a value is stored inside a composite type, the field’s type is changed, and PostgreSQL is subsequently asked to read the value back using the new type definition.
According to the researcher’s account, this type-confusion leads to memory corruption that can be reliably exploited for code execution. The researcher describes it as “one of the most reliable memory-corruption exploits” they have encountered. The vulnerability has existed in PostgreSQL for approximately 22 years, classified as CVE-2026-6460.
The discovery process involved learning PostgreSQL internals through systematic study of how the database processes queries, type conversions, and data representations. The researcher used an AI assistant to help navigate PostgreSQL’s internal mechanics, learning about concepts like Datums, OIDs, type input/output functions, and how PostgreSQL differentiates between values stored by value versus by reference.
The vulnerability discovery appears particularly significant for organizations using managed PostgreSQL services, as the research was initially prompted by a project decision to use such a service. The researcher has indicated this finding is part of a broader analysis of systemic risks in the managed PostgreSQL industry.
Key facts
- A 22-year-old zero-day in PostgreSQL core enables remote code execution through type-confusion attacks
- The vulnerability allows an attacker to change a composite type field’s type and trigger memory corruption when PostgreSQL reads back the value
- The researcher discovered the flaw while exploiting pg_clickhouse extension vulnerabilities and studying PostgreSQL’s Datum type system
- According to the researcher, this is one of the most reliable memory-corruption exploits they have observed
- The vulnerability is classified as CVE-2026-6460
