Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

redhat логотип

CVE-2025-1094

Опубликовано: 13 фев. 2025
Источник: redhat
CVSS3: 8.1
EPSS Высокий

Описание

Improper neutralization of quoting syntax in PostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() allows a database input provider to achieve SQL injection in certain usage patterns. Specifically, SQL injection requires the application to use the function result to construct input to psql, the PostgreSQL interactive terminal. Similarly, improper neutralization of quoting syntax in PostgreSQL command line utility programs allows a source of command line arguments to achieve SQL injection when client_encoding is BIG5 and server_encoding is one of EUC_TW or MULE_INTERNAL. Versions before PostgreSQL 17.3, 16.7, 15.11, 14.16, and 13.19 are affected.

A flaw was found in PostgreSQL. Due to improper neutralization of quoting syntax, affected versions potentially allow a database input provider to achieve SQL injection in certain usage patterns. Specifically, SQL injection requires the application to use the affected function's result to construct input to psql, the PostgreSQL interactive terminal. Similarly, improper neutralization of quoting syntax in PostgreSQL command line utility programs allows a source of command line arguments to achieve SQL injection when client_encoding is BIG5 and server_encoding is one of EUC_TW or MULE_INTERNAL.

Отчет

This vulnerability is marked as Important because it not only enables SQL injection but also allows arbitrary code execution (ACE) through PostgreSQL’s psql interactive tool. The flaw arises from improper neutralization of malformed UTF-8 sequences, which can bypass PostgreSQL’s escaping functions, leading to successful injection attacks. What elevates its severity is psql's support for meta-commands, specifically the ! command, which allows execution of arbitrary shell commands on the host system. Even when untrusted input is correctly escaped (e.g., via pg_escape_string), an attacker can craft invalid UTF-8 characters containing raw bytes like 0x27 (a single quote), causing psql to misinterpret the SQL statement’s structure. This allows splitting a single query into multiple statements, enabling unauthenticated attackers to execute arbitrary SQL meta-commands (e.g., ! ) or inject malicious SQL.

Меры по смягчению последствий

To mitigate, apply PostgreSQL patches once available. Until then:

  1. Validate UTF-8 encoding: Reject inputs containing invalid UTF-8 sequences before passing to psql.
  2. Avoid dynamic SQL: Use parameterized queries or ORM frameworks to minimize direct psql usage with raw input.
  3. Restrict psql privileges: Limit OS-level permissions for the PostgreSQL user to reduce RCE impact.
  4. Monitor logs: Flag repeated invalid byte sequence for encoding "UTF8" errors, which may indicate exploitation attempts.

Затронутые пакеты

ПлатформаПакетСостояниеРекомендацияРелиз
Red Hat Enterprise Linux 10libpqNot affected
Red Hat Enterprise Linux 10postgresql16Not affected
Red Hat Enterprise Linux 6postgresqlOut of support scope
Red Hat Enterprise Linux 7 Extended Lifecycle SupportpostgresqlFixedRHSA-2025:397817.04.2025
Red Hat Enterprise Linux 8postgresqlFixedRHSA-2025:173620.02.2025
Red Hat Enterprise Linux 8libpqFixedRHSA-2025:173720.02.2025
Red Hat Enterprise Linux 8postgresqlFixedRHSA-2025:173920.02.2025
Red Hat Enterprise Linux 8postgresqlFixedRHSA-2025:174020.02.2025
Red Hat Enterprise Linux 8postgresqlFixedRHSA-2025:308220.03.2025
Red Hat Enterprise Linux 8.2 Advanced Update SupportlibpqFixedRHSA-2025:172020.02.2025

Показывать по

Дополнительная информация

Статус:

Important
Дефект:
CWE-149
https://bugzilla.redhat.com/show_bug.cgi?id=2345548postgresql: PostgreSQL quoting APIs miss neutralizing quoting syntax in text that fails encoding validation

EPSS

Процентиль: 99%
0.8363
Высокий

8.1 High

CVSS3

Связанные уязвимости

CVSS3: 8.1
ubuntu
4 месяца назад

Improper neutralization of quoting syntax in PostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() allows a database input provider to achieve SQL injection in certain usage patterns. Specifically, SQL injection requires the application to use the function result to construct input to psql, the PostgreSQL interactive terminal. Similarly, improper neutralization of quoting syntax in PostgreSQL command line utility programs allows a source of command line arguments to achieve SQL injection when client_encoding is BIG5 and server_encoding is one of EUC_TW or MULE_INTERNAL. Versions before PostgreSQL 17.3, 16.7, 15.11, 14.16, and 13.19 are affected.

CVSS3: 8.1
nvd
4 месяца назад

Improper neutralization of quoting syntax in PostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() allows a database input provider to achieve SQL injection in certain usage patterns. Specifically, SQL injection requires the application to use the function result to construct input to psql, the PostgreSQL interactive terminal. Similarly, improper neutralization of quoting syntax in PostgreSQL command line utility programs allows a source of command line arguments to achieve SQL injection when client_encoding is BIG5 and server_encoding is one of EUC_TW or MULE_INTERNAL. Versions before PostgreSQL 17.3, 16.7, 15.11, 14.16, and 13.19 are affected.

CVSS3: 8.1
msrc
4 месяца назад

Описание отсутствует

CVSS3: 8.1
debian
4 месяца назад

Improper neutralization of quoting syntax in PostgreSQL libpq function ...

suse-cvrf
4 месяца назад

Security update for postgresql13

EPSS

Процентиль: 99%
0.8363
Высокий

8.1 High

CVSS3