Project

General

Profile

Actions

Security #9099

closed
PA PA

tcp: reassembly overlap check misses a non-adjacent predecessor

Security #9099: tcp: reassembly overlap check misses a non-adjacent predecessor

Added by Philippe Antoine 2 months ago. Updated 7 days ago.

Status:
Closed
Priority:
Normal
Target version:
Affected Versions:
Label:
CVE:
Git IDs:

0a6224a31cefdd960f5d7c0c65d26d8147563148

Severity:
MODERATE
Disclosure Date:
12/17/2026

Description

Original report

We would like to report a detection-evasion issue in TCP stream reassembly overlap
handling, present in the shipped default configuration of current main and the 7.0.x /
8.0.x branches. A self-contained Docker reproducer is attached as ANT-2026-NVCQH2RV-e2e.zip.

This issue was found by Anthropic using Claude to study the security of open-source software,
and validated by me from Ada Logics. 

== AFFECTED COMPONENT ==

  src/stream-tcp-list.c  CheckOverlap()  (line 124 at HEAD) and
                         DoHandleDataCheckBackwards()  (line ~424 at HEAD)
  current main HEAD d996d85dcfbf1349acf54d942abc86a13f9e699f (re-gated 2026-09-17)

  src/stream-tcp-list.c is byte-unchanged on main between our first analysis at 928ac012
  and this HEAD, and the same code is on main-8.0.x and main-7.0.x.

== ROOT CAUSE ==

CheckOverlap() decides whether a newly inserted TCP segment overlaps existing data. Its
backwards test examines exactly ONE predecessor in the segment RB-tree:

    /* src/stream-tcp-list.c -- CheckOverlap(), backwards test */
    TcpSegment *prev = TCPSEG_RB_PREV(seg);
    if (prev) {
        if (SEQ_EQ(prev->seq, seg->seq)) return true;
        const uint32_t prev_re = SEG_SEQ_RIGHT_EDGE(prev);
        if (SEQ_GT(prev_re, seg->seq)) return true;
    }

The RB-tree is keyed on (seq, payload_len) (TcpSegmentCompare), not as an interval tree, so
an earlier-STARTING segment that COVERS the new segment's whole range can sit arbitrarily
far back in tree order. Only the immediate predecessor is checked; the maximum right edge of
all predecessors is not tracked per node, and stream->segs_right_edge (which IS maintained
in DoInsertSegment()) is not consulted here.

An attacker exploits this by inserting a small "shield" segment whose (seq,len) sorts
between a large already-received segment A and a later segment C, such that the immediate
predecessor of C is the shield (which does NOT reach C) rather than A (which does). C's
overlap with A is then never detected. The same neighbour-local assumption is repeated in
DoHandleDataCheckBackwards(), whose `break` treats "this predecessor does not reach me" as
"no earlier predecessor can reach me either" -- false for the same reason -- so even a
corrected CheckOverlap() would still stop at the shield.

