]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
9 months agoredis: add automatic trimming support for streams
Sascha Steinbiss [Fri, 18 Oct 2024 21:24:14 +0000 (23:24 +0200)] 
redis: add automatic trimming support for streams

9 months agoredis: implement XADD stream support
Sascha Steinbiss [Tue, 11 Jun 2024 11:14:00 +0000 (13:14 +0200)] 
redis: implement XADD stream support

Ticket: #7082

9 months agouserguide: fix integer keyword matches list format 12013/head
Juliana Fajardini [Wed, 23 Oct 2024 04:11:55 +0000 (21:11 -0700)] 
userguide: fix integer keyword matches list format

List wasn't being properly rendered.

9 months agorust/applayer: use c_int as return type for get_info_by_id 12009/head
Jason Ish [Tue, 22 Oct 2024 16:46:13 +0000 (10:46 -0600)] 
rust/applayer: use c_int as return type for get_info_by_id

Rust was using i8 as the return type, while C uses int. As of Rust
1.82, the return value is turned to garbage over the FFI boundary.

Ticket: #7338

9 months agoeve/schema: add missing field "code" anomaly events
Jason Ish [Tue, 22 Oct 2024 16:26:22 +0000 (10:26 -0600)] 
eve/schema: add missing field "code" anomaly events

9 months agoeve/tls: use BIT_U64 for flags 12004/head
Jason Ish [Mon, 21 Oct 2024 15:30:37 +0000 (09:30 -0600)] 
eve/tls: use BIT_U64 for flags

Minor cleanup.

9 months agoeve/tls: remove unused SC_ATOMIC_EXTERN
Jason Ish [Fri, 18 Oct 2024 15:14:31 +0000 (09:14 -0600)] 
eve/tls: remove unused SC_ATOMIC_EXTERN

9 months agosuricata.yaml: add missing custom tls fields
Jason Ish [Fri, 18 Oct 2024 15:11:22 +0000 (09:11 -0600)] 
suricata.yaml: add missing custom tls fields

Also update the suricata.yaml in the userguide.

9 months agoeve/tls: cleanup headers; update copyright year
Jason Ish [Thu, 17 Oct 2024 16:30:38 +0000 (10:30 -0600)] 
eve/tls: cleanup headers; update copyright year

9 months agoeve/tls: reimplement basic and extended logging in terms of custom
Jason Ish [Thu, 17 Oct 2024 16:21:21 +0000 (10:21 -0600)] 
eve/tls: reimplement basic and extended logging in terms of custom

Will prevent custom logging options getting out of sync with whats
available in extended.

Ticket: #7333

9 months agoeve/tls: remove broken check for ja3 being enabled
Jason Ish [Thu, 17 Oct 2024 14:41:54 +0000 (08:41 -0600)] 
eve/tls: remove broken check for ja3 being enabled

During EVE TLS setup, a broken check for Ja3 being enabled led to Ja3
being disabled, but only in custom mode. This check is not needed, if
Ja3 is disabled, it won't be available, and won't be logged.

This is required to implement "extended" in terms of "custom" fields.

9 months agoeve/tls: add alpn logging to custom output
Jason Ish [Thu, 17 Oct 2024 14:31:49 +0000 (08:31 -0600)] 
eve/tls: add alpn logging to custom output

Adds custom fields "client_alpns" and "server_alpns".

Ticket: #7333

9 months agoeve/tls: disable clang formatting around tls_fields array
Jason Ish [Thu, 17 Oct 2024 00:08:08 +0000 (18:08 -0600)] 
eve/tls: disable clang formatting around tls_fields array

9 months agoprofiling: Correct profiling data array size
Jeff Lucovsky [Wed, 16 Oct 2024 14:37:20 +0000 (10:37 -0400)] 
profiling: Correct profiling data array size

The profiling arrays are incorrectly sized by the number of thread
modules. Since they contain app-layer protocol data, they should be
sized by ALPROTO_MAX.

