dcerpc: reassemble fragmented TCP messages - #3240
Open
RajaMuhammadAwais wants to merge 3 commits into
Open
Conversation
RajaMuhammadAwais
force-pushed
the
fix/3048-dcerpc-tcp-fragment-reassembly
branch
from
August 31, 2026 13:28
1f64081 to
b97109b
Compare
Member
|
@RajaMuhammadAwais, could you rebase please? |
added 3 commits
September 7, 2026 10:04
Fixes the TCP-layer fragmentation reported in ntop#3048 using a bounded per-direction buffer and add the issue PCAP as a regression test.
RajaMuhammadAwais
force-pushed
the
fix/3048-dcerpc-tcp-fragment-reassembly
branch
from
September 7, 2026 10:07
1f9ed79 to
bb16ab8
Compare
|
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.



Fixes the TCP-layer fragmentation reported in #3048 using a bounded per-direction buffer and add the issue PCAP as a regression test.
Please sign (check) the below before submitting the Pull Request:
Link to the related Fixes #3048
Describe changes:
Fix DCERPC detection for fragmented TCP messages
Problem
The DCERPC dissector currently validates connection-oriented DCERPC only when the complete message is available in a single TCP payload. When a valid DCERPC fragment is split across multiple TCP segments, the dissector evaluates each segment independently. The first segment does not contain a complete DCERPC PDU, so the dissector is excluded before the remaining segments can be inspected.
As a result, the DCERPC flow from the issue-provided capture is reported as
Unknowninstead ofDCERPC.The attached issue capture demonstrates a valid DCERPC message distributed across multiple TCP packets, including the DCERPC header and body being received in separate segments.
Root Cause
The previous implementation had no TCP reassembly state for DCERPC and excluded the dissector when an individual payload did not satisfy the complete-message checks.
The existing connection-oriented validation also expects the payload length to match the DCERPC fragment length exactly, which is not true for an incomplete TCP segment.
Solution
This change adds a bounded, per-direction TCP reassembly path for connection-oriented DCERPC messages:
Regression Test
The PCAP supplied in issue #3048 was added as a regression fixture:
The fixture verifies that the fragmented flow is detected as
DCERPCinstead of remainingUnknown.Verification
The following checks were completed:
DCERPCwith 19 packets and 1 flow.dcerpc.pcapfixture: passes with no output difference.tests/do.sh: passes with no output difference../tests/do-unit.sh: passes../example/ndpiReader --run-tests: exits successfully.git diff --check: passes.make: passes.The complete
./tests/do.shsuite was started but became excessively long in this environment, so it was stopped safely. The focused regression, existing DCERPC fixture, internal tests, and unit tests listed above were run successfully.Scope
This is a focused fix for DCERPC connection-oriented messages fragmented across TCP segments.
It does not change the existing connectionless UDP detection logic or the normal complete-PDU TCP fast path.
Related Issue
Closes #3048