Defeat IP-fragmentation evasion: wire flowscope ip_fragment::IpFragmentReassembler into the packet→tracker path #134
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
roadmap
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
marcpardo/netring#134
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Roadmap. Additive, opt-in; new capability from flowscope 0.22 (#132 bump is the prereq).
Problem
A fragmented IP datagram defeats every L4/L7 view netring builds today: the first fragment carries the L4 header (so the flow key classifies) but a parser sees a truncated payload, and non-first fragments have no L4 header at all — so deliberate fragmentation (a classic IDS-evasion technique, teardrop-style overlaps included) slips signatures, L7 parsers, and fingerprints. netring currently feeds each fragment to the tracker as-is.
What upstream provides
flowscope 0.22 ships
flowscope::ip_fragment::IpFragmentReassembler(flowscope#138): RFC 791 keying(src, dst, protocol, id), offset-ordered reassembly, 30 s timeout, per-datagram + concurrent caps, and RFC 5722 overlap handling — overlapping fragments drop the whole datagram and incrementoverlaps()(itself a teardrop/evasion IOC). Transport-agnosticpush+push_ipv4. IPv6 fragment-header decode is a documented upstream follow-up.Proposal
MonitorBuilder::reassemble_ip_fragments(bool)(default off — hot path pays nothing): in the run loop / flow streams, divert fragments into the reassembler and feed the reassembled datagram to the tracker/L7 path in place of the fragments.overlaps()— overlapping fragments on a modern network are almost always hostile.CaptureTelemetry/metrics so a fragment flood can't silently balloon state (interacts with #54 load-shedding).Scope notes
Status (0.29.0): building block landed, hot-path wiring deferred.
flowscope 0.22 (#132, done) ships
ip_fragment::IpFragmentReassemblerwith a cleanpush_ipv4(&Ipv4Slice, now) -> Option<Vec<u8>>API (+ overlap/timeout/oversize counters and RFC 5722 overlap detection). That's the reassembly engine this issue needs.The remaining work is genuinely hot-path and needs live/pcap validation, so it stays open rather than landing unvalidated:
track_intosites (live + replay), feeding fragments to the reassembler and swapping the tracker input (not taps/subs — those keep wire truth) for the reassembled datagram.kernel_prefilter()when armed (the cBPF port compiler currently drops non-first fragments), with the XDP.oport-map caveat documented.ip_fragment_overlapWarning anomaly per overlap +netring_ip_frag_*metrics.Strongest acceptance test (planned): a fragmented DNS response that parses only when reassembly is armed, with an off-by-default control. Deferred because this sandbox can't exercise the AF_PACKET/live path (see the 0.29.0 CHANGELOG 'Deferred' note).