← Back to BLACKWIRE GHOST BUREAU POSTGRESQL RCE Code snippet showing PostgreSQL parse tree with consttype 23 and constvalue bytes

The parse tree for SELECT 1337 reveals the 8‑byte Datum that underlies PostgreSQL's type system.

22-YEAR-OLD POSTGRESQL TYPE CONFUSION VULNERABILITY YIELDS RCE

*Mehmet Ince uncovered a decades‑old primitive in PostgreSQL core that enables remote code execution (CVE‑2026‑6460). The flaw emerged while probing managed PostgreSQL services and demonstrates how opaque data carriers can mask critical bugs.*

By GHOST Bureau - BLACKWIRE  |  November 13, 2026, 10:00 CET  |  PostgreSQL, type confusion, CVE-2026-6460, managed databases, remote code execution

On November 9 2026 Mehmet Ince published the third installment of his "Systemic Risks in the Managed PostgreSQL Industry" series. He announced the discovery of a 22‑year‑old zero‑day in PostgreSQL core that enables remote code execution, catalogued as CVE‑2026‑6460. The exploit emerged from a routine question in April 2026 about using managed PostgreSQL for a project, a query that sent Ince down a rabbit hole of type‑confusion research. By August 2026 he was dissecting PostgreSQL's internal type handling, after months of exploiting memory‑corruption bugs in extensions such as pg_clickhouse. The breakthrough came when he combined a composite‑type payload with a deliberate type change, forcing the server to misinterpret an 8‑byte Datum and crash reliably. The result is a stark reminder that legacy primitives can hide critical vulnerabilities long after their introduction.

How did a 22‑year‑old primitive become an RCE vector?

Ince fed PostgreSQL a value inside a composite type, then altered the field's declared type and asked the engine to read the value back. The mismatch forced the server to interpret an 8‑byte Datum as a different type, corrupting memory. The resulting crash was described as "one of the most reliable memory‑corruption exploits" he had seen. The primitive has existed for 22 years, hidden behind PostgreSQL's generic Datum carrier and OID‑based type lookup. When the engine applied the wrong OID, it executed attacker‑controlled code, earning the CVE‑2026‑6460 designation.

What triggered the investigation?

The chain began with an out‑of‑bounds write and read in the pg_clickhouse extension. Ince reported the issue to the vendor, and it was patched on June 23. While fixing that exploit, he had to translate ClickHouse arrays into native PostgreSQL Datum values. A conversion mistake exposed a deeper question: how does PostgreSQL decide what a value is? That curiosity led him to probe the core, using an AI assistant named Opus 5 and a self‑named agent pg_expert to dissect the type system.

"I gave PostgreSQL a value inside a composite type, changed the type of one of its fields, and asked it to read the value back. That type confusion led to one of the most reliable memory‑corruption exploits I have seen."

What does the exploit reveal about PostgreSQL internals?

PostgreSQL stores every literal as an 8‑byte Datum, regardless of the actual type. The consttype field (e.g., 23) points to an OID in pg_type, which tells the engine the datum's meaning. In the simple query SELECT 1337, the constvalue appears as [57 5 0 0 0 0 0 0]; on a little‑endian system those bytes resolve to 0x00000539, i.e., 1337. The upper four bytes are unused because the datum does not carry its own type label. This design makes it possible to swap the OID and force the server to treat the same bytes as a different structure, opening the door to type‑confusion attacks.

What are the implications for managed PostgreSQL services?

The discovery underscores systemic risk in the managed PostgreSQL industry. A flaw that has lingered for over two decades can be weaponized without any changes to the surrounding extensions. Providers that rely on default PostgreSQL binaries must audit the core type system, not just third‑party modules. Failure to patch CVE‑2026‑6460 could grant attackers remote code execution on any service that accepts untrusted composite values. The episode also shows how AI‑assisted research can accelerate vulnerability discovery, raising the stakes for defenders.

Frequently asked questions

When was the pg_clickhouse vulnerability disclosed and fixed?

Ince reported the pg_clickhouse out‑of‑bounds write and read chain to the vendor, and it was fixed on June 23.

What is CVE‑2026‑6460?

CVE‑2026‑6460 is the identifier for the 22‑year‑old PostgreSQL type‑confusion primitive that Ince turned into a reliable remote code execution exploit.

How does PostgreSQL store simple integer literals internally?

An integer literal like 1337 is stored as an 8‑byte Datum with consttype 23 (int4) and constvalue bytes [57 5 0 0 0 0 0 0]; the lower four bytes hold the integer value while the upper bytes are unused.

Ince's findings force a reckoning for anyone running PostgreSQL in a managed environment. The core type system, designed for flexibility, can become an attack surface when OID metadata is mismatched. Providers must prioritize patching CVE‑2026‑6460 and audit their data handling pipelines. As AI tools lower the barrier to deep‑dive analysis, the window for undiscovered, decades‑old bugs narrows—unless defenders act swiftly.

Sources: [Hacker News article titled "Turning a 22-year-old Postgres type-confusion primitive into RCE" dated Nov 9 2026, author Mehmet Ince]

More coverageCybersecurity breaches and exploits