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

exploitDog

github логотип

GHSA-w476-322c-wpvm

Опубликовано: 07 мая 2026
Источник: github
Github: Не прошло ревью
CVSS4: 9.2

Описание

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.

$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)

Пакеты

Наименование

ext-pdo_firebird

php
Затронутые версииВерсия исправления

< 8.2.31

8.2.31

Наименование

ext-pdo_firebird

php
Затронутые версииВерсия исправления

< 8.3.31

8.3.31

Наименование

ext-pdo_firebird

php
Затронутые версииВерсия исправления

< 8.4.21

8.4.21

Наименование

ext-pdo_firebird

php
Затронутые версииВерсия исправления

< 8.5.6

8.5.6

EPSS

Процентиль: 17%
0.00261
Низкий

9.2 Critical

CVSS4

Дефекты

CWE-89

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

CVSS3: 9.8
ubuntu
около 1 месяца назад

In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements.

CVSS3: 8.1
redhat
около 1 месяца назад

In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements.

CVSS3: 9.8
nvd
около 1 месяца назад

In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the PDO Firebird driver improperly handles NUL bytes when preparing SQL queries. During token-by-token query construction, a string token containing a NUL byte is copied via strncat(), which stops at the NUL byte, dropping the closing quote and causing subsequent SQL tokens to be interpreted as part of the string. This allows SQL injection when attacker-controlled values are quoted via PDO::quote() and embedded in SQL statements.

msrc
около 1 месяца назад

SQL injection in pdo_firebird via NUL bytes in quoted strings

CVSS3: 9.8
debian
около 1 месяца назад

In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before ...

EPSS

Процентиль: 17%
0.00261
Низкий

9.2 Critical

CVSS4

Дефекты

CWE-89