Repository navigation
mqtt: support TCP stream reassembly (#4595) - #5311
Open
Vigneshwarans32241 wants to merge 2 commits into
Open
Vigneshwarans32241 wants to merge 2 commits into
Vigneshwarans32241 wants to merge 2 commits into
Conversation
Implement MQTT.tcp_reassemble() using the variable-length header so multi-segment and coalesced MQTT packets are reassembled by TCPSession, and raise Scapy_Exception in VariableFieldLenField.getfield() when the length varint is truncated. Also ignore Ethernet trailer Padding on payload-less TCP segments in TCPSession.process() so padded handshake ACKs are not appended to the TCP stream buffer. AI-Assisted: yes (Arena.ai)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
MQTTinscapy/contrib/mqtt.pydoes not implementtcp_reassemble, causing multi-segmentMQTTpackets (such asMQTTConnectwith a large Will payload) to be dissected segment-by-segment underTCPSession, andVariableFieldLenField.getfieldimplicitly returnsNonewhen the variable-byte length field is truncated.In addition,
TCPSession.processtreats Ethernet trailerPaddingon payload-less TCP segments (e.g. a 60-byte padded handshakeACK) as TCP stream payload, prepending zero bytes to the reassembly buffer.This PR implements
MQTT.tcp_reassemble, raisesScapy_Exceptionon truncated variable-length headers, and ignoresconf.padding_layerpayloads on empty TCP segments inTCPSession.process.fixes #4595
This message was written with the help of AI (Arena.ai).