Skip to content

Commit 53d5b97

Browse files
committed
Add support for UUID generation in transport switching
If the session doesn't have a payload UUID we now generate one as best we can. This code will probably go away when TCP related transports have had the UUID stuf baked in.
1 parent 1531324 commit 53d5b97

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def on_request(cli, req, obj)
351351
})
352352

353353
else
354-
print_status("#{cli.peerhost}:#{cli.peerport} Unknown request to #{uri_match} #{req.inspect}...")
354+
print_status("#{cli.peerhost}:#{cli.peerport} Unknown request to #{req.relative_resource} #{req.inspect}...")
355355
resp.code = 200
356356
resp.message = "OK"
357357
resp.body = datastore['HttpUnknownRequestResponse'].to_s

lib/rex/post/meterpreter/client_core.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,15 @@ def change_transport(opts={})
278278
# do more magic work for http(s) payloads
279279
unless opts[:transport].ends_with?('tcp')
280280
sum = uri_checksum_lookup(:connect)
281-
url << generate_uri_uuid(sum, client.payload_uuid) + '/'
281+
uuid = client.payload_uuid
282+
unless uuid
283+
arch, plat = client.platform.split('/')
284+
uuid = Msf::Payload::UUID.new({
285+
arch: arch,
286+
platform: plat.starts_with?('win') ? 'windows' : plat
287+
})
288+
end
289+
url << generate_uri_uuid(sum, uuid) + '/'
282290

283291
opts[:comms_timeout] ||= DEFAULT_COMMS_TIMEOUT
284292
request.add_tlv(TLV_TYPE_TRANS_COMMS_TIMEOUT, opts[:comms_timeout])

0 commit comments

Comments
 (0)