Skip to content

Commit 5c65c58

Browse files
author
Brent Cook
committed
Land rapid7#5598:handle nil or short machine_ids gracefully
2 parents 29a5194 + 24a6e4c commit 5c65c58

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/rex/post/meterpreter/client_core.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,10 @@ def machine_id(timeout=nil)
320320

321321
# Normalise the format of the incoming machine id so that it's consistent
322322
# regardless of case and leading/trailing spaces. This means that the
323-
# individual meterpreters don't have to care
324-
mid.downcase!.strip! if mid
325-
return Rex::Text.md5(mid)
323+
# individual meterpreters don't have to care.
324+
325+
# Note that the machine ID may be blank or nil and that is OK
326+
Rex::Text.md5(mid.to_s.downcase.strip)
326327
end
327328

328329
def transport_remove(opts={})

0 commit comments

Comments
 (0)