Commit Graph

17830 Commits (master)
 

Author SHA1 Message Date
Victor Julien e62eb00459 doc/userguide: add ips chapter; add concept
Move setup guides into the new chapter as well.

Explain `stream.inline` logic.

Ticket: #5513.
Ticket: #6284.
2 days ago
Philippe Antoine 9146fc8957 doc: upgrade note about keyword tls.cert_subject
Following commit 5379b52af2
rules that use multiple times the keyword tls.cert_subject
will result in

Warning: detect: duplicate instance for tls.cert_subject

These rules likely meant to use a multi-buffer which is not the
case for tls.cert_subject (even if it was documented so).

Ticket: 7890

This is put in a new section of upgrade notes for
upgrading to 8.0.1
2 days ago
Juliana Fajardini 27e165f760 doc/rules/index: keep rule types doc near the end
As this chapter is more meta than about rule keywords, keep it by the
end of the index, to have some semantic separation from the other
sections.
3 days ago
Juliana Fajardini d5810a42e1 userguide: document how suricata processes rules
Added a page that explains how rules are prioritized by Suri, as well
as what main different types of inspection happen and what elements are
involved when ordering rules.

Task #5449
3 days ago
Victor Julien 39dfcaf1b3 unix-socket: address scan-build warning
CC       unix-manager.o
unix-manager.c:258:13: warning: Use of memory after it is freed [unix.Malloc]
  258 |         if (item->fd == fd) {
      |             ^~~~~~~~
1 warning generated.
3 days ago
Victor Julien f963c408bd unix-socket: fix memory leak on client disconnect
If a client loses the connection during a reload it initiated there is
a small memory leak.

Bug: #7891.
3 days ago
Philippe Antoine 266809a0f2 ci: check json schema sets always additionalProperties
Even if it is set to true.
Avoids forgetting adding fields and thinking it is tested
3 days ago
Philippe Antoine 2028a3f9f8 doc: complete json schema with integer keywords 3 days ago
Philippe Antoine f1f32a39ee doc: enforce more the completenes of json schema
see jq 'paths( objects | (.type == "object" and (has("additionalProperties") | not) )) | join(".")' etc/schema.json

fix and complete bittorrent on the way
3 days ago
Philippe Antoine 421fb8ac31 doc/ldap: complete json schema 3 days ago
Shivani Bhardwaj b21f737aee doc: add doc on internals of inspection of raw data
Explain briefly the internals of inspection of raw data in the following order:
- Stream Engine
- Stream reassembly
- Role of Detection Engine and Applayer Parsers
- High level communication between Stream and Detection Engine
- Relevant suricata.yaml settings

alongwith some diagrams.

Ticket 4351
3 days ago
Shivani Bhardwaj 9ed5ac7669 doc: make firewall table names consistent 1 week ago
Shivani Bhardwaj 7fec1883cd doc: add more info to firewall design
Add information about:
- available tables, default policies and rule ordering
- Packet layer and applayer tables and hooks
- engine analysis output
- commandline options available
- how to load firewall rules

Also, reorganize sections and content to assist the definitions.
1 week ago
Shivani Bhardwaj 5820b52b0a detect: remove redundant fw rule path log 1 week ago
Victor Julien f333a528f3 stream: workaround scan-build warnings
stream-tcp.c:1938:16: warning: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'tail') [core.NullDereference]
 1938 |     tail->next = old_head;
      |     ~~~~       ^
1 warning generated.

stream-tcp.c:1982:5: warning: Potential leak of memory pointed to by 'q' [unix.Malloc]
 1982 |     ssn->queue_len++;
      |     ^~~
1 warning generated.
1 week ago
Victor Julien d352b75ac6 stream: add more liberal timestamp behavior in 3WHS
RFC 7323 forbids a server to respond with a timestamp option in the
SYN/ACK when the SYN didn't have a timestamp option:

   A TCP MAY send the TSopt in an initial <SYN> segment (i.e., segment
   containing a SYN bit and no ACK bit), and MAY send a TSopt in
   <SYN,ACK> only if it received a TSopt in the initial <SYN> segment
   for the connection.

   Once TSopt has been successfully negotiated, that is both <SYN> and
   <SYN,ACK> contain TSopt, the TSopt MUST be sent in every non-<RST>
   segment for the duration of the connection, and SHOULD be sent in an
   <RST> segment (see Section 5.2 for details).

