PostgreSQL: Type confusion remote code execution (CVE-2026-116331)
A public proof-of-concept exploit exists for a type confusion vulnerability in PostgreSQL that allows authenticated users with superuser privileges to execute arbitrary code as the database service account.
CVE search metadata
CVE search record: CVE-2026-116331. Severity: high. CVSS: 8.8. KEV: no. Product: PostgreSQL (18 < 18.7, 17 < 17.12, 16 < 16.16, 15 < 15.20, 14 < 14.25). Brief: PostgreSQL: Type confusion remote code execution (CVE-2026-116331). Brief link: https://feed.craftedsignal.io/briefs/2026-11-postgresql-type-confusion-cve-2026-116331/
Triage facts
Revision 2- Applicability
- PostgreSQL (18 < 18.7, 17 < 17.12, 16 < 16.16, 15 < 15.20, 14 < 14.25)
- Evidence
- Unknown
- Severity
- High
- Action
- Immediate escalation
- Sources
- 4 public sources
- Freshness
- Revision 2Nov 16, 14:40 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A2Roughly even chance
Revision history 1 entry · Revision 2
- Revision 2
added coverage for PostgreSQL (18 < 18.7, 17 < 17.12, 16 < 16.16, 15 < 15.20, 14 < 14.25)
Changed: action_plan, affected_products, affected_vendors, content, cpes, has_poc, lastmod, poc_references, priority, priority_score, priority_signals, qa_status, references, summary, tags, title, ttps, updates
Sources: 1
Overview
CVE-2026-116331 is a critical type confusion vulnerability in PostgreSQL min/max aggregate optimization. An attacker with superuser-level access can manipulate the SORTOP option of a user-defined aggregate, causing the PostgreSQL planner to misinterpret input and result types. This flaw allows for arbitrary code execution under the context of the operating system user running the database service.
Attack Chain
- Attacker establishes a connection to a target PostgreSQL instance using superuser credentials.
- Attacker deploys custom calibration scripts to resolve the specific PostgreSQL binary's memory offsets and PIE base address.
- Attacker triggers the type confusion vulnerability by crafting a malicious user-defined aggregate using the vulnerable min/max optimization path.
- Attacker utilizes the type confusion to overwrite function pointers within the PostgreSQL memory space.
- Attacker executes arbitrary system commands with the privileges of the database service account.
- The exploit typically disconnects the database backend following successful command execution.
Impact
Successful exploitation grants an attacker full command execution on the host operating system with the privileges of the PostgreSQL service user. This bypasses database-level security controls and facilitates full host compromise.
Recommendation
- Audit PostgreSQL instances to ensure they are patched to versions 18.7, 17.12, 16.16, 15.20, 14.25 or later.
- Restrict superuser privileges to only the most trusted accounts to minimize the attack surface for this vulnerability.
- Review database logs for anomalous creation of user-defined aggregates or unexpected connections from unauthorized sources.
- Implement network segmentation to ensure PostgreSQL instances are not exposed to untrusted networks.
Immediate actions
Inventory all PostgreSQL instances and identify versions vulnerable to CVE-2026-116331.
Threat Hunt
Monitor PostgreSQL database logs for the creation of new user-defined aggregates, particularly those utilizing min/max optimizations.
Data: PostgreSQL audit logs, SQL query logs
Mitigations
Update PostgreSQL to the fixed versions (18.7, 17.12, 16.16, 15.20, or 14.25).
CVE-2026-116331