---
id: "CVE-2026-120141"
page: "https://infrastack.ai/live/CVE-2026-120141"
kind: "vulnerability"
aliases: ["CVE-2026-120141"]
title: "PostgreSQL: type confusion in set-returning functions lets a database user run code"
severity: "high"
cvss: 8.8
epss: null
exploited: false
status: "open"
category: "runtime"
products: []
ecosystems: []
tags: ["database", "postgresql", "runtime", "self-hosted"]
not_affected_if: ["patched-version", "trusted-users-only"]
published_at: "2026-11-12T15:17:42+00:00"
first_seen_at: "2026-11-12T15:41:56+00:00"
updated_at: "2026-11-12T15:43:16+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-120141", "first_seen_at": "2026-11-12T15:41:56+00:00"}]
exploit_sources: []
---

# PostgreSQL: type confusion in set-returning functions lets a database user run code

Link for people: https://infrastack.ai/live/CVE-2026-120141 (this .md is for agents)

A flaw in PostgreSQL's materialized set-returning functions, such as json_populate_recordset(), causes a type confusion when rows with different dynamic RECORD return types are returned. A database user with query access can execute arbitrary code as the operating system user running the database.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Run `SELECT version();` in psql and compare the server version against the fixed releases.
- Check whether the server runs a PostgreSQL major version 14, 15, 16, 17 or 18 below the fixed releases listed in Fix.

## Fix

- PostgreSQL `18.7`
- PostgreSQL `17.12`
- PostgreSQL `16.16`
- PostgreSQL `15.20`
- PostgreSQL `14.25`

## Timeline

- 2026-11-12T15:41:56+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-120141

## From the sources

Type confusion in PostgreSQL materialized set-returning functions allows a database user to execute arbitrary code as the operating system user running the database, via returning rows having different dynamic RECORD return types.  json_populate_recordset() is one affected function.  Versions before PostgreSQL 18.7, 17.12, 16.16, 15.20, and 14.25 are affected.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
