php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38008 Security problem with char 0
Submitted: 2006-07-04 20:03 UTC Modified: 2006-07-05 08:57 UTC
From: david dot hoskovec at atlas dot cz Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.1.4 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: david dot hoskovec at atlas dot cz
New email:
PHP Version: OS:

 

 [2006-07-04 20:03 UTC] david dot hoskovec at atlas dot cz
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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-05 01:33 UTC] judas dot iscariote at gmail dot com
this is a well known security exploit possible with a lot of languages not only PHP.
this is called "Null byte attack". 

BTW..this is not a bug in PHP, but in your scripts.
 [2006-07-05 08:57 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 23:01:28 2024 UTC