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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Thu Mar 28 13:01:28 2024 UTC