CVE-2026-116331

Description

A flaw was found in PostgreSQL. An authenticated user with permission to create database objects can exploit this vulnerability to achieve arbitrary code execution as the operating system user running the database service. The issue occurs during query optimization when a user-defined aggregate function specifies a sort operator (SORTOP) that causes the query planner to treat different data types as identical. This data type confusion allows an attacker to manipulate internal memory and compromise the host system.

Statement

This vulnerability is rated as having an Important severity for Red Hat deployments because, although successful exploitation leads to complete arbitrary code execution under the operating system account running the database service, it requires an authenticated attacker with permissions to define custom database objects rather than being exploitable by unauthenticated remote users. In typical enterprise environments, database access is restricted and standard application roles do not possess schema creation privileges, which limits the attack surface to trusted or privileged database accounts. However, in shared hosting or multi-tenant configurations where non-administrative users can create schemas and custom routines, an attacker could leverage this flaw to fully compromise the database host.

Mitigation

Revoke object creation permissions from untrusted database accounts and restrict network access to trusted administrative hosts.

1. Revoke schema creation permissions to prevent users from defining custom aggregates:

sql
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
REVOKE CREATE ON SCHEMA <schema_name> FROM <username>;

2. Limit network access to trusted clients using firewalld:

bash
firewall-cmd --permanent --zone=trusted --add-source=<trusted_ip_or_subnet>
firewall-cmd --permanent --zone=public --remove-service=postgresql
firewall-cmd --reload
Alternatively, restrict client access rules in `/var/lib/pgsql/data/pg_hba.conf` and apply the configuration:
bash
systemctl reload postgresql

Caveats: Revoking object creation privileges prevents non-administrative users and applications from creating or modifying custom database objects and schemas. Limiting network access will block queries from unlisted client hosts.

Warning: Modifying firewall rules or reloading the PostgreSQL service (`systemctl reload postgresql`) affects service accessibility. Ensure configuration changes are applied during scheduled maintenance windows to prevent unexpected disruption to active sessions.

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.