Skip to content
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 process migration on reverse_tcp meterpreter sessions w/ newer Ruby #12502

Merged
merged 2 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rex/post/meterpreter/client_core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def use(mod, opts = { })
unless commands.length > 0
image = nil
path = nil
# If client.sys isn't setup, it's a Windows meterpreter
# If client.sys isn't setup, it's a Windows meterpreter
if client.respond_to?(:sys) && !client.sys.config.sysinfo['BuildTuple'].blank?
# Query the payload gem directly for the extension image
image = MetasploitPayloads::Mettle.load_extension(client.sys.config.sysinfo['BuildTuple'], mod.downcase, suffix)
Expand Down Expand Up @@ -688,7 +688,7 @@ def migrate(target_pid, writable_dir = nil, opts = {})
end

# Renegotiate TLV encryption on the migrated session
client.tlv_enc_key = negotiate_tlv_encryption
secure

# Load all the extensions that were loaded in the previous instance (using the correct platform/binary_suffix)
client.ext.aliases.keys.each { |e|
Expand Down
2 changes: 2 additions & 0 deletions lib/rex/post/meterpreter/packet_dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,13 @@ def receive_packet
def monitor_stop
if self.receiver_thread
self.receiver_thread.kill
self.receiver_thread.join
self.receiver_thread = nil
end

if self.dispatcher_thread
self.dispatcher_thread.kill
self.dispatcher_thread.join
self.dispatcher_thread = nil
end
end
Expand Down