Full Disclosure mailing list archives

Re: Re: file_exists() bypassing , critical problem ?


From: "Nourredine Himeur" <lostnoobs () security-challenge com>
Date: Mon, 2 Feb 2004 12:23:40 +0100

There are various methods for securing file_exists() ...
If you want to secure ... so that's unsecure , is'nt it ?

I didn't say that file_exists() is secure, did I?

I don't think that is critical problem.
If it's not a problem Why you show us a methode to secure ?

I didn't say that it is not a problem but that it is not a critical
problem.

I think many programmers don't know this problem exists !
But there is too much hypocresy in php community to admit this
vulnerability.

This is not a PHP vulnerability but a PHP Script vulnerablity, and I am
sure
that many php programmers are aware of security problems while using
file_exists().

The article : http://www.zend.com/zend/art/art-oertli.php
don't talk about this sorry...

What is the problem, very interesting article, old one but still very
interesting.

file_exists() must check if the file exists and with this vulnerabilty it
don't do this.
For me this function don't work good.

re-read it :)

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
°°°

In the same directory :
test.php
-----------------------------------------------------------
<?
if(file_exists($page)){
echo("Sorry the local page is protected");
}else{
include($page);
}
?>
-----------------------------------------------------------

file.txt
-----------------------------------------------------------
Hello World
-----------------------------------------------------------

http://www.example.com/test.php?page=file.txt

Result:
Sorry the local page is protected

http://www.example.com/test.php?page=./[anything]/../file.txt
<----------------- the file exists but the function file_exists() don't show
it. so the file is include !!!!!

Result:
Hello World

The function file_exists() is bypassing just with ./[anything]/../file.txt
the function return wrong but the file exist

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
°°°

Nourredine Himeur

www.security-challenge.com

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.netsys.com/full-disclosure-charter.html


Current thread: