by FLow
PHP3 is a scripted language, that looks a lot like perl, and is parsed
by the web server.
<script language="php">
This would print out "Hello World" in a browser loading the webpage. Vulnerability: PHP supports passing variables the CGI way, e.g. if we access a php script like this: www.example.com/script.php3?user=pepe&pass=juan This will make the server assign the variables (accessible from within the script) $user the value "pepe" and $pass the value "juan" before starting to parse the script. If we define a variable within the script, it will overwrite the contents
of the variable we passed as parameters to the script (e.g. in the URL).
The bad thing about this is that PHP doesn't require us
<script language="php"> if($user && $password)
if($ok == 1)
As you can see, we have three variables, $user, $password and $ok. Let's suppose that the script expects a username and a password in the $user and $password parameters to the script, e.g.: http://www.example.com/script.php3?user=pepe&password=juan At first thought, everything looks fine. If we take a closer look, we will see the that $ok is declared inside an if() statement. What if the if() condition is not true (we don't pass a username or
a password as a parameter to the script)? Then $ok remains undefined, we
get to the second if() and, as it evaluates to false, it gets to
What if we specify no password, but we pass the $ok variable as a parameter to the script? http://www.example.com/script.php3?user=pepe&ok=1 This will make the script show us the private info about the user, given
that the password remains undefined, but $ok=1 making the second condition
evaluate to true, and letting us into the user's
Yes, you could argue that we need to guess the variables, but take into
account that there are quite a few packages that use PHP in open source
(programs to check e-mail through the web, database interfaces
WORKAROUND: Workaround? Define all variables that we are going to use in the script at the beginning of the program, this will avoid surprises. Btw, PHP allows command execution from within a script. Take care if
you install PHP in your webserver if it's a shared or public webserver.
Same goes for SSI (server side includes). Bear in mind
Cheers, FLoW
References: http://www.php3.com - PHP3
Website
|
(C) 1997-2001 by !Hispahack
Para ver el web en las mejores condiciones, usa una resolución
de 800x600 y Netscape Navigator