php-src icon indicating copy to clipboard operation
php-src copied to clipboard

PDO emulation does not properly treat NUL bytes which could lead to an SQL injection

Open osevan opened this issue 1 year ago • 3 comments

Description

Based on: https://web.archive.org/web/20251017002820/https://slcyber.io/assetnote-security-research-center/a-novel-technique-for-sql-injection-in-pdos-prepared-statements/

When developers write SQL statements by concatenating user input directly into the query, the input can contain a NUL byte which will then confuse the SQL parser. If a placeholder comes after such part, an SQL injection is possible.

This requires code that does not use white-listing for column/table names and inserts a user input value into the query.

PHP Version

Any PHP version.

Operating System

No response

osevan avatar Sep 09 '25 13:09 osevan

Seems like related with https://github.com/php/php-src/issues/13958 issue and possibly also with https://github.com/php/php-src/pull/14035 PR.

mvorisek avatar Sep 10 '25 09:09 mvorisek

You mean its already merged ?

osevan avatar Sep 11 '25 11:09 osevan

No, that are old issues, but I think they are related to this problem.

mvorisek avatar Sep 12 '25 22:09 mvorisek