Project

General

Profile

Actions

Bug #9444

open
VJ VJ

detect/frame: in IDS mode, frame chunking doesn't work

Bug #9444: detect/frame: in IDS mode, frame chunking doesn't work

Added by Victor Julien about 3 hours ago. Updated about 3 hours ago.

Status:
In Review
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

In IDS mode, SetupStreamCallbackData() (src/detect-engine-frame.c, lines 504-530 on main 5c7787ed6) holds back the inspection of an open or incomplete frame until 2500 more bytes are available:

const uint64_t usable = StreamDataRightEdge(stream, eof);
...
uint64_t want = frame->inspect_progress;
if (frame->len == -1) {
    ...
        want += 2500;
...
const uint64_t have = usable;
if (!ips && have < want) {
    return false;
  • usable is an absolute stream offset.
  • frame->inspect_progress is relative to the frame start. BufferSetup() sets it from the frame-relative fo_inspect_offset + data_len, and line 541 uses it as frame->offset + frame->inspect_progress.
  • So want is short by frame->offset. For a frame at offset O, inspection runs once 2500 - O new bytes are available. For a frame at or past offset 2500, it runs on every packet that updates the app-layer.
  • Each run inspects the new data, so a content match in every new chunk alerts again.
  • The complete-frame branch of the same function already uses an absolute value (want = frame->offset + frame->len, line 520).

IPS mode is not affected: it skips this check (!ips) and inspects a sliding window by design.

Effects

  • Alerts per segment: a frame rule alerts once per segment, instead of once per 2500 bytes, on any frame that stays open while the parser consumes data and that starts past offset 2500. For example, the smtp.data frame of every message after the first one in a session.
  • Inspection work: the same frames are inspected on every packet.

Subtasks 1 (1 open — 0 closed)

Bug #9445: detect/frame: in IDS mode, frame chunking doesn't work (8.0.x backport)AssignedVictor JulienActions

Related issues 1 (1 open — 0 closed)

Related to Suricata - Bug #9446: eve/frame: slide accounting error caused missed recordsIn ReviewVictor JulienActions

OT Updated by OISF Ticketbot about 3 hours ago Actions #1

  • Subtask #9445 added

OT Updated by OISF Ticketbot about 3 hours ago Actions #2

  • Label deleted (Needs backport to 8.0)

VJ Updated by Victor Julien about 3 hours ago Actions #3

  • Related to Bug #9446: eve/frame: slide accounting error caused missed records added

VJ Updated by Victor Julien about 3 hours ago Actions #4

  • Status changed from In Progress to In Review
Actions

Also available in: PDF Atom