note 89163 added to function.exit

From: Date: Tue, 24 Feb 2009 20:41:09 +0000
Subject: note 89163 added to function.exit
Groups: php.notes 
Request: Send a blank email to php-notes+get-151081@lists.php.net to get a copy of this message
To: rich dot lovely at klikzltd dot co dot uk, You may want to look at Filesystem Security > Null bytes related issues > Example #1 Script vulnerable to null bytes. Null bytes related issues As PHP uses the underlying C functions for filesystem related operations, it may handle null bytes in a quite unexpected way. As null bytes denote the end of a string in C, strings containing them won't be considered entirely but rather only until a null byte occurs. The following example shows a vulnerable code that demonstrates this problem: <?php $file = $_GET['file']; // "../../etc/passwd\0" if (file_exists('/home/wwwrun/'.$file.'.php')) { // file_exists will return true as the file /home/wwwrun/../../etc/passwd exists include '/home/wwwrun/'.$file.'.php'; // the file /etc/passwd will be included } ?> ---- Server IP: 208.69.120.35 Probable Submitter: 148.129.74.40 ---- Manual Page -- http://www.php.net/manual/en/function.exit.php Edit -- https://master.php.net/note/edit/89163 Del: integrated -- https://master.php.net/note/delete/89163/integrated Del: useless -- https://master.php.net/note/delete/89163/useless Del: bad code -- https://master.php.net/note/delete/89163/bad+code Del: spam -- https://master.php.net/note/delete/89163/spam Del: non-english -- https://master.php.net/note/delete/89163/non-english Del: in docs -- https://master.php.net/note/delete/89163/in+docs Del: other reasons-- https://master.php.net/note/delete/89163 Reject -- https://master.php.net/note/reject/89163 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151081) next »