note 63969 added to function.readdir
| From: | concerned at osu1 dot php dot net | Date: | Tue, 04 Apr 2006 19:16:29 +0000 |
| Subject: | note 63969 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107330@lists.php.net to get a copy of this message | ||
I was looking at some of the nice scripts here and noticed
that nothing really would stop a person from looking at a
directory above your base path.
for example if your base path was
c:\\inetpub\\mydomain\\download
you could view above it using \\..\\..\\.. or even just \\ for
the root
the following code would be a good start at parsing the
passed pathname for potential problems.
if (stristr($path,"..") || $path == "\\\\" )
{
print "!!! SECURITY PROBLEM <BR><BR>";
}
hope this helps
----
Server IP: 216.194.113.175
Probable Submitter: 12.211.8.110
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- http://master.php.net/note/edit/63969
Del: integrated -- http://master.php.net/note/delete/63969/integrated
Del: useless -- http://master.php.net/note/delete/63969/useless
Del: bad code -- http://master.php.net/note/delete/63969/bad+code
Del: spam -- http://master.php.net/note/delete/63969/spam
Del: non-english -- http://master.php.net/note/delete/63969/non-english
Del: in docs -- http://master.php.net/note/delete/63969/in+docs
Del: other reasons-- http://master.php.net/note/delete/63969
Reject -- http://master.php.net/note/reject/63969
Search -- http://master.php.net/manage/user-notes.php