Commit Graph

827 Commits (4a59eba35bfa56ec7903aec1efa8cb414fb462d7)

Author SHA1 Message Date
Jeff Lucovsky 4a59eba35b
Merge b05dfe3318 into 9a37bb659b 1 day ago
Samaresh Kumar Singh e886d2d030 source/netmap: fix multi-slot packet over-read
A packet that netmap delivers across several ring slots was handed to the
rest of the code as the first slot buffer together with the summed length
of all the slots. When those slot buffers were not next to each other in
memory this read past the first buffer, which could crash the process or
leak bytes from unrelated buffers into inspection, pcap output and IPS or
tap forwarding.

Multi-slot packets are now copied slot by slot into a per-thread buffer so
the caller always gets one addressable frame, and such packets are always
copied into the Packet instead of being referenced zero-copy. Single-slot
packets keep the zero-copy path. The walk over the fragment slots is bounded
by the slots we own and the total length is capped, so a broken or over-long
chain is dropped as one unit and the ring keeps moving forward.

Adds unit tests that build a fake ring and cover single-slot, adjacent,
non-adjacent, ring-wrap, empty-fragment, over-size and never-ending chains.

Ticket: #8777
5 days ago
Philippe Antoine a8e0300f90 fuzz: add target for datasets
Ticket: 3590
4 weeks ago
Philippe Antoine ecb1179b27 util: remove memrchr
As its only usage got rustified
4 weeks ago
Jeff Lucovsky fc3f49b692 detect: add content-inspection engine tracing
Add an optional, human-readable trace of the content-inspection engine. For
each keyword evaluated against a buffer it prints the signature, the keyword
and its parameters, and -- on a match or definitive no-match -- a hexdump of
the buffer windowed around the current inspection offset (via the shared
PrintRawDataFp helper). It answers "why did (or didn't) this rule match?".

The whole facility lives in detect-engine-inspect-trace.{c,h} and is reached
from DetectEngineContentInspection through the DETECT_TRACE_* macros, which
expand to nothing unless built with --enable-detect-trace. Even then it stays
silent until enabled at runtime with the SURICATA_DETECT_TRACE environment
variable, so a trace-enabled build costs only a single predictable branch per
keyword when tracing is off.

content values are rendered from the parsed DetectContentData rather than by
re-parsing the signature, keeping the tracer off the hot path's allocator.
2 months ago
Yash Datre 398687d5d4 detect: add tcp.session keyword for unified TCP lifecycle matching
Introduce the tcp.session: keyword that accepts a comma-separated subset
of {setup, established, closing} and matches packets whose TCP session
state falls within the named phases.

This lets a rule writer cover the full TCP lifecycle in one rule instead
of separate flow:not_established + flow:established rules.

Changes:
- New detect-tcp-session.{c,h} with parser, match function, unit tests
- Register DETECT_TCP_SESSION in detect-engine-register.{c,h}
- Add to Makefile.am source list
- Extend engine-analyzer text output for tcp.session:
- Extend firewall.json keyword_info with tcp_session phase values
- Update flow-keywords.rst documentation
- Require TCP protocol and SIG_FLAG_REQUIRE_PACKET at setup

Ticket: 7704
2 months ago
Philippe Antoine dee0f03db4 detect/modbus: move modbus keyword to rust
Ticket: 3195
3 months ago
Philippe Antoine 3e70a79ed2 detect/nfs: move nfs.version to rust
Ticket: 3195
3 months ago
Philippe Antoine a81031591e detect/krb5: move krb5.ticket_encryption to rust
Ticket: 8648
4 months ago
Philippe Antoine 8f0dbc0b63 detect/krb5: move krb5.cname and krb5.sname to rust
Ticket: 8648
4 months ago
Philippe Antoine 3327cf42f0 detect/krb5: move krb5_err_code to rust
Ticket: 8648

Make it a generic integer on the way
4 months ago
Abhijeet Singh 28b10fb042 util/log: rotate log file periodically
Fix log file not rotating during zero traffic periods by triggering rotation logic every second

Ticket: https://redmine.openinfosecfoundation.org/issues/8115
5 months ago
Giuseppe Longo dc44447ce6 detect/sctp: add sctp.chunk_data sticky buffer
Add a sctp.data sticky multi-buffer that allows content matching on the bytes
inside any of the SCTP DATA chunks extracted.

Ticket #4251
5 months ago
Giuseppe Longo 2116c3cafc detect/sctp: add sctp.vtag keyword
Add a U32 numeric keyword to match the SCTP verification tag
from the common header with prefilter support.

Ticket #4251
5 months ago
Giuseppe Longo 855f49b649 detect/sctp: add sctp.chunk_cnt keyword
Add a U8 numeric keyword to match the number of SCTP chunks
parsed in a packet with prefilter support.

Ticket #4251
5 months ago
Giuseppe Longo 88f17d7b20 detect/sctp: add sctp.chunk_type keyword
Add a U8 numeric keyword to match the first SCTP chunk type in a packet
with prefilter support.

Ticket #4251
5 months ago
Giuseppe Longo bbd0ecb616 detect/sctp: add sctp.hdr sticky buffer
Implement a sticky buffer to match the raw SCTP header
(common header + chunks)

Ticket #4251
5 months ago
Philippe Antoine 567e824e44 fuzz: add target for iprep
Ticket: 3589
5 months ago
Jason Ish 6687618b67 misc: remove log-cf-common
It was only used to http-log which is now removed.
5 months ago
Jason Ish 865b7243a0 http-log: remove support for http-log
http-log was deprecated in Suricata 8, and marked for removal in
Suricata 9.0.

