Commit Graph

18755 Commits (c53b9df5a2a0413b1ad7e3def5db6a47174af338)
 

Author SHA1 Message Date
Philippe Antoine c53b9df5a2 rust/ffi: move detection helpers to ffi crate
Ticket: 7666
3 months ago
Philippe Antoine 4f4912c042 rust: bindgen SIGMATCH_ constants 3 months ago
Shivani Bhardwaj 4ec5f22951 ftp: trigger raw stream inspection
Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream inspection which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

FTP parser can handle multiple command lines per direction. Appropriate calls
to trigger raw stream inspection have been added on succesful parsing of each
request line and response line.

Bug 7742
3 months ago
Philippe Antoine 2fa10052cf websocket: check pdu opcode for reassembly
Ticket: 8413

RFC 6455 Section 5.4 states

Control frames (see Section 5.5) MAY be injected in the middle of
a fragmented message.

Control frames are identified by opcodes where the most significant
bit of the opcode is 1.
3 months ago
Philippe Antoine 7b0528d85f http2: set response_frame_size
Ticket: 8410

Do not set only request_frame_size whatever the direction
3 months ago
Victor Julien 6c3169cee0 doc/userguide: add ether and arp to intro 3 months ago
Victor Julien 6298c47145 doc/userguide: improve protocol docs 3 months ago
Victor Julien e6381a3c22 doc/userguide: add note on rule reloads
Cannot be combined with --firewall-rules-exclusive
3 months ago
Victor Julien f99b86beab doc/userguide: document L2 firewall handling of ARP 3 months ago
Victor Julien facbb04915 detect: enable pcre and urilen for firewall mode
Ticket: #8397.
3 months ago
Victor Julien 49b1382a8b qa: add nfq based firewall test with live reload 3 months ago
Victor Julien 7ac32910c9 qa: add rule reload step to firewall test
Additionally, use bsize, pcre and urilen.

Ticket: #8204.
Ticket: #8397.
3 months ago
Victor Julien 1c66eec656 qa: add script to test firewall bridge mode 3 months ago
Victor Julien 2e2132a16f doc/userguide: improve pkthdr docs 3 months ago
Victor Julien 6fbd7483d6 detect/parse: limit pkthdr proto to decoder event rules
`alert pkthdr` was initially just an alias for `alert ip`, as that was
really just a way of stating that "any" should be matched. However with
the Ethernet matching in place, it no long makes sense to treat `alert
ip` as "any". Since `pkthdr` is used to match on decoder events, also
for packets that completely failed to parse, it should no longer be
treated as `alert ip` but rather as it's own distinct logic.
3 months ago
Victor Julien b983ce64ef detect: add track pkthdr as any l2 protocol
To indicate it's not just like `alert ip`.
3 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.
3 months ago
Victor Julien 232276ac19 detect: ethernet/arp matching
Support `alert ether` for matching all ethernet packets.

Add `alert arp` for matching ARP packets.

Ticket: #8313.
3 months ago
Victor Julien d4f005933a detect/proto: reduce size for common sigs
Make `Signature::proto` an optional member, meaning that if it is
NULL we can skip the check. This can be done for `alert ip`, as no check
is needed, and for `alert tcp` and `alert udp` as having a rule in a sgh
for those means that the protocol matches.

Some exceptions are rules that require:
- ipv4/ipv6 specific matching
- frames, due to sharing prefilter between tcp and udp
- ip-only rules, due to those not being per sgh
3 months ago
Victor Julien dc814aa595 detect/frame: set frame flag during init
Allows for quickly checking if sig operates on frames during parsing.
3 months ago
Jason Ish cd9993c568 storage: remove the size registration parameter
With the Alloc callback gone, the size is no longer needed.
3 months ago
Jason Ish f337cd573b storage: remove alloc callback as its unused
Remove the "Alloc" callback from the storage API, it was only being
used in tests without any real usage.
3 months ago
Jason Ish 332f47d557 host/storage: use fail/pass api in unit tests 3 months ago
Jason Ish 31a4381d30 flow/storage: use fail/pass api in unit tests 3 months ago
Eric Leblond e4e5413478 etc/schema: add http_request_body
Ticket: 8161
3 months ago
Eric Leblond 97a0ad342b etc/schema: match on http response body
Matching on the HTTP response body is not really possible as it is
a transformed version that can not be accessed via the signature
language.
3 months ago
Juliana Fajardini 41834f0a05 configure/qa-simulation: explicitly declare default
This is needed to generate the `--build-info` report.

Related to
Ticket #7885
4 months ago
Juliana Fajardini 6f0bb39aaa workflows: add qa-simulation mode
As build flag to (some of the) checks that run suricata-verify:
- AlmaLinux 10 (schema, plugins)
- CentOS Stream 9
- Fedora 43 (Suricata Verify codecov)
- Fedora 43 (clang, debug, asan, wshadow, rust-strict, systemd)
- Fedora 43 (gcc, debug, flto, asan, wshadow, rust-strict)
- Fedora (non-root, debug, clang, asan, wshadow, rust-strict, no-ja)
- Ubuntu 22.04 (Debug Validation)
- Debian 12 (xdp)
- Debian 13 (xdp)
- Debian 12 MSRV
- PF_RING

