Skip to content

Commit f1e6e7e

Browse files
committed
Land rapid7#9107, add MinRID to complement MaxRID
2 parents 95b6cda + d715f53 commit f1e6e7e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

modules/auxiliary/scanner/smb/smb_lookupsid.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def initialize
3939

4040
register_options(
4141
[
42+
OptInt.new('MinRID', [ false, "Starting RID to check", 500 ]),
4243
OptInt.new('MaxRID', [ false, "Maximum RID to check", 4000 ])
4344
],
4445
self.class
@@ -140,7 +141,6 @@ def smb_parse_sid_lookup(data)
140141

141142
# Fingerprint a single host
142143
def run_host(ip)
143-
144144
[[139, false], [445, true]].each do |info|
145145

146146
@rport = info[0]
@@ -227,8 +227,10 @@ def run_host(ip)
227227
domain_sid || host_sid
228228
end
229229

230+
min_rid = datastore['MinRID']
230231
# Brute force through a common RID range
231-
500.upto(datastore['MaxRID'].to_i) do |rid|
232+
233+
min_rid.upto(datastore['MaxRID']) do |rid|
232234

233235
stub =
234236
phandle +
@@ -244,7 +246,6 @@ def run_host(ip)
244246
NDR.long(1) +
245247
NDR.long(0)
246248

247-
248249
dcerpc.call(15, stub)
249250
resp = dcerpc.last_response ? dcerpc.last_response.stub_data : nil
250251

@@ -295,6 +296,4 @@ def run_host(ip)
295296
end
296297
end
297298
end
298-
299-
300299
end

0 commit comments

Comments
 (0)