9 months agoenip/detect: remove double registration of enip_command keyword
Philippe Antoine [Thu, 17 Oct 2024 08:25:42 +0000 (10:25 +0200)] 
enip/detect: remove double registration of enip_command keyword

As found with
./src/suricata --list-keywords | sort | uniq -c | awk '$1 > 1'

9 months agotls/conf: clarify usage of custom vs extended logs 11980/head
Juliana Fajardini [Wed, 16 Oct 2024 23:30:11 +0000 (16:30 -0700)] 
tls/conf: clarify usage of custom vs extended logs

Since enabling custom logging will replace the extended logging, thus
possibly leading to certain fields disappearing from the logs, mention
this aspect.

Related to
Bug #7333

9 months agotls: fix duplicate EVE field (issuerdn)
Juliana Fajardini [Wed, 16 Oct 2024 22:15:59 +0000 (15:15 -0700)] 
tls: fix duplicate EVE field (issuerdn)

Wrong function call caused `issuerdn` to be logged when
`subjectaltname` was enabled, for custom logging, only.

Bug #7332

9 months agoschema/tls: add missing custom fields chain/cert
Juliana Fajardini [Fri, 27 Sep 2024 13:49:21 +0000 (10:49 -0300)] 
schema/tls: add missing custom fields chain/cert

Task #7287

9 months agogithub-actions: bump github/codeql-action from 3.26.12 to 3.26.13 11972/head
dependabot[bot] [Wed, 16 Oct 2024 04:28:46 +0000 (04:28 +0000)] 
github-actions: bump github/codeql-action from 3.26.12 to 3.26.13

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.12 to 3.26.13.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.26.12...v3.26.13)

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

Signed-off-by: dependabot[bot] <support@github.com>
9 months agodetect: rename port whitelisting to priority 11965/head
Shivani Bhardwaj [Fri, 11 Oct 2024 06:24:25 +0000 (11:54 +0530)] 
detect: rename port whitelisting to priority

This was done following the fact that this setting was historically
named incorrectly. The purpose of the setting was always to define the
ports that will be prioritized and have rule groups associated w them on
priority. Rename all occurences of this to correctly reflect the purpose
of the setting.

9 months agodetect/engine: rename fn, add comments
Shivani Bhardwaj [Fri, 11 Oct 2024 06:22:25 +0000 (11:52 +0530)] 
detect/engine: rename fn, add comments

9 months agodetect/proto: use BIT macros instead of expr
Shivani Bhardwaj [Thu, 10 Oct 2024 07:17:49 +0000 (12:47 +0530)] 
detect/proto: use BIT macros instead of expr

9 months agodetect/engine: use combined flags for TCP
Shivani Bhardwaj [Tue, 8 Oct 2024 11:16:26 +0000 (16:46 +0530)] 
detect/engine: use combined flags for TCP

9 months agogithub-actions: bump actions/checkout from 4.2.0 to 4.2.1
dependabot[bot] [Mon, 14 Oct 2024 06:58:30 +0000 (06:58 +0000)] 
github-actions: bump actions/checkout from 4.2.0 to 4.2.1

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/d632683dd7b4114ad314bca15554477dd762a938...eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871)

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

Signed-off-by: dependabot[bot] <support@github.com>
9 months agogithub-actions: bump github/codeql-action from 3.26.10 to 3.26.12
dependabot[bot] [Mon, 14 Oct 2024 06:58:25 +0000 (06:58 +0000)] 
github-actions: bump github/codeql-action from 3.26.10 to 3.26.12

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.10 to 3.26.12.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.26.10...v3.26.12)

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

Signed-off-by: dependabot[bot] <support@github.com>
9 months agogithub-actions: bump actions/upload-artifact from 4.4.0 to 4.4.3
dependabot[bot] [Mon, 14 Oct 2024 06:58:05 +0000 (06:58 +0000)] 
github-actions: bump actions/upload-artifact from 4.4.0 to 4.4.3

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.4.0 to 4.4.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/50769540e7f4bd5e21e526ee35c689e35e0d6874...b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
9 months agodetect/analyzer: add more details for icmp_id
Alice Akaki [Fri, 11 Oct 2024 22:02:18 +0000 (18:02 -0400)] 
detect/analyzer: add more details for icmp_id

