CVE-2026-120141

Description

A flaw was found in PostgreSQL. A type confusion vulnerability in materialized set-returning functions allows an authenticated database user to execute arbitrary code on the server with the privileges of the operating system user running the database. By returning rows with differing dynamic record types (such as through the json_populate_recordset() function), the database misinterprets data types in memory, leading to arbitrary code execution.

Statement

This vulnerability is rated as Important severity because an authenticated database user can achieve arbitrary code execution under the privileges of the operating system account running the PostgreSQL service. While exploiting the issue requires valid database credentials, it allows standard database users without superuser privileges to breach host boundaries and compromise the underlying operating system process. In Red Hat Enterprise Linux environments where databases serve multiple applications or untrusted tenants, this enables direct escalation from database access to local host compromise.

Mitigation

Restrict network access to the PostgreSQL service so that only trusted client IP addresses can establish connections, and avoid provisioning database accounts to untrusted users.

1. Using firewalld, restrict PostgreSQL access (default port 5432/tcp) to trusted IP addresses or subnets:

sh
firewall-cmd --permanent --remove-service=postgresql
firewall-cmd --permanent --zone=trusted --add-source=<trusted_ip_range>
firewall-cmd --reload

2. Alternatively, restrict client connection access in `/var/lib/pgsql/data/pg_hba.conf` to specific trusted addresses, then reload the service:

sh
systemctl reload postgresql

Caveats:
Restricting network access limits exposure from untrusted networks, but any authenticated database user connecting from an authorized host can still trigger the vulnerability.

Warning: Reloading firewall configuration or the PostgreSQL service may momentarily interrupt active network connections. Verify that administrative management sources are included in trusted rules prior to reloading to avoid losing remote access.

Common Vulnerability Scoring System (CVSS) Score Details

Info alert:Important note

CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).

The following CVSS metrics and score provided are preliminary and subject to review.

CVSS v3 Score Breakdown

Red HatNVDcve.org
Base Score8.8N/A8.8
Attack VectorNetworkN/ANetwork
Attack ComplexityLowN/ALow
Privileges RequiredLowN/ALow
User InteractionNoneN/ANone
ScopeUnchangedN/AUnchanged
ConfidentialityHighN/AHigh
Integrity ImpactHighN/AHigh
Availability ImpactHighN/AHigh

Vector

Red Hat: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

cve.org: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Understanding the Weakness (CWE)

Other

Technical Impact: Varies by Context

When the product accesses the resource using an incompatible type, this could trigger logical errors because the resource does not have expected properties.

Availability,Integrity,Confidentiality

Technical Impact: Read Memory; Modify Memory; Execute Unauthorized Code or Commands; DoS: Crash, Exit, or Restart

If a memory buffer is accessed using an incompatible type, and the allocated buffer is smaller than the type that the code is attempting to access, then an attacker could read or write memory outside the bounds of the buffer, leading to a crash or possibly code execution.

Frequently Asked Questions

Want to get errata notifications? Sign up here.