CVE-2026-120153

Description

A flaw was found in PostgreSQL. An authenticated user with database-level CREATE privileges can execute arbitrary code as the administrative superuser through a Structured Query Language (SQL) injection vulnerability in extension-script substitutions. By supplying a crafted schema or owner name containing newlines or special characters to an affected extension script, an attacker can manipulate script execution to achieve privilege escalation.

Statement

Red Hat has rated this vulnerability as having an impact of Important because successful exploitation allows an authenticated database user to escalate privileges to the administrative superuser, potentially executing code on the underlying host system. The flaw requires specific prerequisites: the user must possess database-level CREATE privileges, and the database must use an external, non-bundled extension containing vulnerable script substitution patterns. Default PostgreSQL installations provided with Red Hat enterprise distributions do not include these vulnerable extension scripts, limiting risk to environments that deploy unverified third-party extensions.

Mitigation

Revoke database-level CREATE privileges from untrusted users, avoid installing non-bundled third-party extensions, and restrict PostgreSQL network connectivity to trusted management networks.

1. Revoke database creation permissions using SQL:
REVOKE CREATE ON DATABASE <database_name> FROM <username>;

2. Restrict PostgreSQL network access to trusted sources using firewalld:
firewall-cmd --permanent --zone=public --remove-service=postgresql
firewall-cmd --permanent --zone=trusted --add-source=<trusted_ip_or_subnet>
firewall-cmd --reload

Caveats:
Revoking CREATE rights prevents affected database users from creating new schemas or database objects, which may break applications that rely on dynamic object creation. Limiting firewall access prevents incoming database connections from unauthorized networks.

Warning:
Modifying firewall settings requires a reload using `firewall-cmd --reload`. If modifying access controls within `pg_hba.conf` or `postgresql.conf`, execute `systemctl reload postgresql` to apply changes without restarting the daemon or terminating active client connections.

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 Score7.2N/A7.2
Attack VectorNetworkN/ANetwork
Attack ComplexityLowN/ALow
Privileges RequiredHighN/AHigh
User InteractionNoneN/ANone
ScopeUnchangedN/AUnchanged
ConfidentialityHighN/AHigh
Integrity ImpactHighN/AHigh
Availability ImpactHighN/AHigh

Vector

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

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

Understanding the Weakness (CWE)

Confidentiality,Integrity,Availability

Technical Impact: Execute Unauthorized Code or Commands

Adversaries could execute system commands, typically by changing the SQL statement to redirect output to a file that can then be executed.

Confidentiality

Technical Impact: Read Application Data

Since SQL databases generally hold sensitive data, loss of confidentiality is a frequent problem with SQL injection vulnerabilities.

Authentication

Technical Impact: Gain Privileges or Assume Identity; Bypass Protection Mechanism

If poor SQL commands are used to check user names and passwords or perform other kinds of authentication, it may be possible to connect to the product as another user with no previous knowledge of the password.

Access Control

Technical Impact: Bypass Protection Mechanism

If authorization information is held in a SQL database, it may be possible to change this information through the successful exploitation of a SQL injection vulnerability.

Integrity

Technical Impact: Modify Application Data

Just as it may be possible to read sensitive information, it is also possible to modify or even delete this information with a SQL injection attack.

Frequently Asked Questions

Want to get errata notifications? Sign up here.