Skip to content

Commit d5ae2bb

Browse files
committed
Fix pivot handler to not consume all packets
Packet handlers should only return true if they consume a packet. Otherwise, they should return false so something else can consume it. This fixes port forwards by allowing the socket handler to see packets that were otherwise being discarded in the pivot handler.
1 parent 2eca3b9 commit d5ae2bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/rex/post/meterpreter/pivot.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,22 @@ class << self
4545
# Class request handler for all channels that dispatches requests
4646
# to the appropriate class instance's DIO handler
4747
def request_handler(client, packet)
48+
handled = false
4849
if packet.method == 'core_pivot_session_new'
50+
handled = true
4951
session_guid = packet.get_tlv_value(TLV_TYPE_SESSION_GUID)
5052
listener_id = packet.get_tlv_value(TLV_TYPE_PIVOT_ID)
5153
client.add_pivot_session(Pivot.new(client, session_guid, listener_id))
5254
elsif packet.method == 'core_pivot_session_died'
55+
handled = true
5356
session_guid = packet.get_tlv_value(TLV_TYPE_SESSION_GUID)
5457
pivot = client.find_pivot_session(session_guid)
5558
if pivot
5659
pivot.pivoted_session.kill('Died')
5760
client.remove_pivot_session(session_guid)
5861
end
5962
end
60-
true
63+
handled
6164
end
6265
end
6366

0 commit comments

Comments
 (0)