-
Notifications
You must be signed in to change notification settings - Fork 13.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crashes on timeouts for multiple modules and Meterpreter #16491
Conversation
if timeout.nil? | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem quite right to my eyes, but leaving as-is for now
@@ -1208,7 +1208,7 @@ def cmd_migrate(*args) | |||
|
|||
begin | |||
server = client.sys.process.open | |||
rescue TimeoutError => e | |||
rescue Rex::TimeoutError, ::Timeout::Error => e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably this was intended to catch the exceptions raised by lib/rex/post/meterpreter/packet_dispatcher.rb
within the send_request
method - fixed above. I've decided to catch both Rex::TimeoutError and Timeout::Error here for simplicity.
Actually; This rabbit hole goes deeper than expected - will draft for now. Edit: Resolved #16491 (comment) |
642c667
to
bbd881f
Compare
Seems to be working fine to me: Before changes:
After changes
|
Release NotesThis fixes a bug whereby Meterpreter sessions and modules would crash when encountering a timeout issue due to using an invalid or deprecated error name. |
Before
After
Verification
Either run this module against a machines machine with WinRM enabled, and verify the other modules too.
Or verify the specific timeout exception semantics various Ruby versions.
Create a test file
foo.rb
Run against different ruby versions, 2.4:
2.7
3.0.x
Fix working in Ruby 3.x:
Fix still working in Ruby 2.4: