Skip to content

Commit 14308fb

Browse files
committed
Land rapid7#9045, Copy original request ID into TLV response
2 parents 015e30c + d0a1fb6 commit 14308fb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/rex/post/meterpreter/packet.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,16 +705,27 @@ def Packet.create_request(method = nil)
705705
def Packet.create_response(request = nil)
706706
response_type = PACKET_TYPE_RESPONSE
707707
method = nil
708+
id = nil
708709

709710
if (request)
710711
if (request.type?(PACKET_TYPE_PLAIN_REQUEST))
711712
response_type = PACKET_TYPE_PLAIN_RESPONSE
712713
end
713714

714715
method = request.method
716+
717+
if request.has_tlv?(TLV_TYPE_REQUEST_ID)
718+
id = request.get_tlv_value(TLV_TYPE_REQUEST_ID)
719+
end
720+
end
721+
722+
packet = Packet.new(response_type, method)
723+
724+
if id
725+
packet.add_tlv(TLV_TYPE_REQUEST_ID, id)
715726
end
716727

717-
Packet.new(response_type, method)
728+
packet
718729
end
719730

720731
##

0 commit comments

Comments
 (0)