However, in the real world this pattern happens on benign traffic. This
would lead to missing logs and detection, and in IPS mode such sessions
would be blocked.

This patch allows this pattern when the `stream.liberal-timestamps` is
enabled (enabled by default).

Bug #4702.
1 week ago
Victor Julien be6315dba0 stream: improve SYN and SYN/ACK retransmission handling
Take SEQ and ACK into account for more scenarios.

SYN on SYN_SENT

In this case the SYN packets with different SEQ and other properties are
queued up. Each packet updates the ssn to reflect the last packet to
come in. The old ssn data is added to a TcpStateQueue entry in
TcpSession::queue. If the max queue length is exceeded, the oldest entry
is evicted. The queue is actually a single linked list, where the list
head reflects the oldest entry.

SYN/ACK on SYN_SENT

In this case the first check is if the SYN/ACK matches the session. If
it doesn't, the queue is checked to see if there SYN's stored. If one is
found that matches, it is used and the session is updated to reflect
that.

SYN/ACK on SYN_RECV

SYN/ACK resent on the SYN_RECV state. In this case the ssn is updated
from the current packet. The old settings are stored in a TcpStateQueue
entry in the TcpSession::queue.

ACK on SYN_RECV

Checks any stored SYN/ACKs before checking the session. If a queued
SYN/ACK was sound, the session is updated to match it.

Ticket: #3844.
Ticket: #7657.
1 week ago
Victor Julien d815d0748c stream: avoid ineffective state bump in TFO
Do not set session state to established, as it is unconditionally
overwritten to syn_recv afterwards.
1 week ago
Victor Julien 49b98ab3bf stream: minor improvement to timestamp debug messages
Add pcap_cnt for easier debugging.
1 week ago
Philippe Antoine 6d52bcbcb1 ci: do not run undefined for clusterfuzzlite
as it takes too long to build
1 week ago
Philippe Antoine b868ee6655 ci: log data at various clusterfuzzlite steps
to investigate slowness of build
1 week ago
Philippe Antoine ea4eb82657 ci: clusterfuzzlite does not need to clone libhtp
as suricata is using libhtp-rs now
1 week ago
Philippe Antoine 74284b2ca9 ci: remove unnecessary packages from clusterfuzzlite
as they were only used on oss-fuzz to build the corpus, and here
we reuse oss-fuzz public corpus
1 week ago
Jeff Lucovsky 17e7387ff4 doc/fileinfo: Document fileinfo context/usage
Issue: 6498
1 week ago
Thomas Winter 0b2dfa2b68 doc: Add upgrade note for ppp changes 1 week ago
Thomas Winter 804ce2ed3c decode/pppoe: CDPCP as a known protocol
Cisco Discovery Protocol Control Protocol may be sent over pppoe.
We should allow it to help network functions.
1 week ago
Thomas Winter 1f5fc68dc4 decode/pppoe: Don't mark expected PPP protos as unsupported
After upgrading from 7.0.6 to 7.0.8, regular ppp packets are getting
dropped when ppp rules in decoder-events.rules were set as drop.
This was caused by commit a8f35806 ("detect: fix decoder only events").
Previously these rules would not be alerted or dropped.

It turns out several PPP protocols in a switch statement were falling
into the PPP_UNSUP_PROTO case. This has always been the case, I assume
the intention was that they don't get further inspected for size and
other decode errors hence unsupported.
But really some of the protocols are fundamentally required for a PPP
connection to take place.

Change some types that we know should be allowed to pass this.

Ticket: 7651
1 week ago
Thomas Winter 498ae6d1fa decode/pppoe: Run clang-format
These files have existing problems which prevent patches from
passing the format check on them.
1 week ago
Jason Ish 0662736167 github-ci: pass CARGO and RUSTC to S-V
S-V needs cargo to build the EVE validator.
2 weeks ago
Jason Ish 6d74656bef rust: respect RUSTC and CARGO env vars like CC
To support alternative cargo and rustc programs (such as cargo-1.82),
respect CARGO and RUSTC environment variables during ./configure much
like CC.