Ticket: #6360

9 months agofuzz/detect: forbid rule with pcre only on stream 11958/head
Philippe Antoine [Tue, 25 Jun 2024 12:27:24 +0000 (14:27 +0200)] 
fuzz/detect: forbid rule with pcre only on stream

to avoid fuzzing blocks on timeouts with known bad rules

Ticket: 4858

9 months agostream: fix -Wshorten-64-to-32 warnings
Philippe Antoine [Tue, 19 Sep 2023 12:08:33 +0000 (14:08 +0200)] 
stream: fix -Wshorten-64-to-32 warnings

Ticket: #6186

9 months agooutput: fix -Wshorten-64-to-32 warnings
Philippe Antoine [Mon, 2 Sep 2024 19:06:01 +0000 (21:06 +0200)] 
output: fix -Wshorten-64-to-32 warnings

Ticket: #6186

9 months agoldap: improve some rust style
Philippe Antoine [Fri, 19 Jul 2024 08:21:36 +0000 (10:21 +0200)] 
ldap: improve some rust style

9 months agogithub-action: share cargo registry cache 11949/head
Victor Julien [Thu, 10 Oct 2024 04:48:33 +0000 (06:48 +0200)] 
github-action: share cargo registry cache

9 months agogithub-action: share cargo cache for windows jobs
Victor Julien [Wed, 9 Oct 2024 16:54:37 +0000 (18:54 +0200)] 
github-action: share cargo cache for windows jobs

9 months agorust: update dependencies
Victor Julien [Wed, 9 Oct 2024 10:22:38 +0000 (12:22 +0200)] 
rust: update dependencies

9 months agogithub-actions: cache netmap checkout
Victor Julien [Wed, 9 Oct 2024 07:36:52 +0000 (09:36 +0200)] 
github-actions: cache netmap checkout

To avoid build failures due to rate limiting, cache the netmap checkout.

Explicitly restore and save to avoid the checkout action cleaning the
checkout up before it can be stored in the cache.

9 months agothreads: move wait for unpause outside of loop 11948/head
Jason Ish [Thu, 10 Oct 2024 22:56:30 +0000 (16:56 -0600)] 
threads: move wait for unpause outside of loop

Threads are only set to paused upon initialization and never again, we
should only have to wait once, so move the wait before any loop that
was waiting before.

Additionally, if the thread was killed while waiting to be unpaused,
don't enter the loop.

9 months agothreads: merge unpause test into wait for pause function
Jason Ish [Thu, 10 Oct 2024 22:53:12 +0000 (16:53 -0600)] 
threads: merge unpause test into wait for pause function

TmThreadTestThreadUnPaused was only being used by
TmThreadsWaitForUnpause and is still enough to just become one
function.

9 months agothreads: helper function TmThreadsWaitForUnpause
Jason Ish [Wed, 9 Oct 2024 23:24:09 +0000 (17:24 -0600)] 
threads: helper function TmThreadsWaitForUnpause

The pattern of checking the pause flag, setting to paused then
waiting to unpause was done enough times to factor out into its own
function. This is also needed by library users who bring their own
packet acquisition threads.

9 months agotemplate/detect: allow empty buffers
Philippe Antoine [Tue, 8 Oct 2024 19:36:59 +0000 (21:36 +0200)] 
template/detect: allow empty buffers

9 months agotemplate: move detect keywords to pure rust
Philippe Antoine [Wed, 4 Sep 2024 20:17:08 +0000 (22:17 +0200)] 
template: move detect keywords to pure rust

Ticket: 3195

Also remove unused src/tests/detect-template-buffer.c

Completes commit 4a7567b3f04075f02543762717dbff9dd5b5c1f3
to remove references to template-rust

9 months agoconf: init parser after check with stat()
Zemeteri Kamimizu [Thu, 3 Oct 2024 09:50:31 +0000 (12:50 +0300)] 
conf: init parser after check with stat()

