Project

General

Profile

Actions

Security #9161

closed
JI JI

defrag: BSD overlap can undo an earlier left trim

Security #9161: defrag: BSD overlap can undo an earlier left trim

Added by Jason Ish about 2 months ago. Updated 7 days ago.

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

c19c0907d4a5b35f9eaa990c0e61e7610de8fa0e

Severity:
LOW
Disclosure Date:
12/27/2026

Description

Hello,

This is a disclosure for a vulnerability in Suricata that was found by Anthropic
using their models and agents. I have reviewed the vulnerability and consider
it to be true according to Suricata's threat model.

BSD defrag policy can undo an earlier trim, so Suricata reassembles different bytes than the target host

TLDR

The vulnerability is that the BSD overlap handling in DefragInsertFrag() in
src/defrag.c overwrites the left-trim (ltrim) of the next fragment instead of
only raising it (lines 694 and 716). A fragment that arrives later can therefore
lower a trim that an earlier fragment already set. This brings back bytes that
should have been replaced. Because reassembly copies fragments in offset order,
those old bytes are copied last and win. The reassembled packet that Suricata
inspects then differs from the one a BSD-style host builds, so an attacker can
hide the bytes a signature looks for. BSD is Suricata's default defrag policy
(default_policy = DEFRAG_POLICY_BSD), and the same code is in main and in the
7.0.x and 8.0.x branches. Both IPv4 and IPv6 use this code.

Root cause

ltrim tells reassembly how many bytes at the start of a stored fragment have
been replaced by other fragments. It must only grow. The prev update at lines
708-713 respects this: it only writes prev_ltrim if it is larger than the
current value. The next update at lines 715-717 (and 693-695) does not. It
always writes frag_end - next->offset, even when next->ltrim is already
larger because of an earlier overlap.

[Editorial omission: detailed trigger analysis, vulnerable code excerpts, and execution dataflow are not reproduced here.]

Suggested fix

Make the next update work like the prev update, so it only ever raises the
trim. Apply this at both places (lines 693-695 and 715-717):

if ((next != NULL) && (frag_end > next->offset)) {
uint16_t next_ltrim = frag_end - next->offset;
if (next_ltrim > next->ltrim) {
next->ltrim = next_ltrim;
}
}

[Editorial omission: the specific fragment sequence requested for the unit test is not reproduced here.]

Reproducer (suricata-verify test)

[Editorial omission: operational reproducer details and execution instructions are not reproduced here. The source report includes test.yaml, test.rules, suricata.yaml, and input.pcap.]

Disclosure

This report follows a 90-day coordinated disclosure deadline. I'm happy to
coordinate on the exact timing and to provide any further detail you need.

Attribution

Please attribute Anthropic and Ada Logics. This issue was found by Anthropic
by using agents to study security of open source projects, and I have helped
validate the found issue, create the report and communicate it to you.


Subtasks 1 (0 open — 1 closed)

Security #9164: defrag: BSD overlap can undo an earlier left trim (8.0.x backport)ClosedJason IshActions

Related issues 1 (0 open — 1 closed)

Related to Suricata - Security #9160: defrag: bsd policy only trims the immediate right neighbourClosedJason IshActions

JI Updated by Jason Ish about 2 months ago Actions #1

  • Description updated (diff)

JI Updated by Jason Ish about 2 months ago Actions #2

  • Status changed from New to Assigned
  • Assignee changed from OISF Dev to Jason Ish
  • Target version changed from TBD to 9.0.0-beta1
  • Label Needs backport to 8.0 added

JI Updated by Jason Ish about 2 months ago Actions #3

  • Related to Security #9160: defrag: bsd policy only trims the immediate right neighbour added

OT Updated by OISF Ticketbot about 2 months ago Actions #4

  • Subtask #9164 added

OT Updated by OISF Ticketbot about 2 months ago Actions #5

  • Label deleted (Needs backport to 8.0)

JI Updated by Jason Ish about 2 months ago Actions #6

  • Status changed from Assigned to In Review

JI Updated by Jason Ish about 2 months ago · Edited 1Actions #7

  • Severity set to LOW

Recommendations:

Severity:

│ Low, CVSS 3.1 3.7 (AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N), CWE-437.
│ Limited to evasion of payload inspection; the required fragment overlap is
│ still detected and alerted on by the decoder event rules (sid 2200070/2200072).

Impact:

│ With the BSD defrag policy (default), a later overlap could lower an existing
│ fragment trim, restoring replaced data, so crafted IPv4/IPv6 fragments can
│ make Suricata inspect different data than the host reassembles, evading rules.

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

  • GHSA set to GHSA-g479-hvv2-45w7

JI Updated by Jason Ish 25 days ago Actions #9

  • Git IDs updated (diff)

JI Updated by Jason Ish 25 days ago Actions #10

  • Status changed from In Review to Closed

JI Updated by Jason Ish 7 days ago Actions #11

  • Private changed from Yes to No
Actions

Also available in: PDF Atom