Result: C silently overwrites A's already-reassembled content with no
tcp.overlap_diff_data counter and no "reassembly overlap with different data" event, so a
signature that matched the original bytes is evaded while the destination host (which keeps
its first-received data under Suricata's own configured overlap policy) sees the original.

== IMPACT / SEVERITY ==

Detection evasion via silent stream-content overwrite (CWE-693 protection-mechanism failure
in TCP reassembly). An unauthenticated remote endpoint (or on-path injector) inserts one
segment that is byte-identical to data it already sent -- an ordinary-looking retransmission
-- and thereby replaces already-reassembled content without raising the overlap event that
normally flags this. Tier 1, default-enabled (stream reassembly is always on). No crash or
memory-safety issue. We read this as HIGH under your rubric (traffic-triggered evasion in a
Tier 1 default) but defer the rating to you.

== REPRODUCTION ==

Attached ANT-2026-NVCQH2RV-e2e.zip is self-contained:

    unzip ANT-2026-NVCQH2RV-e2e.zip && cd ANT-2026-NVCQH2RV
    docker build -t ant-nvcqh2rv docker-e2e/
    docker run --rm ant-nvcqh2rv

It builds Suricata at ${TARGET_COMMIT} (default: main HEAD d996d85d) and runs three pcaps:
`control` (A then C -> overlap event + counters fire), `attack` (A, shield S, then C -> C's
overlap is missed, no tcp.overlap_diff_data, marker signature evaded), and `shield` (control
that the marker is otherwise present). Build at another commit with
`--build-arg TARGET_COMMIT=<sha>`.

== VALIDATED EVIDENCE (re-run at HEAD d996d85d, 2026-09-17) ==

Suricata built from OISF/suricata at HEAD d996d85d (version string "9.0.0-dev
(d996d85dc 2026-09-12)"). Three pcaps carry the identical marker payload and differ
only in the presence of the 10-byte "shield" segment S (seq=1020), whose bytes are
identical to what the covering segment A already sent:

  case                       marker alerts   tcp.overlap   tcp.overlap_diff_data
  control (A, then C)                1             1                  1
  attack  (A, shield S, C)           0             0                  0
  shield  (A, then S only)           1             -                  -

  (Run twice: once with default stream.reassembly config, once with
   check-overlap-different-data=true; both columns above hold in both runs -- the
   attack fires NO overlap event and NO overlap_diff_data counter in either mode.)

Verdict: EVASION CONFIRMED. The only difference between control.pcap and attack.pcap
is the 10-byte shield segment S at seq=1020, which sorts as C's immediate RB-tree
predecessor and does NOT reach C. In control, C's overlap with A is detected: the
"reassembly overlap with different data" event fires and tcp.overlap_diff_data is
incremented, and the marker signature (which matched A's original bytes) alerts. In
attack, C silently overwrites A's already-reassembled content: no overlap event, no
tcp.overlap_diff_data, and the marker signature is evaded (0 alerts). The `shield`
control shows S on its own does not suppress the marker, so the evasion comes from the
CheckOverlap()/DoHandleDataCheckBackwards() predecessor-only test, not from S itself.

== DISCLOSURE ==

Found by Anthropic using Claude to study the security of open-source software, validated
manually by Ada Logics. Handled under Anthropic's coordinated vulnerability disclosure
policy (90 days): https://www.anthropic.com/coordinated-vulnerability-disclosure. Please
keep this private per your usual timeline. If you publish a GHSA, please credit Claude
(Anthropic) and Ada Logics.

Kind regards,
David

Proposing HIGH severity as a generic TCP evasion


Subtasks 1 (0 open — 1 closed)

Security #9100: tcp: reassembly overlap check misses a non-adjacent predecessor (8.0.x backport)ClosedPhilippe AntoineActions

OT Updated by OISF Ticketbot 2 months ago Actions #1

  • Subtask #9100 added

OT Updated by OISF Ticketbot 2 months ago Actions #2

  • Label deleted (Needs backport to 8.0)

PA Updated by Philippe Antoine 2 months ago Actions #3

Looks like the problem is inserting in the RB tree the 2nd packet

PA Updated by Philippe Antoine 2 months ago Actions #4

  • Status changed from New to Triaged

SV test in GL

PA Updated by Philippe Antoine about 2 months ago Actions #6

  • Status changed from Triaged to In Review
  • Assignee changed from OISF Dev to Philippe Antoine

POC gitlab MR

JI Updated by Jason Ish about 1 month ago Actions #7

  • GHSA set to GHSA-qr82-h9qv-fj9h

SB Updated by Shivani Bhardwaj about 1 month ago Actions #8

  • Subject changed from TCP reassembly overlap check misses a non-adjacent predecessor to tcp: reassembly overlap check misses a non-adjacent predecessor

JI Updated by Jason Ish about 1 month ago Actions #9

  • Severity changed from HIGH to MODERATE

Reclassifying TCP bypasses to MODERATE.

PA Updated by Philippe Antoine 25 days ago Actions #10

  • Status changed from In Review to Resolved

staged

JI Updated by Jason Ish 25 days ago Actions #11

  • Git IDs updated (diff)

PA Updated by Philippe Antoine 25 days ago Actions #12

  • Status changed from Resolved to Closed

JI Updated by Jason Ish 7 days ago Actions #13

  • Private changed from Yes to No
Actions

Also available in: PDF Atom