Commit changes are made to avoid possible memory leaks. If the parser
is initialized before configuration file checking, there was no deinit
call before function return. Do check config file existance and type
before YAML parser initialization, so we don't need to deinit parser
before exiting the function.

Bug: #7302

9 months agopacketpool: allow larger max-pending-packets
Victor Julien [Sat, 31 Aug 2024 13:18:03 +0000 (09:18 -0400)] 
packetpool: allow larger max-pending-packets

Original limit was due to a specific data structure.

(lifted from 96a0ffadde9bc1967d2cc9bfbeebe921c882e9b0)

9 months agodoc: add napatech plugin upgrade notes
Jeff Lucovsky [Sun, 14 Jul 2024 13:29:37 +0000 (09:29 -0400)] 
doc: add napatech plugin upgrade notes

Issue: 7165

9 months agoconfigure: fail on --enable-napatech and --disable-shared
Jeff Lucovsky [Sun, 14 Jul 2024 13:24:04 +0000 (09:24 -0400)] 
configure: fail on --enable-napatech and --disable-shared

Issue: 7165

Plugins can't be build using the standard autoconf/automake
methods. We can get around this by creating our own Makefiles, but
they're often less portable.

For now, fail during ./configure instead of during compile.

9 months agonapatech: bring back command line argument
Jeff Lucovsky [Sun, 14 Jul 2024 13:20:24 +0000 (09:20 -0400)] 
napatech: bring back command line argument

Re-introduce support for command line argument "--napatech"

Issue: 7165

9 months agonapatech: load plugin by default
Jeff Lucovsky [Sun, 14 Jul 2024 13:08:07 +0000 (09:08 -0400)] 
napatech: load plugin by default

Issue: 7165

9 months agonapatech: add as plugin
Jeff Lucovsky [Sun, 14 Jul 2024 13:00:36 +0000 (09:00 -0400)] 
napatech: add as plugin

Issue: 7165

9 months agonapatech: remove, to make room for plugin
Jeff Lucovsky [Sun, 14 Jul 2024 12:44:23 +0000 (08:44 -0400)] 
napatech: remove, to make room for plugin

Issue: 7166

9 months agotemplate: remove -rust references 11929/head
Philippe Antoine [Wed, 9 Oct 2024 12:55:54 +0000 (14:55 +0200)] 
template: remove -rust references

Ticket: 7315

Completes commit 4a7567b3f04075f02543762717dbff9dd5b5c1f3

Allows keyword template.buffer to work properly when template
protocol is enabled

9 months agogithub-ci: install prepared cbindgen on rpm distros
Jason Ish [Wed, 9 Oct 2024 16:22:35 +0000 (10:22 -0600)] 
github-ci: install prepared cbindgen on rpm distros

Currently cbindgen from system packages is broken, for now use the
cbindgen artifact we build.

9 months agogithub-ci: break out cbindgen installation to action
Jason Ish [Wed, 9 Oct 2024 15:33:20 +0000 (09:33 -0600)] 
github-ci: break out cbindgen installation to action

9 months agomisc: Eliminate compiler warnings
Jeff Lucovsky [Fri, 20 Sep 2024 13:57:53 +0000 (09:57 -0400)] 
misc: Eliminate compiler warnings

Issue: 7314

Fixup macro usages to eliminate compiler warnings.

9 months agohttp: fix condition check
Philippe Antoine [Tue, 8 Oct 2024 11:51:32 +0000 (13:51 +0200)] 
http: fix condition check

Ticket: 7309

Do not use a constant expression in a condition

9 months agodetect/address: convert ipv4 unittests to FAIL/PASS 11905/head
Alice Akaki [Thu, 3 Oct 2024 23:00:58 +0000 (19:00 -0400)] 
detect/address: convert ipv4 unittests to FAIL/PASS

Ticket: OISF#6318

9 months agotransform/base64: check for 0-sized buffer
Philippe Antoine [Wed, 2 Oct 2024 18:39:26 +0000 (20:39 +0200)] 
transform/base64: check for 0-sized buffer

So as to avoid undefined behavior with a 0-sized variable length
array

