Menu

1 / 3

[CVE-2026-116331] Deep Dive - How One SORTOP Handed Over PostgreSQL

DEV Community: database·GUIDANCE WHITE·3 days ago
#wkHQa8an
#devtodatabase#devto#dev#type#aggregate
Long article (2672 words) — no AI summary yet.
Reading 0:00
15s threshold

On November 12, 2026, the PostgreSQL project released 18.7, 17.12, 16.16, 15.20, and 14.25 together, disclosing CVE-2026-116331 . It's a privilege escalation that lets any role that can simply log in — even a near-permissionless application account — climb all the way to the OS user running the database server, using nothing but the default TEMPORARY privilege. Security research team Depthfirst published the triggering SQL and the exploitation rationale on November 18. CVSS 3.1 score: 8.8 (High).

This post walks through why one SORTOP option tricks the planner into treating an integer as a pointer.

TL;DR

Root cause : when PostgreSQL's planner speeds up a user-defined aggregate that behaves like MIN / MAX with an index scan , it never checks whether the aggregate's input type matches its result type . If they differ, the planner skips the FINALFUNC (the final conversion function) entirely and returns the raw value read from the index — which the caller then interprets as the declared result type.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.