From: david dot hoskovec at atlas dot cz Operating system: Windows PHP version: 5.1.4 PHP Bug Type: *Directory/Filesystem functions Bug description: Security problem with char 0
Description: ------------ There is method, what allows to mask filename's ext - security issue in some file-upload scripts. Reproduce code: --------------- <? $filename = "test.php".Chr(0); if(substr($filename , -3)=="php") Die(); // no no, it won't die here ! $fp = FOpen($filename , "w"); FWrite($fp,"<? echo 'bug' ; ?>",4096); FClose($fp); include "test.php"; // THIS WILL PRINT 'bug' !!! (PHP version 5) ?> Expected result: ---------------- FOpen would validate string(attention on null-terminating char) before it uses it and call out a error. -- Edit bug report at http://bugs.php.net/?id=38008&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38008&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38008&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38008&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38008&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38008&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38008&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38008&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38008&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38008&r=support Expected behavior: http://bugs.php.net/fix.php?id=38008&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38008&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38008&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38008&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38008&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38008&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38008&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38008&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38008&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38008&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38008&r=mysqlcfg