Ticket: #7296

9 months agodetect: add new_de_ctx release in case of errors in initialization
Zemeteri Kamimizu [Thu, 3 Oct 2024 10:05:55 +0000 (13:05 +0300)] 
detect: add new_de_ctx release in case of errors in initialization

Detect engine tenant reloading function hasn't got engine release call
under error label, so it is possible memory leak in case of errors in
further new detect engine initialization.

Bug: #7303

9 months agodoc/userguide: generate eve documentation 11895/head
Jason Ish [Mon, 5 Jun 2023 19:56:59 +0000 (13:56 -0600)] 
doc/userguide: generate eve documentation

Add EVE documentation for QUIC and Pgsql to their respective sections of
the userguide.

Also add a complete EVE reference as an appendix.

Other protocols can be done, but its a manual process to document in the
schema, then add the glue to pull them into the documentation.

The documentation is generated during "make dist", or if it doesn't
exist, "conf.py" will attempt to generate the eve documentation for
building on Readthedocs.

9 months agoevedoc.py: script to generate rst doc from eve schema
Jason Ish [Mon, 5 Jun 2023 19:55:54 +0000 (13:55 -0600)] 
evedoc.py: script to generate rst doc from eve schema

Also supports a "--flat" command line option to produce a "dot"
separated version of all the fields in the EVE schema.

9 months agogithub-ci: run macos python jobs in virtualenv
Jason Ish [Mon, 7 Oct 2024 15:52:30 +0000 (09:52 -0600)] 
github-ci: run macos python jobs in virtualenv

With the latest brew changes, a virtualenv is required to install
pyyaml.

9 months agotm-modules: minor code cleanups 11880/head
Jason Ish [Fri, 4 Oct 2024 23:21:34 +0000 (17:21 -0600)] 
tm-modules: minor code cleanups

- includes
- loops

9 months agothreading: remove TM_FLAG_LOGAPI_TM as its not used
Jason Ish [Fri, 4 Oct 2024 23:02:36 +0000 (17:02 -0600)] 
threading: remove TM_FLAG_LOGAPI_TM as its not used

This flag is never set, remove.

9 months agorust: unpin serde 11875/head
Philippe Antoine [Thu, 3 Oct 2024 14:10:29 +0000 (16:10 +0200)] 
rust: unpin serde

As oss-fuzz uses a newer compatible rustc version

10 months agogithub-ci: add rpm build job 11855/head 11865/head
Jason Ish [Tue, 1 Oct 2024 16:08:01 +0000 (10:08 -0600)] 
github-ci: add rpm build job

Build RPMs for Fedora 40 and EPEL 9 (using AlmaLinux).

10 months agoebpf: include llvm_bpfload.h in distribution
Jason Ish [Tue, 1 Oct 2024 17:43:33 +0000 (11:43 -0600)] 
ebpf: include llvm_bpfload.h in distribution

Otherwise we fail to build ebpf from a release archive.

10 months agogithub-ci: cache deb packages on Ubuntu dist builder
Jason Ish [Tue, 1 Oct 2024 17:11:37 +0000 (11:11 -0600)] 
github-ci: cache deb packages on Ubuntu dist builder

Should speed up setup a little.

10 months agodetect/engine: deduplicate fn definitions 11858/head
Shivani Bhardwaj [Wed, 2 Oct 2024 07:07:34 +0000 (12:37 +0530)] 
detect/engine: deduplicate fn definitions

10 months agogithub-actions: bump actions/checkout from 4.1.7 to 4.2.0
dependabot[bot] [Tue, 1 Oct 2024 19:14:46 +0000 (19:14 +0000)] 
github-actions: bump actions/checkout from 4.1.7 to 4.2.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/692973e3d937129bcbf40652eb9f2f61becf3332...d632683dd7b4114ad314bca15554477dd762a938)

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

