Junglewise Threat Intelligence

CVE-2026-17543: PHP ext-pgsql SQL injection in pg_select and related functions

CVE-2026-17543 · Severity: info · CVSS 8.1 · Published 2026-07-30

Executive brief

A vulnerability in the PHP PostgreSQL extension (ext-pgsql) allows attackers to bypass security filters and perform SQL injection attacks. This affects common database operations like selecting, inserting, or updating records when using specific PHP functions. An attacker could exploit this to view sensitive data, modify database records, or bypass authentication in applications using affected versions of PHP.

Technical details

A SQL injection vulnerability exists in the php_pgsql_convert() function within PHP's ext-pgsql extension. The root cause is the use of PQescapeStringConn() followed by wrapping the result in an escape string constant (E'...') via php_pgsql_add_quotes(). When PostgreSQL is configured with standard_conforming_strings = on (the default), PQescapeStringConn() does not escape backslashes. An attacker can provide a backslash followed by a single quote; the quote is doubled by the escaper, but the backslash then escapes the first of the doubled quotes, allowing the second quote to terminate the string and inject arbitrary SQL commands. This affects pg_insert(), pg_update(), pg_select(), and pg_delete(). The issue is resolved in PHP versions 8.2.33, 8.3.33, 8.4.24, and 8.5.9 by using non-escaping string constants instead.

Affected products

  • PHP Group PHP 8.2.* before 8.2.33, 8.3.* before 8.3.33, 8.4.* before 8.4.24, 8.5.* before 8.5.9

Timeline

  • 2026-07-30: disclosed
  • 2026-07-30: advisory
  • 2026-07-30: patched

References

Related threats