RUSTFMT is also respected as that is required for the tests, and Cargo
can't figure this out like it can for rustc (perhaps a bug in the
packaging).

For cbindgen, we have also have to make sure the cargo environment
variable is set for each invocation.

To build with Ubuntu's Rust 1.82 packaging:

  CARGO=cargo-1.82 RUSTC=rustc-1.82 RUSTDOC=rustdoc-1.82 \
      ./configure

Note that setting RUSTDOC is only required for commands like "make
check" to pass.

Ticket: #7877
2 weeks ago
Jason Ish db945aec83 rust: bindgen requires rustfmt
Bindgen will use rustfmt after generating the bindings, but this will
fail if rustfmt is not installed. Only run bindgen if rustfmt is
installed.
2 weeks ago
Philippe Antoine 5379b52af2 detect/tls: tls.cert_subject is not a multi-buffer
Ticket: 7867
2 weeks ago
Philippe Antoine 0026019dcf doc: complete list of multi-buffers
Ticket: 7867
2 weeks ago
Jason Ish 4d4198dccc rust: update tracing-subscriber
Address https://rustsec.org/advisories/RUSTSEC-2025-0055.
2 weeks ago
Jason Ish 3b9dfe620d rust: pin time crate to 0.3.41
0.3.42 introduces dependencies that require Rust 1.81.
2 weeks ago
dependabot[bot] 88009793cc github-actions: bump actions/download-artifact from 4.3.0 to 5.0.0
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.3.0 to 5.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](d3f86a106a...634f93cb29)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2 weeks ago
dependabot[bot] 2c5c8c6dff github-actions: bump codecov/codecov-action from 5.4.3 to 5.5.0
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.4.3 to 5.5.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](18283e04ce...fdcc847654)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 5.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 weeks ago
dependabot[bot] 362394ac8e github-actions: bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2 weeks ago
dependabot[bot] 55249b7df2 github-actions: bump github/codeql-action from 3.29.5 to 3.30.0
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.5 to 3.30.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.29.5...v3.30.0)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.30.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 weeks ago
Juliana Fajardini 8f9f414866 schema: document stats.detect counters
... that were missing.

Task #7795
2 weeks ago
Philippe Antoine be605ba2de htp: use transactions right get function
Not the VecDeque one

Ticket: 7803
2 weeks ago
Philippe Antoine 08ee3c3447 detect/dsize: define offset in edge case
Ticket: 7802
2 weeks ago
Philippe Antoine 06c82a79ab output/alert-debug: do not return on app-layer
just continue, so that we call aft->file_ctx->Write

Ticket: 4178
2 weeks ago
Philippe Antoine 646c78269a doc/devguide: section with conceptualized steps for adding app-layer
Ticket: 6840
2 weeks ago
Juliana Fajardini 051715a7eb schema/description: capitalize initial letters
For existing descriptions that weren't like that, yet.
3 weeks ago
Juliana Fajardini 1d27e268d1 schema: add descriptions for flow stats counters
Task #7794
3 weeks ago
Tommy Wang fc6b96fb85 doc/lualib: fix wrong tuple section markdown in flowlib
Sections had wrong levels due to wrong markdown.
3 weeks ago
Tommy Wang a10053e62c doc/lualib: fix flow timestamps return value order
Task #7854
3 weeks ago
Shivani Bhardwaj b7866b8043 stream: remove incorrect defensive check
As a part of the commit d096b98 a defensive check was added stating that
the stream must have EOF flag set if it is in TCP_CLOSING state or
above. However, this led to a false positive reported by oss-fuzz whose
analysis showed that this does not hold true for TCP_CLOSING state. It
does hold true only for TCP_CLOSED or if packet has PKT_PSEUDO_STREAM_END
set.
TCP_CLOSING state correspond to an established flow hence the correct
course of action is to remove the assertion.

Bug 7636

Co-authored-by: Philippe Antoine <pantoine@oisf.net>
3 weeks ago
Philippe Antoine d0a513df6a detect/integers: support kibibyte unit
Ticket: 7869
3 weeks ago