Signed-off-by: dependabot[bot] <support@github.com>
10 months agogithub-actions: bump codecov/codecov-action from 4.5.0 to 4.6.0
dependabot[bot] [Tue, 1 Oct 2024 19:14:41 +0000 (19:14 +0000)] 
github-actions: bump codecov/codecov-action from 4.5.0 to 4.6.0

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/e28ff129e5465c2c0dcc6f003fc735cb6ae0c673...b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238)

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

Signed-off-by: dependabot[bot] <support@github.com>
10 months agogithub-actions: bump github/codeql-action from 3.26.6 to 3.26.10
dependabot[bot] [Tue, 1 Oct 2024 19:14:37 +0000 (19:14 +0000)] 
github-actions: bump github/codeql-action from 3.26.6 to 3.26.10

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.6 to 3.26.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.26.6...v3.26.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
10 months agoyaml: Add check of allocation for node object
Alexey Simakov [Mon, 23 Sep 2024 18:24:48 +0000 (21:24 +0300)] 
yaml: Add check of allocation for node object

Fix potential dereference of nullptr in case
of unsuccessful allocation of memory for
list node

Bug: #7270

10 months agoconfigure: clear cached header value
Liam Wilson [Wed, 25 Sep 2024 21:31:31 +0000 (09:31 +1200)] 
configure: clear cached header value

Unset ac_cv_header_hs_h before checking for header. This allows
hyperscan to be included in compilation when switching from a non-hs
build to a hs build.

10 months agothreads: don't drop capabilities for packet threads
Jason Ish [Thu, 26 Sep 2024 17:08:57 +0000 (11:08 -0600)] 
threads: don't drop capabilities for packet threads

Remove the call to SCDropCaps for packet processing threads. This
logic in this function is required to setup packet processing even
when the thread is provided by a library user, in which case Suricata
should not be touching is capabilities.

As SCDropCaps is currently a no-op its clear this feature needs to
be (re)designed properly, taking into consideration library users as
well.

Related ticket: https://redmine.openinfosecfoundation.org/issues/2375

10 months agodetect: pseudo-packets inherit inspect flags from parent packet
Ilya Bakhtin [Sat, 31 Aug 2024 11:44:25 +0000 (13:44 +0200)] 
detect: pseudo-packets inherit inspect flags from parent packet

Instead of inheriting from flow, because encrypted protocols like TLS
and SSH may have just set the flow flags to indicate rest of stream is
encrypted and does not need to run stream inspection. But inspection
still needs to be run detection on this last flushing packet.

Ticket: #7235.

10 months agoutil/hash: use randomized hash algorithm
Philippe Antoine [Sun, 22 Sep 2024 19:38:50 +0000 (21:38 +0200)] 
util/hash: use randomized hash algorithm

For datasets and http ranges

Ticket: 7209

Prevents abusive hash collisions from known djb2 algorithm

10 months agohttp: have a headers limit
Philippe Antoine [Mon, 9 Sep 2024 07:34:39 +0000 (09:34 +0200)] 
http: have a headers limit

Ticket: 7191

So as to avoid quadratic complexity in libhtp.
Make the limit configurable from suricata.yaml,
and have an event when network traffic goes over the limit.

10 months agoja4: handles non alphanumeric alpn
Philippe Antoine [Mon, 23 Sep 2024 09:30:19 +0000 (11:30 +0200)] 
ja4: handles non alphanumeric alpn

Ticket: 7267

Follows more closely the specification :
https://github.com/FoxIO-LLC/ja4/blob/main/technical_details/JA4.md#alpn-extension-value

Also fixes the case with a single-char alpn.

10 months agodefrag: fix off by one
Philippe Antoine [Mon, 15 Jul 2024 07:52:00 +0000 (09:52 +0200)] 
defrag: fix off by one

Ticket: 7067

This off by one could lead to an empty fragment being inserted
in the rb tree, which led to integer underflow

10 months agostream: improve 3whs completed by ACK with data 11829/head
Victor Julien [Fri, 20 Sep 2024 07:54:57 +0000 (09:54 +0200)] 
stream: improve 3whs completed by ACK with data

If the ACK packet completing the 3whs is received, the stream engine will
transition to "established". However, the packet itself will not be tagged
as "established". This will only happen for the next packet after the 3whs,
so that `flow:established` only matches after the 3whs.

