Commit Graph

17968 Commits (2848061d0dfc26a2c5d68a75c32bc5c51caed228)
 

Author SHA1 Message Date
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.
2 months ago
Shivani Bhardwaj 5820b52b0a detect: remove redundant fw rule path log 2 months 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.
2 months 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.
2 months 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.
2 months 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.
2 months ago
Victor Julien 49b98ab3bf stream: minor improvement to timestamp debug messages
Add pcap_cnt for easier debugging.
2 months ago
Philippe Antoine 6d52bcbcb1 ci: do not run undefined for clusterfuzzlite
as it takes too long to build
2 months ago
Philippe Antoine b868ee6655 ci: log data at various clusterfuzzlite steps
to investigate slowness of build
2 months ago
Philippe Antoine ea4eb82657 ci: clusterfuzzlite does not need to clone libhtp
as suricata is using libhtp-rs now
2 months 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
2 months ago
Jeff Lucovsky 17e7387ff4 doc/fileinfo: Document fileinfo context/usage
Issue: 6498
2 months ago
Thomas Winter 0b2dfa2b68 doc: Add upgrade note for ppp changes 2 months 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.
2 months 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
2 months ago
Thomas Winter 498ae6d1fa decode/pppoe: Run clang-format
These files have existing problems which prevent patches from
passing the format check on them.
2 months ago
Jason Ish 0662736167 github-ci: pass CARGO and RUSTC to S-V
S-V needs cargo to build the EVE validator.
2 months 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 months 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 months ago
Philippe Antoine 5379b52af2 detect/tls: tls.cert_subject is not a multi-buffer
Ticket: 7867
2 months ago
Philippe Antoine 0026019dcf doc: complete list of multi-buffers
Ticket: 7867
2 months ago
Jason Ish 4d4198dccc rust: update tracing-subscriber
Address https://rustsec.org/advisories/RUSTSEC-2025-0055.
2 months ago
Jason Ish 3b9dfe620d rust: pin time crate to 0.3.41
0.3.42 introduces dependencies that require Rust 1.81.
2 months 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 months 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 months 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 months 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 months ago
Juliana Fajardini 8f9f414866 schema: document stats.detect counters
... that were missing.

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

Ticket: 7803
3 months ago
Philippe Antoine 08ee3c3447 detect/dsize: define offset in edge case
Ticket: 7802
3 months 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
3 months ago
Philippe Antoine 646c78269a doc/devguide: section with conceptualized steps for adding app-layer
Ticket: 6840
3 months ago
Juliana Fajardini 051715a7eb schema/description: capitalize initial letters
For existing descriptions that weren't like that, yet.
3 months ago
Juliana Fajardini 1d27e268d1 schema: add descriptions for flow stats counters
Task #7794
3 months ago
Tommy Wang fc6b96fb85 doc/lualib: fix wrong tuple section markdown in flowlib
Sections had wrong levels due to wrong markdown.
3 months ago
Tommy Wang a10053e62c doc/lualib: fix flow timestamps return value order
Task #7854
3 months 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 months ago
Philippe Antoine d0a513df6a detect/integers: support kibibyte unit
Ticket: 7869
3 months ago
Philippe Antoine be9858d3aa detect/integers: document usage of units
Ticket: 7190
3 months ago
Philippe Antoine 287b1323ba detect/integer: support missing modes for u8 prefilter
Ticket: 7865

<=, >=, and != were missing

Also warns if an unimplemented mode is tried
3 months ago
Philippe Antoine 2a17ab6d88 http: generate no anomaly for identity encoding
Ticket: 7843
3 months ago
Theo Buehler 315844ccd8 docs: fix deprecated inclusion of rtd theme path
Since userguide/conf.py uses the deprecated get_html_theme_path(),
sphinx emits a warning which breaks the build as warnings are treated
as errors.

Issue: 7859
3 months ago
Charlie Vigue 84145e212d util: Fix a hash table collision bug
In util-hash.c there was some behavior that is unexpected and likely
incorrect. To see this behavior, create a hash table 32 entries wide
and use the default hash function. Then add a short string “abc”,
observe the string is stored properly. Now remove a string “iln”, and
observe string “abc” is no longer in the table.

This is because the hash function is not properly handling collisions in
some edge cases.

Includes new unit test:

- UT verifies that the hash function generates a collision for
  the selected test data. This must be true for the bug to be present.
  Then UT demonstrates the bug by adding two items to the hash table
  that collide, and then removing one of them 2x. The bug is that the
  other value is removed as well.

Bug #7828 --> https://redmine.openinfosecfoundation.org/issues/7828

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
3 months ago
Boris Tonofa 080995f551 detect-file-hash: drop redundant rule_file NULL check
de_ctx->rule_file is never NULL inside DetectFileHashParse(); add a comment
stating this fact and remove the superfluous NULL guard.

No functional change – the patch only clarifies the code and trims a few
lines of dead code.

Bug 7769
3 months ago
Juliana Fajardini 49629f7cb6 schema/decoder: add descriptions for stats counters
Task #7793
3 months ago
Juliana Fajardini 342c649186 schema/arp: fix invalid pkt event output
Task #7857
3 months ago
Adam Kiripolsky 775fc7795e dpdk: fix parsing of DPDK EAL argument options
Fix parsing of DPDK EAL argument options taken from suricata.yaml.

Ticket: 7856
3 months ago
Juliana Fajardini ec1da6fd3a doc/exceptions: fix wrong section markdown
Sections had wrong levels due to wrong markdown.
3 months ago
Jeff Lucovsky 21707ab26c doc/from_base64: Emphasize keyword only values
Emphasize that specifying the keyword only will result in the defaults
for each option to be used.

Issue: 7853
3 months ago
Jeff Lucovsky 03d676531a detect/from_base64: Support keyword w/no opts
Issue: 7853

Support the use of `from_base64` with no optional values. In this case,
the default values for:
- mode RFC4648
- offset: 0
- bytes: buffer size
will be used.
3 months ago