Ticket: #7232
5 months ago
Giuseppe Longo 8f205bb34f llmnr: implement logger
This adds an LLMNR protocol logger that reuses existing DNS functions,
following the same approach as the mDNS logger:

- No grouped logging
- Rdata is logged in a field that is named after the rdata type
- Types are logged in lower case
- Flags are logged as an array

Ticket #8366
5 months ago
Victor Julien ad1459df72 threads: add threadvars allocator and free func
Mostly meant to help unittests and fuzz targets alloc the storage
correctly.
5 months ago
Philippe Antoine 87db89ea4e fuzz: extend fuzz_siginit to do engine-rule-analysis 5 months ago
Jason Ish 899e9f045e ntp: expose logged fields to lua
This includes:
- version
- mode
- stratum
- reference_id

Ticket: #8533
6 months ago
Philippe Antoine b0e63a2c95 detect/dcerpc: move stub_data keyword to rust
Ticket: 8391
6 months ago
Philippe Antoine ef884b009a detect/dcerpc: move dcepayload unit tests to SV
Ticket: 8391
6 months ago
Philippe Antoine 4fc6ca5d6c detect/dcerpc: move iface keyword to rust
Ticket: 8391

Use same buffer dce_generic as for dcerpc.opnum
(name dce_generic is enforced by a SV test currently)
6 months ago
Philippe Antoine 67379b009a detect/dcerpc: move opnum keyword to rust
Ticket: 8391
6 months ago
Philippe Antoine 512bbe4de8 detect/template: merge template and template2
Ticket: 7278

Do a single packet match template merging best of both current
templates
7 months ago
Victor Julien 61a7f47a69 detect: add ether.hdr keyword
Sticky buffer to inspect the ethernet header.

Example rule:

        alert ether any any -> any any ( \
                ether.hdr; content:"|08 06|"; offset:12; depth:2; \
                sid:1;)

Ticket: #8327.
7 months ago
Philippe Antoine 267c3baff7 rust/ffi: move STREAM_ constants to ffi crate
Ticket: 7666

reexport them in suricata crate
cbindgen them to C
7 months ago
Victor Julien e916fc3ba4 detect: add igmp.type keyword 8 months ago
Victor Julien 6a1389acff detect: add igmp.hdr keyword 8 months ago
Victor Julien 1b7cc2b323 decoder/igmp: initial decoder support for IGMP
Basic v1, v2 and v3 header validation.

Ticket: #8262.
8 months ago
Philippe Antoine d5ea973791 detect/ike: move ike.ike.chosen_sa_attribute keyword to rust
Ticket: 8310

And increases expressivity on the way by supporting other modes
than equality
8 months ago
Philippe Antoine 55333a6ca0 detect/ike: move ike.vendor keyword to rust
Ticket: 8310
8 months ago
Philippe Antoine 14edd66494 detect/ike: move ike.nonce_payload keyword to rust
Ticket: 8310
8 months ago
Philippe Antoine d1213e4440 detect/ike: move ike.key_exchange_payload keyword to rust
Ticket: 8310
8 months ago
Philippe Antoine f23169c924 detect/ike: move ike.nonce_payload_length keyword to rust
Ticket: 8310
8 months ago
Philippe Antoine e85bf5be4d detect/ike: move ike.key_exchange_payload_length keyword to rust
Ticket: 8310
8 months ago
Philippe Antoine 841fe44f34 detect/ike: move ike.exchtype keyword to rust
Ticket: 8310
8 months ago
Philippe Antoine 23032ebc65 detect/ike: move ike spi keywords to rust
Ticket: 8310
8 months ago
Ofer Dagan e1f9d8a067 pcap: refactor delete-when-done to support non-alerts
Refactor pcap file deletion to use a single delete-when-done option
with three values instead of separate boolean options:
- false (default): No deletion
- true: Always delete files
- "non-alerts": Delete only files with no alerts

Also account for alerts produced by pseudo packets (flow timeout / shutdown flush):
- Introduce small capture hooks and invoke on pseudo-packet creation so the
  capture layer can retain references and observe alerts emitted after the last
  live packet
- Call the hook from both TmThreadDisableReceiveThreads and TmThreadDrainPacketThreads

Key changes:
- Replace should_delete/delete_non_alerts_only bools with enum
- Move alert counter from global to per-file PcapFileFileVars
- Relocate alert counting from PacketAlertFinalize to pcap module
- Ensure thread safety for both single and continuous pcap modes
- Add unit tests for configuration parsing and pseudo-packet alert path

The --pcap-file-delete command line option overrides YAML config
and forces "always delete" mode for backward compatibility.

Documentation updated to reflect the new three-value configuration.

Fixes OISF#7786
8 months ago
Philippe Antoine 536242341b detect/smb: move smb.version keyword to rust
Ticket: 8267
9 months ago
Philippe Antoine 697c641400 detect/smb: move smb share and named_pipe keywords to rust
Ticket: 8267
9 months ago
Philippe Antoine 667f8b2eb7 detect/smb: move smb ntlmssp keywords to rust
Ticket: 8267
9 months ago
Philippe Antoine 9a52bbcbe9 detect/quic: move quic.cyu.hash to rust
Ticket: 8255
9 months ago
Philippe Antoine 01610aabe7 detect/quic: move quic.cyu.string to rust
Ticket: 8255
9 months ago
Philippe Antoine ee4d4a14d5 detect/quic: move quic.ua to rust
Ticket: 8255
9 months ago
Philippe Antoine 9ba9fdcb87 detect/quic: move quic.sni to rust
Ticket: 8255
9 months ago