It is possible that the ACK packet completing the 3whs was lost. Since the
ACK packets themselves are not acknowledged, there will be no retransmission
of them. Instead, the next packet can have the expected ACK flag as well as
data.

This case was mishandled in a subtle way. The stream engine state transition
was done correctly, as well as the data handling and app-layer updates.
However, the packet itself was not tagged as "established", which meant
that `flow:established` would not yet match.

This patch detects this case and tags the packet as established if ACK
with data is received that completes the 3whs.

Bug: #7264.

10 months agosip: use pure rust function
Philippe Antoine [Mon, 16 Sep 2024 18:50:48 +0000 (20:50 +0200)] 
sip: use pure rust function

For internal function that is not part of C FFI

10 months agodetect/dataset: abort only in debug mode 11823/head
Philippe Antoine [Tue, 13 Aug 2024 14:53:53 +0000 (16:53 +0200)] 
detect/dataset: abort only in debug mode

Ticket: 7195

10 months agodetect/datasets: implement unset command
Philippe Antoine [Mon, 12 Aug 2024 07:54:43 +0000 (09:54 +0200)] 
detect/datasets: implement unset command

Ticket: 7195

Otherwise, Suricata aborted on such a rule

10 months agodatasets: restrict scope of macro/enum
Philippe Antoine [Thu, 1 Aug 2024 18:50:28 +0000 (20:50 +0200)] 
datasets: restrict scope of macro/enum

10 months agossl/ja3: better check for ja3 being enabled
Philippe Antoine [Mon, 23 Sep 2024 12:03:04 +0000 (14:03 +0200)] 
ssl/ja3: better check for ja3 being enabled

Ticket: 6634

Completes commit 84735251b577a284af3795708786974fd30720b0

Avoids error log in Ja3BufferAddValue about NULL buffer

10 months agostream/reassembly: optimize GetBlock
Noah Liu [Mon, 23 Sep 2024 03:07:47 +0000 (11:07 +0800)] 
stream/reassembly: optimize GetBlock

Current GetBlock degrees the sbb search from rb tree to
line, which costs much cpu time, and could be replaced by
SBB_RB_FIND_INCLUSIVE. It reduces time complexity from
O(nlogn) to O(logn).

Ticket: 7208.

10 months agodocs: remove mentions to Suricata-6
Juliana Fajardini [Fri, 20 Sep 2024 18:43:51 +0000 (15:43 -0300)] 
docs: remove mentions to Suricata-6

Task #7262

10 months agodoc/conf/yaml: replace underscore with dashes
Juliana Fajardini [Tue, 17 Sep 2024 18:50:37 +0000 (15:50 -0300)] 
doc/conf/yaml: replace underscore with dashes

Use sed + regex to replace all occurrences of suricata.yaml terms that
used underscore for their up-to-date dash version.

Also search for such terms in the eve-log.yaml partials file, as that
is referenced in the configuration section.

commands used:

sed -i 's/\(^ *[a-z]*\)_\([a-z]*:\)/\1-\2/g'
sed -i 's/\(^ *[a-z]*\)_\([a-z]*\)_\([a-z]*:\)/\1-\2-\3/g'

Some other instances were found manually.

Task #7260

10 months agodetect/base64: minor cleanups
Shivani Bhardwaj [Tue, 23 Jul 2024 11:22:35 +0000 (16:52 +0530)] 
detect/base64: minor cleanups

1. decode_len can be u32 as it stores min of two u32s.
2. Add defensive check for payload_len calculation underflow.

10 months agotransform/base64: add explicit mode to test
Shivani Bhardwaj [Thu, 11 Jul 2024 07:58:21 +0000 (13:28 +0530)] 
transform/base64: add explicit mode to test

Without any mode setting, the test would take up the mode to be 0 which
used to be the relax mode for base64 decoder in C. However, there was no
code corresponding to that mode and it was never used so nothing
happened when this test was run.

Add an explicit strict mode as per the expectation of the test from its
comments.

