脆弱性の詳細
PHP:データベースへの不正操作
PHP 本体CVE-2025-14179重要度:高悪用状況:未確認修正版情報ありPHPにデータベースへの不正操作に関する脆弱性情報があります。影響を受ける条件を確認してください。
どんな危険?
データベースに不正な命令を送られ、情報の閲覧や変更につながる可能性があります。
- 対象
- PHP 8.2系 / ext-pdo_firebird:< 8.2.31(修正版 8.2.31 に対応する系列。旧系列の影響は原文確認)PHP 8.3系 / ext-pdo_firebird:< 8.3.31(修正版 8.3.31 に対応する系列。旧系列の影響は原文確認)PHP 8.4系 / ext-pdo_firebird:< 8.4.21(修正版 8.4.21 に対応する系列。旧系列の影響は原文確認)PHP 8.5系 / ext-pdo_firebird:< 8.5.6(修正版 8.5.6 に対応する系列。旧系列の影響は原文確認)
- 修正版
- 8.2.318.3.318.4.218.5.6
どうすればいい?
- 使っている製品名・バージョン・構成を、影響を受ける条件と照合してください。
- 公式の修正版を確認し、バックアップと動作確認のうえで更新してください。
- 更新後は稼働中のバージョンと動作を確認してください。管理を委託している場合は、提供元に対応状況を確認してください。
悪用状況の「未確認」は、悪用されていないことを意味しません。対策は製品・バージョン・利用条件によって異なります。適用前に情報源とご自身の環境を確認してください。
情報の出典と更新日時
原文と条件を確認
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)