Related to
Ticket #7885
4 months ago
Juliana Fajardini 17cd814911 workflows: fix minor typo 4 months ago
Philippe Antoine f61247e846 plugin: remove one small suricata crate dependency 4 months ago
Philippe Antoine 267c3baff7 rust/ffi: move STREAM_ constants to ffi crate
Ticket: 7666

reexport them in suricata crate
cbindgen them to C
4 months ago
Philippe Antoine 61c667400b rust: remove obsolete inclusions from cbindgen.toml 4 months ago
Philippe Antoine fd4c6d4e06 rust: remove obsolete struct exclusions in cbindgen
As these structs are now in suricata_sys crate
4 months ago
Philippe Antoine a10a818792 rust: remove obsolete constants exclusion from cbindgen.toml
Completes commit 71b59f6dbe

These const are no longer defined in rust suricata crate
4 months ago
Philippe Antoine efcc7f9dfc ftp: remove PASS pattern for protocol detection
As FTP must have USER before PASS command
unlike IRC which can begin by PASS command

Ticket: 2978
4 months ago
Jason Ish dce2deee5e rust: pin unicode-segmentation crate to 1.12.0
unicode-segmentation (used by rustyline) was updated from 1.12.0 to
1.13.1 earlier and requires a newer version of Rust. Pin to 1.12.0 which
works with Rust 1.75.0.
4 months ago
Jason Ish 3e9c726aa8 etc/schema: remove "optional" field
The optional field has not been valid JSON schema field since we started
using it, so remove it.

All fields are optional unless marked as required.
4 months ago
Philippe Antoine 34ed8958a6 dcerpc: only log the tx interfaces
Not all the state ones

Ticket: 8378
4 months ago
Philippe Antoine 05a11e2897 dcerpc: store persistently contexts
So that we can log and detect on interface uuids, even if
AlterContext packets change one of the contexts, but other contexts
are still used after it in request/responses

Ticket: 8378
4 months ago
Jeff Lucovsky 448915fb55 capture/napatech: 0-pad thread names
Apply zero-padding to Napatech worker threads so alphanumeric sorting
displays workers in proper order.

Set padding for thread names according to stream count:

1-9 streams: no padding, e.g, nt1, nt9
10-99 streams: use padding, e.g, nt01, nt99
100-999 streams: use padding, e.g, nt001, nt099, nt999

This will insure that thread names, when sorted alphanumerically,
maintain thread worker id order.

Issue: 8337
4 months ago
Jeff Lucovsky e7dc0d885b doc/config: Update flushing description
Update output flushing description to reflect EVE based approach in
documentation and config template.

Issue: 8286
4 months ago
Jeff Lucovsky 1923ca1aa0 output/flush: Remove flush functions/registration
Remove log flush functions and update registration logic as
context-based flushing doesn't require it.

Issue: 8286
4 months ago
Jeff Lucovsky d0ba1c4c5e output/flush: Remove pkt-based flush logic
Remove packet-based flush logic in favor of simpler solution

Issue: 8286
4 months ago
Jeff Lucovsky a78911fce7 output/flush: Add EVE flushing logic
Add flushing logic driven off of the file contexts. This is a simpler
solution that removes the need for logger registration changes.

Overview:
Use the heartbeat-driven thread to periodically flush all registered EVE
contexts via a global flush list.

The global flush list is a mutex-protected TAILQ of LogFileFlushEntry
nodes; each node points to a LogFileCtx. Mutex = log_file_flush_mutex

Periodic flushing performed by a thread according to the
heartbeat.output-flush-interval [1,60]. LogFileFlushAll() is invoked to
initiate flushing of registered LogFileCtx structs; each struct's
fp_mutex is obtained while the flush occurs to synchronize with
LogFileWrite activity.

Interacts with file-rotation via the fp_mutex.

Deadlock prevention: the log_file_flush_mutex must be obtained before
the fp_mutex.

Issue: 8286
4 months ago
Philippe Antoine d4c036718a detect/geoip: do not require packet
Ticket: 8333

Allows to pass on pseudo packets

So, that a ruleset like
pass ssh any any -> any any (geoip:any,US,IN; sid: 1;)
drop ip any any -> any any (flow:established, to_server; sid:2;)

Does not lead to a drop on the pseudo-packet when we flush
because ssh traffic gets encrypted
4 months ago
Victor Julien bc4a055e73 github-ci: remove coveralls
Seems less reliable than codecov, so remove again.
4 months ago
Juliana Fajardini c790a9f774 userguide/exceptions: update for qa-simulation use
The docs still referred to ``debug`` mode.

Related to
Task #7885
4 months ago
Juliana Fajardini 56917cf8f3 rules: fix typos & missing keywords in examples
Task #8372
4 months ago
Jason Ish 9cab99fbd3 rust: rust fmt derive crate 4 months ago
Jeff Lucovsky 14ebba6382 gen/unused: Remove unused function
Remove unused function is_alphanumeric_or_slash
4 months ago