PHPの一覧に戻る

脆弱性の詳細

PHP:データベースへの不正操作

PHP 本体CVE-2026-17543重要度:高悪用状況:未確認修正版情報あり

PHPにデータベースへの不正操作に関する脆弱性情報があります。影響を受ける条件を確認してください。

どんな危険?

データベースに不正な命令を送られ、情報の閲覧や変更につながる可能性があります。

対象
PHP 8.2系 / ext-pgsql:<8.2.33(修正版 8.2.33 に対応する系列。旧系列の影響は原文確認)PHP 8.3系 / ext-pgsql:<8.3.33(修正版 8.3.33 に対応する系列。旧系列の影響は原文確認)PHP 8.4系 / ext-pgsql:<8.4.24(修正版 8.4.24 に対応する系列。旧系列の影響は原文確認)PHP 8.5系 / ext-pgsql:<8.5.9(修正版 8.5.9 に対応する系列。旧系列の影響は原文確認)
修正版
8.2.338.3.338.4.248.5.9

どうすればいい?

  1. 使っている製品名・バージョン・構成を、影響を受ける条件と照合してください。
  2. 公式の修正版を確認し、バックアップと動作確認のうえで更新してください。
  3. 更新後は稼働中のバージョンと動作を確認してください。管理を委託している場合は、提供元に対応状況を確認してください。
情報源の原文を確認

悪用状況の「未確認」は、悪用されていないことを意味しません。対策は製品・バージョン・利用条件によって異なります。適用前に情報源とご自身の環境を確認してください。

情報の出典と更新日時

原文と条件を確認

`php_pgsql_convert()` is used to convert and escape user-provided parameters in `pg_insert()`, `pg_update()`, `pg_select()`, and `pg_delete()`. It does so using `PQescapeStringConn()` and then wraps the result in an escape string constant, `E'...'` (via `php_pgsql_add_quotes()`). https://github.com/php/php-src/blob/cbc0489126a7682796aad1e5fb4e51de74af162c/ext/pgsql/pgsql.c#L4751-L4757 With `standard_conforming_strings = on` (the default since PostgreSQL 9.1), `PQescapeStringConn()` does not correctly escape values for the escape string constant `E'...'`, as it does not escape `\` under this configuration. When `PQescapeStringConn()` escapes `'` as `''`, an attacker can trivially terminate the string by escaping the first single quote. ```php $result = pg_select($db, 'user', ['name' => "zzz\\' OR 1=1 --"]); // SELECT * FROM "user" WHERE "name"='zzz\'' OR 1=1 --'; var_dump($result); // returned all rows ``` Note that the doubled `\\` is a PHP escape sequence and that the `\` appears only once in the parameter. Also note that `pg_select()` escapes the `'` by doubling it but does not escape the `\`. Consequently, the first of the two `'` characters is escaped (meaning that it represents a literal `'`), while the second terminates the string. Everything after that is interpreted as part of the query. The solution changes `php_pgsql_convert()` to wrap parameters in non-escaping string constants instead.

この情報をAIに渡す

対象・リスク・対策・出典を同じ内容で取得

JSONを見る

このサービスを共有

脆弱性を確認する入口を、チームや知り合いに。

Xで共有