Skip to content

Commit

Permalink
Add a secure command to renegotiate TLV encryption
Browse files Browse the repository at this point in the history
This gives us the ability to force TLV encryption if for some reason
it's not already in place, and it means we can renegotiate a new key on
the fly if we want to.
  • Loading branch information
OJ committed Jun 10, 2019
1 parent 026b38e commit 0e0edeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rex/post/meterpreter/client_core.rb
Expand Up @@ -701,6 +701,10 @@ def migrate(target_pid, writable_dir = nil, opts = {})
return true
end

def secure
client.tlv_enc_key = negotiate_tlv_encryption
end

#
# Shuts the session down
#
Expand Down
Expand Up @@ -60,6 +60,7 @@ def commands
'use' => 'Deprecated alias for "load"',
'load' => 'Load one or more meterpreter extensions',
'machine_id' => 'Get the MSF ID of the machine attached to the session',
'secure' => '(Re)Negotiate TLV packet encryption on the session',
'guid' => 'Get the session GUID',
'quit' => 'Terminate the meterpreter session',
'resource' => 'Run the commands stored in a file',
Expand Down Expand Up @@ -319,6 +320,12 @@ def cmd_sessions(*args)
end
end

def cmd_secure
print_status('Negotiating new encryption key ...')
client.core.secure
print_good('Done.')
end

def cmd_background_help
print_line('Usage: background')
print_line
Expand Down

0 comments on commit 0e0edeb

Please sign in to comment.