10 months agorust/base64: add decoder
Shivani Bhardwaj [Wed, 10 Jul 2024 11:20:09 +0000 (16:50 +0530)] 
rust/base64: add decoder

Add a pure rust base64 decoder. This supports 3 modes of operation just
like the C decoder as follows.
1. RFC 2045
2. RFC 4648
3. Strict

One notable change is that "strict" mode is carried out by the rust
base64 crate instead of native Rust. This crate was already used for
encoding in a few places like datasets of string type. As a part of this
mode, now, only the strings that can be reliably converted back are
decoded.

The decoder fn is available to C via FFI.

Bug 6280
Ticket 7065
Ticket 7058

10 months agodoc/rfb: mention accidental fix for security_result log 11809/head
Philippe Antoine [Fri, 16 Aug 2024 14:53:54 +0000 (16:53 +0200)] 
doc/rfb: mention accidental fix for security_result log

Ticket: 7198

10 months agodoc: add new sip keywords
Giuseppe Longo [Thu, 18 Apr 2024 13:31:55 +0000 (15:31 +0200)] 
doc: add new sip keywords

10 months agosip: add sip.content_length sticky buffer
Giuseppe Longo [Sat, 10 Aug 2024 12:25:39 +0000 (14:25 +0200)] 
sip: add sip.content_length sticky buffer

This adds a sticky (multi) buffer to match the "Content-Length" header field in
both requests and responses.

Ticket #6374

10 months agosip: add sip.content_type sticky buffer
Giuseppe Longo [Sat, 10 Aug 2024 12:21:11 +0000 (14:21 +0200)] 
sip: add sip.content_type sticky buffer

This adds a sticky (multi) buffer to match the "Content-Type" header field in
both requests and responses.

Ticket #6374

10 months agosip: add sip.user_agent sticky buffer
Giuseppe Longo [Sat, 10 Aug 2024 12:17:06 +0000 (14:17 +0200)] 
sip: add sip.user_agent sticky buffer

This adds a sticky (multi) buffer to match the "User-Agent" header field in
both requests and responses.

Ticket #6374

10 months agosip: add sip.via sticky buffer
Giuseppe Longo [Sat, 10 Aug 2024 12:11:11 +0000 (14:11 +0200)] 
sip: add sip.via sticky buffer

This adds a sticky (multi) buffer to match the "Via" header field in
both requests and responses.

Ticket #6374

10 months agosip: add sip.to sticky buffer
Giuseppe Longo [Sat, 10 Aug 2024 12:06:00 +0000 (14:06 +0200)] 
sip: add sip.to sticky buffer

This adds a sticky (multi) buffer to match the 'To' header field in
both requests and responses.

Ticket #6374

10 months agosip: add sip.from sticky buffer
Giuseppe Longo [Sat, 10 Aug 2024 11:52:07 +0000 (13:52 +0200)] 
sip: add sip.from sticky buffer

This adds a sticky (multi) buffer to match the "From" header field
in both requests and responses.

Ticket #6374

10 months agorust/sip: store response headers
Giuseppe Longo [Fri, 15 Sep 2023 07:23:54 +0000 (09:23 +0200)] 
rust/sip: store response headers

To match on response SIP headers, those headers must be stored.

Ticket #6374

10 months agorust/sip: store multiple header values
Giuseppe Longo [Wed, 19 Jun 2024 12:26:50 +0000 (14:26 +0200)] 
rust/sip: store multiple header values

According to RFC 3261, a single header can be repeated one or more times,
and its name can also be specified using the 'compact form.'

This patch updates the hashmap used for storing headers to accommodate multiple
values instead of just one.

Additionally, if a header name is defined in the compact form, it is expanded
into its long form (i.e., the standard name).

This conversion simplifies the logic for matching a given header
and ensures 1:1 parity with keywords.

Ticket #6374

10 months agosip: rustify sticky buffers
Giuseppe Longo [Sat, 10 Aug 2024 10:26:55 +0000 (12:26 +0200)] 
sip: rustify sticky buffers

Ticket #7204