VulnWatch by ve1ve2
critical 9.8 EPSS 0.44%

GHSA-w476-322c-wpvm / CVE-2025-14179: SQL injection in pdo_firebird via NUL bytes in quoted strings

Source:
PHP releases (GitHub php/php-src tags)
Published:
Fetched:
Updated:
Affects:
php ext-pdo_firebird

https://github.com/php/php-src/security/advisories/GHSA-w476-322c-wpvm ↗

repo-advisoryphpCWE-89securityrepo:php/php-srcstack

SQL injection in pdo_firebird via NUL bytes in quoted strings Improper handling of NUL bytes during the preparation of Firebird SQL queries leads to sections of the of the query being dropped. NUL bytes can find their way into queries even under regular circumstances via `PDO::quote()`. https://github.com/php/php-src/blob/046ffa257581d6f1a709e9fbc4638793c2ac7e22/ext/pdo_firebird/firebird_driver.c#L437-L442 A new query is constructed token-by-token. In the case of a `ttString` `'\0'`, the string is copied via `strncat()` rather than `memcpy()`, stopping after the first `'` quote and ignoring both the `\0` and terminating `'` quote. This will incorrectly embed the SQL tokens following the string into the string, allowing for trivial SQL injection if the next string is also attacker-controlled. ```php $dbh->exec('CREATE TABLE users (name VARCHAR(255))'); $dbh->exec("INSERT INTO users VALUES ('Foo')"); $dbh->exec("INSERT INTO users VALUES ('Bar')"); $param = $dbh->quote("\0"); $param2 = $dbh->quote('or 1=1--'); $stmt = $dbh->query("SELECT * FROM users WHERE name = {$param} AND name = {$param2}"); // Before preparation: // SELECT * FROM users WHERE name = '\0' AND name = 'or 1=1--' // After preparation: // SELECT * FROM users WHERE name = ' AND name = 'or 1=1--' echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC)) . "\n"; // [{"NAME":"Foo"},{"NAME":"Bar"}] ``` This incorrect preparation applies to `SELECT`, `INSERT`, `UPDATE`, `DELETE`, `MERGE`, `WITH` and `EXECUTE` statements. ## Credits Aleksey Solovev, Nikita Sveshnikov (Positive Technologies) Affected packages: php:ext-pdo_firebird Patched: ext-pdo_firebird 8.2.31, ext-pdo_firebird 8.3.31, ext-pdo_firebird 8.4.21, ext-pdo_firebird 8.5.6

Linked vulnerabilities (2)

CVE-2025-14179 critical 9.8 EPSS 0.44% (p39) NVDCVE.orgGHSA
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

php8.2 - security update

CWE: CWE-89Aliases: CVE-2026-6722, CVE-2026-6735, CVE-2026-7258, CVE-2026-7259, CVE-2026-7261, CVE-2026-7262, CVE-2026-7568, CVE-2026-12184, CVE-2026-6104, CVE-2026-7263, GHSA-w476-322c-wpvm
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

SQL injection in pdo_firebird via NUL bytes in quoted strings

CWE: CWE-89Aliases: CVE-2025-14179