Skip to content
RCE Write-up Advanced

CVE-2026-6460 – Arbitrary Code Execution in Postgres

A type confusion flaw in PostgreSQL lets an object creator run arbitrary code as the database's operating system user, mainly through ALTER ... SET DATA TYPE. The system failed to track typed values properly, so stale values could appear in data dictionary entries and PL/pgSQL variables.

postgresql.org

Published on postgresql.org

Type confusion in PostgreSQL allows an object creator to execute arbitrary code as the operating system user running the database, via ALTER ... SET DATA TYPE primarily.

The author, on postgresql.org

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The system had inadequate tracking of typed values, and values were not self-identifying, so stale values could appear in data dictionary entries, PL/pgSQL variables, and many other parts of the system.

Impact

An object creator could execute arbitrary code as the operating system user running the database.

What the attacker needed

Ability to create database objects

The fix

It was fixed in PostgreSQL 18.7, 17.12, 16.16, 15.20, and 14.25.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

PostgreSQL is a database program. A 'type confusion' bug means the software loses track of what kind of data a value is, so it can treat one thing as another. Here that mistake lets someone who can create database objects run their own commands on the server, not just read or change data.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.