Skip to content

Commit 1531324

Browse files
committed
Use UUID instead of old skool URIs
This uses HD's UUID stuff to generate a new URI for the transport. Currently we don't have UUID support for TCP connections, but that's coming. Still do to: generation of a valid UUID for payloads that don't already have one.
1 parent 2977cbd commit 1531324

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

lib/msf/core/payload/uuid_options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'msf/core'
44
require 'msf/core/payload/uuid'
5-
require 'rex/payloads/meterpreter/uri_checksum.rb'
5+
require 'rex/payloads/meterpreter/uri_checksum'
66

77
#
88
# This module provides datastore option definitions and helper methods for payload modules that support UUIDs

lib/rex/post/meterpreter/client_core.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
# Provides methods to patch options into the metsrv stager.
1212
require 'rex/payloads/meterpreter/patch'
1313

14-
# URI checksum calculation
14+
# URI uuid and checksum stuff
15+
require 'msf/core/payload/uuid'
1516
require 'rex/payloads/meterpreter/uri_checksum'
1617

17-
# URI checksumming stuff
18-
require 'msf/core/handler/reverse_https'
19-
2018
# certificate hash checking
2119
require 'rex/parser/x509_certificate'
2220

@@ -51,7 +49,6 @@ class ClientCore < Extension
5149
'bind_tcp' => METERPRETER_TRANSPORT_SSL
5250
}
5351

54-
5552
include Rex::Payloads::Meterpreter::UriChecksum
5653

5754
#
@@ -280,9 +277,8 @@ def change_transport(opts={})
280277

281278
# do more magic work for http(s) payloads
282279
unless opts[:transport].ends_with?('tcp')
283-
checksum = generate_uri_checksum(URI_CHECKSUM_CONN)
284-
rand = Rex::Text.rand_text_alphanumeric(16)
285-
url << "/#{checksum}_#{rand}/"
280+
sum = uri_checksum_lookup(:connect)
281+
url << generate_uri_uuid(sum, client.payload_uuid) + '/'
286282

287283
opts[:comms_timeout] ||= DEFAULT_COMMS_TIMEOUT
288284
request.add_tlv(TLV_TYPE_TRANS_COMMS_TIMEOUT, opts[:comms_timeout])

lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,11 @@ def cmd_transport(*args)
392392
when '-ua'
393393
opts[:ua] = val
394394
when '-to'
395-
opts[:comms_timeout] = val.to_i
395+
opts[:comms_timeout] = val.to_i if val
396396
when '-ex'
397-
opts[:session_exp] = val.to_i
397+
opts[:session_exp] = val.to_i if val
398398
when '-p'
399-
opts[:lport] = val.to_i
399+
opts[:lport] = val.to_i if val
400400
when '-l'
401401
opts[:lhost] = val
402402
when '-t'

0 commit comments

Comments
 (0)