Skip to content

SCTP decoder and sticky buffers v7 - #15580

Closed
glongo wants to merge 9 commits into
OISF:mainfrom
glongo:dev-4251-sctp-v7
Closed

SCTP decoder and sticky buffers v7#15580
glongo wants to merge 9 commits into
OISF:mainfrom
glongo:dev-4251-sctp-v7

Conversation

@glongo

@glongo glongo commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Link to ticket: https://redmine.openinfosecfoundation.org/issues/4251

Changes:

  • Renamed init_chunk_not_alone to init_chunk_bundled (as specified in RFC)
  • Added a comment about src/decode-sctp.c#L189 (and added it to the doc)
  • Added more SV tests sctp-keywords-prefilter and sctp-pkt-too-small
  • Added next sid at the end of sctp-events.rules

Previous PR: #15534

SV_BRANCH=OISF/suricata-verify#2999

glongo added 9 commits June 8, 2026 17:13
Extend the SCTP decoder to parse chunk headers after the 12-byte common
header. Each chunk is validated for minimum header size and length
consistency per RFC 4960 sec 3.2.

Add SCTPChunkHdr and SCTPVars structs to track per-packet chunk metadata

Add five new decoder events for protocol violations:
- SCTP_CHUNK_TOO_SMALL: insufficient data for a chunk header
- SCTP_CHUNK_LEN_INVALID: chunk length < 4 or exceeds packet
- SCTP_INIT_CHUNK_NOT_ALONE: INIT/INIT_ACK bundled (RFC 4960 sec 6.10)
- SCTP_INIT_WITH_NON_ZERO_VTAG: INIT with vtag != 0 (RFC 4960 sec 8.5.1)
- SCTP_DATA_WITH_ZERO_VTAG: DATA chunk with vtag == 0

Ticket OISF#4251
Implement a sticky buffer to match the raw SCTP header
(common header + chunks)

Ticket OISF#4251
Add a U8 numeric keyword to match the first SCTP chunk type in a packet
with prefilter support.

Ticket OISF#4251
Add a U8 numeric keyword to match the number of SCTP chunks
parsed in a packet with prefilter support.

Ticket OISF#4251
Add a U32 numeric keyword to match the SCTP verification tag
from the common header with prefilter support.

Ticket OISF#4251
Log SCTP-specific fields in the EVE JSON "sctp" object for alert events.

Ticket OISF#4251
Track the first DATA chunk's data offset and length during chunk iteration,
then reassign p->payload to point at the user data.

When no DATA chunk is present (INIT, SACK, HEARTBEAT, etc.),
payload_len is set to 0 since there is no application data.

Ticket OISF#4251
Add a sctp.data sticky multi-buffer that allows content matching on the bytes
inside any of the SCTP DATA chunks extracted.

Ticket OISF#4251
Add documentation for all sctp keywords.

Ticket OISF#4251
@suricata-qa

Copy link
Copy Markdown

WARNING:

field baseline test %
SURI_TLPW2_single_stats_chk
.decoder.event.sctp.chunk_too_small - 0 -
.decoder.event.sctp.chunk_len_invalid - 0 -
.decoder.event.sctp.init_chunk_bundled - 0 -
.decoder.event.sctp.init_with_non_zero_vtag - 0 -
.decoder.event.sctp.data_with_zero_vtag - 0 -
.decoder.event.sctp.too_many_chunks - 0 -
.decoder.event.sctp.too_many_data_chunks - 0 -
.sctp.init - 0 -
.sctp.init_ack - 0 -
.sctp.data - 0 -
.sctp.abort - 0 -
.sctp.shutdown - 0 -
SURI_TLPW2_autofp_stats_chk
.decoder.event.sctp.chunk_too_small - 0 -
.decoder.event.sctp.chunk_len_invalid - 0 -
.decoder.event.sctp.init_chunk_bundled - 0 -
.decoder.event.sctp.init_with_non_zero_vtag - 0 -
.decoder.event.sctp.data_with_zero_vtag - 0 -
.decoder.event.sctp.too_many_chunks - 0 -
.decoder.event.sctp.too_many_data_chunks - 0 -
.sctp.init - 0 -
.sctp.init_ack - 0 -
.sctp.data - 0 -
.sctp.abort - 0 -
.sctp.shutdown - 0 -
SURI_TLPW1_stats_chk
.decoder.event.sctp.chunk_too_small - 0 -
.decoder.event.sctp.chunk_len_invalid - 0 -
.decoder.event.sctp.init_chunk_bundled - 0 -
.decoder.event.sctp.init_with_non_zero_vtag - 0 -
.decoder.event.sctp.data_with_zero_vtag - 0 -
.decoder.event.sctp.too_many_chunks - 0 -
.decoder.event.sctp.too_many_data_chunks - 0 -
.sctp.init - 0 -
.sctp.init_ack - 0 -
.sctp.data - 0 -
.sctp.abort - 0 -
.sctp.shutdown - 0 -
SURI_TLPR1_stats_chk
.decoder.event.sctp.chunk_too_small - 0 -
.decoder.event.sctp.chunk_len_invalid - 0 -
.decoder.event.sctp.init_chunk_bundled - 0 -
.decoder.event.sctp.init_with_non_zero_vtag - 0 -
.decoder.event.sctp.data_with_zero_vtag - 0 -
.decoder.event.sctp.too_many_chunks - 0 -
.decoder.event.sctp.too_many_data_chunks - 0 -
.sctp.init - 0 -
.sctp.init_ack - 0 -
.sctp.data - 0 -
.sctp.abort - 0 -
.sctp.shutdown - 0 -
IPS_AFP_stats_chk
.decoder.event.sctp.chunk_too_small - 0 -
.decoder.event.sctp.chunk_len_invalid - 0 -
.decoder.event.sctp.init_chunk_bundled - 0 -
.decoder.event.sctp.init_with_non_zero_vtag - 0 -
.decoder.event.sctp.data_with_zero_vtag - 0 -
.decoder.event.sctp.too_many_chunks - 0 -
.decoder.event.sctp.too_many_data_chunks - 0 -
.sctp.init - 0 -
.sctp.init_ack - 0 -
.sctp.data - 0 -
.sctp.abort - 0 -
.sctp.shutdown - 0 -
TREX_GENERIC_stats_chk
.decoder.event.sctp.chunk_too_small - 0 -
.decoder.event.sctp.chunk_len_invalid - 0 -
.decoder.event.sctp.init_chunk_bundled - 0 -
.decoder.event.sctp.init_with_non_zero_vtag - 0 -
.decoder.event.sctp.data_with_zero_vtag - 0 -
.decoder.event.sctp.too_many_chunks - 0 -
.decoder.event.sctp.too_many_data_chunks - 0 -
.sctp.init - 0 -
.sctp.init_ack - 0 -
.sctp.data - 0 -
.sctp.abort - 0 -
.sctp.shutdown - 0 -

Pipeline = 31903

@victorjulien victorjulien added this to the 9.0 milestone Jun 9, 2026
@victorjulien

Copy link
Copy Markdown
Member

This is approved but blocked by the SV test needing some more work.

@glongo

glongo commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

This is approved but blocked by the SV test needing some more work.

SV tests should be good to go now.

@victorjulien

Copy link
Copy Markdown
Member

Merged in #15601, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants