Skip to content

Commit 51c69ab

Browse files
committed
Land rapid7#5643 : Call the Meterpreter methods directly vs pollute the namespace
2 parents 1c5abec + a5ad567 commit 51c69ab

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'rex/io/stream_abstraction'
33
require 'rex/sync/ref'
44
require 'rex/payloads/meterpreter/uri_checksum'
5-
require 'rex/post/meterpreter/packet'
5+
require 'rex/post/meterpreter'
66
require 'rex/parser/x509_certificate'
77
require 'msf/core/payload/windows/verify_ssl'
88

@@ -19,7 +19,6 @@ module ReverseHttp
1919
include Msf::Handler
2020
include Rex::Payloads::Meterpreter::UriChecksum
2121
include Msf::Payload::Windows::VerifySsl
22-
include Rex::Post::Meterpreter
2322

2423
#
2524
# Returns the string representation of the handler type
@@ -258,15 +257,11 @@ def on_request(cli, req, obj)
258257
# Handle the case where stageless payloads call in on the same URI when they
259258
# first connect. From there, we tell them to callback on a connect URI that
260259
# was generated on the fly. This means we form a new session for each.
261-
sum = uri_checksum_lookup(:connect)
262-
new_uri = generate_uri_uuid(sum, uuid) + '/'
263260

264-
# This bit is going to need to be validated by the Ruby/MSF masters as I
265-
# am not sure that this is the best way to get a TLV packet out from this
266-
# handler.
267261
# Hurl a TLV back at the caller, and ignore the response
268-
pkt = Packet.new(PACKET_TYPE_RESPONSE, 'core_patch_url')
269-
pkt.add_tlv(TLV_TYPE_TRANS_URL, new_uri)
262+
pkt = Rex::Post::Meterpreter::Packet.new(Rex::Post::Meterpreter::PACKET_TYPE_RESPONSE,
263+
'core_patch_url')
264+
pkt.add_tlv(Rex::Post::Meterpreter::TLV_TYPE_TRANS_URL, conn_id + "/")
270265
resp.body = pkt.to_r
271266

272267
when :init_python

0 commit comments

Comments
 (0)