|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-03-08 11:02 UTC] charlesfol at hotmail dot fr
[2008-03-08 11:47 UTC] johannes@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 02:00:02 2025 UTC |
Description: ------------ I discovered that in this PHP version, regex could be bypassed using \0 (%00) a.k.a. POISON NULL BYTE. Reproduce code: --------------- <?php $var=$_GET['var']; $is_alphanum_var = ereg("^[a-zA-Z0-9]+$",$var); print "$is_alphanum_var\n$var"; ?> Expected result: ---------------- Normally if code contains ad chars such as %,", or _ it will be detected by the regex. Actual result: -------------- But if we use this URL: http://site.com/page.php?var=test%00_- $is_alphanum_var RETURNS 1, BUT $var CONTAINS _- Security HOLE. Warmly, Charles "real" FOL.