]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
9 months agogithub-ci: don't install cbindgen on centos stream 9 11982/head
Jason Ish [Wed, 16 Oct 2024 19:28:10 +0000 (13:28 -0600)] 
github-ci: don't install cbindgen on centos stream 9

Not needed as this is a build from make dist, and providing cbindgen
will force regeneration of the bindings.

9 months agogithub-ci: pin actions/upload-artifact to newer version
Jason Ish [Wed, 16 Oct 2024 18:59:30 +0000 (12:59 -0600)] 
github-ci: pin actions/upload-artifact to newer version

Required for the newer version of download-artifact in use due to sync
with master.

9 months agogithub-ci: sync almalinux builds with master
Jason Ish [Wed, 16 Oct 2024 18:57:50 +0000 (12:57 -0600)] 
github-ci: sync almalinux builds with master

9 months agogithub-ci: pin missed actions/checkout
Jason Ish [Wed, 16 Oct 2024 18:52:54 +0000 (12:52 -0600)] 
github-ci: pin missed actions/checkout

Pin actions missed as part of the sync with master as they most likely
don't exist in master.

9 months agogithub-ci: pin missed actions/cache
Jason Ish [Wed, 16 Oct 2024 18:49:48 +0000 (12:49 -0600)] 
github-ci: pin missed actions/cache

In job: ubuntu-22-04-cov-fuzz

9 months agogithub-ci: add ubuntu 24.04 cocci build
Jason Ish [Wed, 16 Oct 2024 18:47:19 +0000 (12:47 -0600)] 
github-ci: add ubuntu 24.04 cocci build

As cocci was removed from the Fedora builds due to issues in Cocci on
Fedora.

9 months agogithub-ci: remove Fedora 38, add Fedora 40
Jason Ish [Wed, 16 Oct 2024 18:45:16 +0000 (12:45 -0600)] 
github-ci: remove Fedora 38, add Fedora 40

Sync with master on Fedora builds.

9 months agogithub-ci: sync with master branch
Jason Ish [Wed, 16 Oct 2024 18:36:17 +0000 (12:36 -0600)] 
github-ci: sync with master branch

Mainly hashes of actions and other minor changes.

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

(cherry picked from commit 97d525d18d8b648b9732560da1ddd5dc2b37eb44)

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

Modification by Jason Ish: Keep removal of duplicate checkout action
while resolving conflict.

(cherry picked from commit d574d88bcafa630e0a112322e8c2dbf66d9ec49a)

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.

(cherry picked from commit 09d604f7c3acd7d71e5cb57cb2aa263ad28c8466)

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

(cherry picked from commit a5e13d0deeacf34402e3145f377987bba6c9eb26)

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.

(cherry picked from commit 2b16369071da1976c853b7682eb062c5485338c0)

9 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
(cherry picked from commit c72404e5546635a6239bdd7302fe945f47ce1927)

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

(cherry picked from commit 76527dde79a5825299c9534e8da1fabb7fb4279e)

9 months agotemplate: remove -rust references 11931/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

(cherry picked from commit 58556b7f8b65b26f97e4e8a95e95ce304fded6c8)

10 months agoutil/thash: fix formatting 11849/head 11851/head
Shivani Bhardwaj [Tue, 1 Oct 2024 11:03:39 +0000 (16:33 +0530)] 
util/thash: fix formatting

10 months agoversion: start development towards 7.0.8
Shivani Bhardwaj [Tue, 1 Oct 2024 11:00:04 +0000 (16:30 +0530)] 
version: start development towards 7.0.8

10 months agorelease: 7.0.7; update changelog suricata-7.0.7
Shivani Bhardwaj [Tue, 1 Oct 2024 06:08:36 +0000 (11:38 +0530)] 
release: 7.0.7; update changelog

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.
(cherry picked from commit 976dec7f332624e31f57a936e6e6275c01dd8da5)

10 months agotls: do not break custom fields when enabling JA4
Sascha Steinbiss [Fri, 27 Sep 2024 09:24:26 +0000 (11:24 +0200)] 
tls: do not break custom fields when enabling JA4

Ticket: 7286

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

(cherry picked from commit 26da953f6dad3793d29f27ce7ab6628a2db8f471)

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.

(cherry picked from commit bb714c917878ed13aab9e314a026f71570e84f37)

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.

(cherry picked from commit 1e152d1f1060a5afd39496d4f2556e7159cd22cc)

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

(cherry picked from commit 9203656496c4081260817cce018a0d8fd57869b5)

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

Ticket: 7195
(cherry picked from commit c55c7d6c27f5386ad0297cf1113b291787c3f09e)

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

(cherry picked from commit e47598110a557bb9f87ea498d85ba91a45bb0cb6)

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

(cherry picked from commit 1352ed68c77dd9cd7d9fa708d68e8ec787958258)

10 months agostream: improve 3whs completed by ACK with data 11835/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.
(cherry picked from commit 45eb7e48817f0435040c3efc15e66383d78ed71f)

10 months agossl/ja3: better check for ja3 being enabled 11830/head
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

(cherry picked from commit 1d32f117456bb6d220ca3f7e99b4680ec7fbd549)

10 months agopgsql: trigger raw stream reassembly at tx completion 11827/head
Juliana Fajardini [Wed, 17 Jul 2024 20:22:04 +0000 (17:22 -0300)] 
pgsql: trigger raw stream reassembly at tx completion

Once we are tracking tx progress per-direction for PGSQL, we can trigger
the raw stream reassembly, for detection purposes, as soon as the
transactions are completed in the given direction.

Task #7000

(cherry picked from commit 2b1ad81cf587fb46392d751f740a55139795ec56)

10 months agopgsql: track transaction progress per direction
Juliana Fajardini [Thu, 29 Aug 2024 21:02:15 +0000 (18:02 -0300)] 
pgsql: track transaction progress per direction

PGSQL's current implementation tracks the transaction progress without
taking into consideration flow direction, and also has indirections
that make it harder to understand how the progress is tracked, as well
as when a request or response is actually complete.

This patch introduces tracking such progress per direction and adds
completion status per direction, too. This will help when triggering
raw stream reassembly or for unidirectional transactions, and may be
useful when we implement sub-protocols that can have multiple requests
per transaction, as well.

CancelRequests and TerminationRequests are examples of unidirectional
transactions. There won't be any responses to those requests, so we can
also mark the response side as done, and set their transactions as
completed.

Bug #7113

(cherry picked from commit dcccbb11963b350a5f81b47f53f64f4b4a082ce3)

10 months agopgsql: use new API style for extern C functions
Juliana Fajardini [Mon, 23 Sep 2024 18:56:49 +0000 (15:56 -0300)] 
pgsql: use new API style for extern C functions

(cherry picked from commit 2c7824a41f4c28895ce581b9b3e444f94f86a339)

10 months agopgsql: order StateProgress enum per direction
Juliana Fajardini [Wed, 28 Aug 2024 20:15:01 +0000 (17:15 -0300)] 
pgsql: order StateProgress enum per direction

Related to
Bug #7113

(cherry picked from commit 3ba179422d53b47ad074bb114bcaca9f1ab44703)

10 months agodcerpc: don't reuse completed tx
Victor Julien [Wed, 31 Jul 2024 11:58:29 +0000 (13:58 +0200)] 
dcerpc: don't reuse completed tx

In the DCERPC over TCP pcap, logging and rule matching is disrupted by adding a simple rule:

        alert tcp any any -> any any (flow:to_server,established; \
                dce_iface:5d2b62aa-ee0a-4a95-91ae-b064fdb471fc; dce_opnum:1; \
                dce_stub_data; content:"|42 77 4E 6F 64 65 49 50 2E 65 78 65 20|"; \
                content:!"|00|"; within:100; distance:97; sid:1; rev:1; )

Works: alert + 3 dcerpc records.

But when adding a trivial rule:

        alert tcp any any -> any any (flow:to_server,established; \
                dce_iface:5d2b62aa-ee0a-4a95-91ae-b064fdb471fc; dce_opnum:1; \
                dce_stub_data; content:"|42 77 4E 6F 64 65 49 50 2E 65 78 65 20|"; \
                content:!"|00|"; within:100; distance:97; sid:1; rev:1; )
        alert tcp any any -> any any (dsize:3; sid:2; rev:1; )

The alert for sid:1 disappears and also there is one dcerpc event less.

In the single rule case we can aggressively free the transactions, as there
is only an sgh in the toserver direction.

This means that when we encounter the 2nd REQUEST, the first 2 transactions
have already been processed and freed. So for the 2nd REQUEST we open a new
TX and run inspection and logging on it.

When the 2nd rule is added, it adds toclient sgh as well. This means that we
will now slightly delay the freeing of the transactions.

As a consequence we still have the TX for the first REQUEST when the 2nd REQUEST
is parsed. This leads to the 2nd REQUEST re-using the TX. Since the TX is
already marked as inspected, it means the toserver rule now no longer matches.
Also we're not logging this TX correctly now.

This commit fixes the issue by not "finding" a TX that as already been
marked complete in the search direction.

Bug #7187.

(cherry picked from commit 65392c02f5632d7a8faf30285fb8f5a946cbe9a4)

10 months agoeve/alert: fix validation check
Victor Julien [Wed, 20 Mar 2024 06:18:44 +0000 (07:18 +0100)] 
eve/alert: fix validation check

Bug: #6875.
(cherry picked from commit 0be3ba802e1433632e48a7160cc6ae9fbe4c239e)

10 months agomembuffer: annotate printf style function
Victor Julien [Fri, 24 Nov 2023 16:06:20 +0000 (17:06 +0100)] 
membuffer: annotate printf style function

(cherry picked from commit ff8597d50bebe92a9bf25df61d091f530c30791d)

10 months agoeve/alert: break out of payload logging callback if buffer is full
Victor Julien [Fri, 24 Nov 2023 15:02:14 +0000 (16:02 +0100)] 
eve/alert: break out of payload logging callback if buffer is full

(cherry picked from commit 926c6e3addad81cb696e478c8648abb4d7384fbe)

10 months agoeve/frame: break out of logging callback if buffer is full
Victor Julien [Fri, 24 Nov 2023 14:53:23 +0000 (15:53 +0100)] 
eve/frame: break out of logging callback if buffer is full

(cherry picked from commit 1dea4fea0b3989f6a76d5ea012588f32e20702ac)

10 months agomembuffer: return bytes written
Victor Julien [Fri, 24 Nov 2023 15:10:16 +0000 (16:10 +0100)] 
membuffer: return bytes written

(cherry picked from commit 7d5b537f5cec0e88d4442a81500254b98004f117)

10 months agomembuffer: use buffer pointer as flexible array member
Victor Julien [Fri, 24 Nov 2023 15:12:47 +0000 (16:12 +0100)] 
membuffer: use buffer pointer as flexible array member

(cherry picked from commit 9c3669b03fc3903c30ced9088361e74fd4aec04f)

An additional change was made to correct an ASAN issue -- the membuffer
is reset following allocation in MemBufferCreateNew().

10 months agomembuffer: turn complex macros into functions
Victor Julien [Fri, 24 Nov 2023 12:58:43 +0000 (13:58 +0100)] 
membuffer: turn complex macros into functions

For better readability and type checking.

(cherry picked from commit 3ef98f2b87e3cd1de022d9e7eb1581730c08bcdb)

10 months agounix-manager: add \n string to buffer using correct API call
Victor Julien [Fri, 24 Nov 2023 12:58:12 +0000 (13:58 +0100)] 
unix-manager: add \n string to buffer using correct API call

(cherry picked from commit ea98df8da25e1bd1505a13d39ae52f5b54dbaa03)

10 months agoeve/frame: improve frame payload logging
Victor Julien [Tue, 21 Nov 2023 15:27:16 +0000 (16:27 +0100)] 
eve/frame: improve frame payload logging

Log using stream callback API, meaning that data will also
be logged if there are GAPs.

Also implement GAP indicators: '[123 bytes missing]'.

(cherry picked from commit 6e10c660782044472fd0fb2bdc91c4c102c7fb5b)

10 months agoeve/frames: pass membuffer to API
Victor Julien [Tue, 21 Nov 2023 13:24:12 +0000 (14:24 +0100)] 
eve/frames: pass membuffer to API

In preparation of stream logging changes.

(cherry picked from commit a205583269eaec92fae05026f32fc2cd748c0bb5)

10 months agoeve/alert: init membuffer size on missing config
Victor Julien [Thu, 23 Nov 2023 05:49:12 +0000 (06:49 +0100)] 
eve/alert: init membuffer size on missing config

Don't init buffer to 0 size but use the desired default of 4k.

(cherry picked from commit 462a6d7913c927dba7d1d8313acf137d7d87b071)

10 months agoeve/alert: log payload directly from stream buffer
Victor Julien [Mon, 20 Nov 2023 09:57:38 +0000 (10:57 +0100)] 
eve/alert: log payload directly from stream buffer

This avoids looping over partly duplicate segments that cause
output data corruption by logging parts of the stream data multiple
times.

For data with GAPs now add a indicator '[4 bytes missing]' similar
to how Wireshark does it.

Bug: #6553.
(cherry picked from commit 43858f70ad26fe17e2399e3a12c4ee6168f68af1)

10 months agoeve/frame: implement payload-buffer-size option
Victor Julien [Thu, 23 Nov 2023 05:49:41 +0000 (06:49 +0100)] 
eve/frame: implement payload-buffer-size option

Modeled after the same option in eve/alert. Defaults to 4k.

(cherry picked from commit 829bab295b1bdf58c7df00a62b2d083294744b5c)

10 months agostream: const args for StreamReassembleLog
Victor Julien [Fri, 24 Nov 2023 10:10:35 +0000 (11:10 +0100)] 
stream: const args for StreamReassembleLog

Needed a workaround cast for RBTREE use.

(cherry picked from commit a5a6527d26b2c4f2c133ff2a3d7e8eed81fad8cf)

10 months agoci: mov from cifuzz to clusterfuzzlite 11798/head 11808/head
Philippe Antoine [Tue, 10 Sep 2024 12:10:30 +0000 (14:10 +0200)] 
ci: mov from cifuzz to clusterfuzzlite

To better support main7 CI fuzzing

Ticket: 7253
(cherry picked from commit b3bd57246fbbb80da5a76223d35f57589725cc48)

10 months agoframes: do not only rely on FRAME_STREAM_ID 11789/head
Philippe Antoine [Thu, 12 Sep 2024 11:07:48 +0000 (13:07 +0200)] 
frames: do not only rely on FRAME_STREAM_ID

As stream frame is not always created,
hence the first frame is not always a stream frame :
If stream frame is not enabled, it does not get created,
and other enabled frames may be created first.
See use of FrameConfigTypeIsEnabled

This resulted that this other frame got its length updated
on stream end, which led to false positives.

Also checking FRAME_STREAM_TYPE is more consistent.

Not a clean cherry-pick as AppLayerFrameGetLastOpenByType
does not exist in main7

Ticket: 7213

10 months agorust/detect: fix too_long_first_doc_paragraph clippy warning
Philippe Antoine [Mon, 9 Sep 2024 09:09:52 +0000 (11:09 +0200)] 
rust/detect: fix too_long_first_doc_paragraph clippy warning

warning: first doc comment paragraph is too long
  --> src/detect/iprep.rs:57:1
   |
57 | / /// value matching is done use `DetectUintData` logic.
58 | | /// isset matching is done using special `DetectUintData` value ">= 0"
59 | | /// isnotset matching bypasses `DetectUintData` and is handled directly
60 | | /// in the match function (in C).
   | |_
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
   = note: `#[warn(clippy::too_long_first_doc_paragraph)]` on by default
help: add an empty line

(cherry picked from commit dc3c048b49c5c949836367176b81054e2fbd828e)

10 months agorust/dcerpc: fix single_match clippy warning
Philippe Antoine [Mon, 9 Sep 2024 09:09:18 +0000 (11:09 +0200)] 
rust/dcerpc: fix single_match clippy warning

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> src/dcerpc/log.rs:36:33
   |
36 |               DCERPC_TYPE_BIND => match &state.bind {
   |  _________________________________^
37 | |                 Some(bind) => {
38 | |                     jsb.open_array("interfaces")?;
39 | |                     for uuid in &bind.uuid_list {
...  |
51 | |                 None => {}
52 | |             },
   | |_____________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `#[warn(clippy::single_match)]` on by default

(cherry picked from commit 2a984e3b137a54832df8ae7f4f1bf04784f762dc)

10 months agodetect/app-layer-proto: fix prefilter check 11751/head
Victor Julien [Wed, 11 Sep 2024 08:18:58 +0000 (10:18 +0200)] 
detect/app-layer-proto: fix prefilter check

Prefilter wasn't yet using `AppProtoEquals` which might lead to
mismatches with HTTP and DCERPC related signatures.

10 months agodetect/app-layer-proto: don't run detection on ALPROTO_UNKNOWN
Victor Julien [Fri, 6 Sep 2024 09:21:48 +0000 (11:21 +0200)] 
detect/app-layer-proto: don't run detection on ALPROTO_UNKNOWN

Don't return true for negated protocol check if no protocol has been
evaluated due to ALPROTO_UNKNOWN in the packet direction.

This leads to false positives for negated matching, as an expression
like "!tls" will match if checked against ALPROTO_UNKNOWN.

This patch readds missing check. The keyword returns no match as
long as the alproto is ALPROTO_UNKNOWN.

Fixes: bf9bbdd61285 ("detect: fix app-layer-protocol keyword for HTTP")
Ticket: #7242.

10 months agotls/ja3: do not append to ja3 str once ja3 hash is computed 11748/head
Philippe Antoine [Tue, 3 Sep 2024 13:37:00 +0000 (15:37 +0200)] 
tls/ja3: do not append to ja3 str once ja3 hash is computed

Ticket: 6634

That means take only the first client hello into account.
This way, we do not end with ja3 string with 9 commas...

(cherry picked from commit 84735251b577a284af3795708786974fd30720b0)

10 months agorust/ike: fix collapsible_match clippy warning 11737/head
Philippe Antoine [Wed, 31 Jul 2024 12:15:14 +0000 (14:15 +0200)] 
rust/ike: fix collapsible_match clippy warning

warning: this `match` can be collapsed into the outer `match`
help: the outer pattern can be modified to include the inner pattern
(cherry picked from commit 42e5e556e59fcd10efa89fcc75ad9f081ee25e93)

10 months agorust: fix byte_char_slices clippy warnings
Philippe Antoine [Wed, 31 Jul 2024 12:10:17 +0000 (14:10 +0200)] 
rust: fix byte_char_slices clippy warnings

warning: can be more succinctly written as a byte str
   --> src/mime/smtp.rs:762:37
    |
762 |     mime_smtp_find_url_strings(ctx, &[b'\n']);
    |                                     ^^^^^^^^ help: try: `b"\n"`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices
    = note: `#[warn(clippy::byte_char_slices)]` on by default

(cherry picked from commit 564f685eea1af343642b52ba6c7f367167ac03f2)

10 months agouserguide: fix spelling of `security_result` EVE field
Sascha Steinbiss [Wed, 14 Aug 2024 08:11:48 +0000 (10:11 +0200)] 
userguide: fix spelling of `security_result` EVE field

This ensures that the correct spelling of the `security_result` EVE
field for RFB (as opposed to `security-result`) is also reflected in the
documentation.

Ticket: #7210
(cherry picked from commit cb14e44780c96c7285023827973cfd38e474172c)

10 months agorust/rfb: use consistent key name for security_result
Sascha Steinbiss [Sat, 3 Aug 2024 13:05:20 +0000 (15:05 +0200)] 
rust/rfb: use consistent key name for security_result

A typo caused a slightly different key (`security-result`) to be used
for the case in which the result was `FAIL`. This commit addresses this
by ensuring the same string is used for all cases.

Ticket: #7198

11 months agodatasets: fix parsing of ip4 in ip6 11698/head
Eric Leblond [Fri, 19 Apr 2024 15:07:48 +0000 (17:07 +0200)] 
datasets: fix parsing of ip4 in ip6

The lookup function was not taking into account that we can have
an IPv4 or an IPv6 address as parameters and that this addresses
need to be converted to Suricata internal storage.
By using the already defined dedicated parsing function, we are
fixing the issue.

Issue: #6969
(cherry picked from commit 4668c955134082c079ea7b54ac6a029b7321641e)

11 months agopgsql: check for eol when parsing response
Juliana Fajardini [Sat, 13 Apr 2024 02:12:03 +0000 (23:12 -0300)] 
pgsql: check for eol when parsing response

It was brought to my attention by GLongo that Pgsql parser handled eof
diffrently for requests and responses, and apparently there isn't a good
reason for such a difference therefore, apply same logic used for
rs_pgsql_parse_request for checking for eof when parsing a response.

(cherry picked from commit ce1556cefd79ff53e3eb2e2542718c901958f183)

11 months agooutput/json: add pgsql metadata logging to alerts
Juliana Fajardini [Tue, 27 Aug 2024 18:07:16 +0000 (15:07 -0300)] 
output/json: add pgsql metadata logging to alerts

Bug #6092

Related to
Bug #6983

11 months agopgsql/logger: open json object from logger function
Juliana Fajardini [Thu, 25 Apr 2024 01:13:35 +0000 (22:13 -0300)] 
pgsql/logger: open json object from logger function

Before, the JsonBuilder object for the pgsql event was being created
from the C-side function that actually called the Rust logger.

This resulted that if another module - such as the Json Alert called the
PGSQL logger, we wouldn't have the `pgsql` key present in the log output
- only its inner fields.

Bug #6983

(cherry picked from commit 69e26de197c48e7f3e351229ee34b96388673b72)

11 months agodoc/userguide: update guidance on 5 to 6 upgrading 11688/head
Victor Julien [Thu, 7 Dec 2023 09:27:41 +0000 (10:27 +0100)] 
doc/userguide: update guidance on 5 to 6 upgrading

TCP memory use can be higher than expected in certain configs.

Ticket: #6552.
(cherry picked from commit 3456dea276c209b5bf0f95259a42f89d121ada32)

11 months agotcp: fix 'broken ack' on flow timeout
Victor Julien [Mon, 27 May 2024 13:57:38 +0000 (15:57 +0200)] 
tcp: fix 'broken ack' on flow timeout

Don't set an ACK value if ACK flag is no longer set. This avoids a bogus
`pkt_broken_ack` event set.

Fixes: ebf465a11bff ("tcp: do not assign TCP flags to pseudopackets")
Ticket: #7158.
(cherry picked from commit a404fd26af64f60e8eaa86419a11393d7c4bfdda)

11 months agodetect/nfs: do not free a null pointer 11684/head
Philippe Antoine [Sun, 23 Jun 2024 20:57:11 +0000 (22:57 +0200)] 
detect/nfs: do not free a null pointer

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69840
(cherry picked from commit b34d4b131425e628b19058b8d2917b2ba9085727)

11 months agoeve/dns: make version required
Jason Ish [Fri, 12 Jul 2024 20:50:34 +0000 (14:50 -0600)] 
eve/dns: make version required

The "eve.version" field is not always logged. Update the schema to
enforce that it is, and fix it for records that don't log it.

Ticket: #7167
(cherry picked from commit fcc1b1067b5e4c3b9b063ab90fa073de57577968)

11 months agoprofiling: allow absolute paths 11642/head
Victor Julien [Wed, 10 Jul 2024 09:29:35 +0000 (11:29 +0200)] 
profiling: allow absolute paths

Ticket #6490.

(cherry picked from commit 855cc8963612387ff0440b707ce3145523f1a9ac)

11 months agorust: compatibility with cbindgen 0.27 11626/head
Philippe Antoine [Mon, 12 Aug 2024 12:55:22 +0000 (14:55 +0200)] 
rust: compatibility with cbindgen 0.27

Ticket: 7206

Cbindgen 0.27 now handles extern blocks as extern "C" blocks.
The way to differentiate them is to use a special comment
before the block.

(cherry picked from commit 304271e63a9e388412f25f0f94a1a0da4bf619d9)

11 months agoconfigure: require cbindgen version of 0.16.0 or newer 11613/head
Jason Ish [Tue, 6 Aug 2024 17:14:52 +0000 (11:14 -0600)] 
configure: require cbindgen version of 0.16.0 or newer

11 months agorust/dcerpc: fix rustdoc indentation
Jason Ish [Tue, 6 Aug 2024 16:45:05 +0000 (10:45 -0600)] 
rust/dcerpc: fix rustdoc indentation

Fixes clippy lint:

error: doc list item missing indentation
   --> src/dcerpc/dcerpc.rs:511:9
    |
511 |     ///  description: direction of the flow
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation

11 months agorust/conf: collapse match pattern into if
Jason Ish [Tue, 6 Aug 2024 16:43:19 +0000 (10:43 -0600)] 
rust/conf: collapse match pattern into if

Fixes clippy lint for collapsible_match.

error: this `match` can be collapsed into the outer `if let`
  --> src/conf.rs:85:9
   |
85 | /         match val {
86 | |             "1" | "yes" | "true" | "on" => {
87 | |                 return true;
88 | |             },
89 | |             _ => {},
90 | |         }
   | |_________^
   |
help: the outer pattern can be modified to include the inner pattern
  --> src/conf.rs:84:17
   |
84 |     if let Some(val) = conf_get(key) {
   |                 ^^^ replace this binding
85 |         match val {
86 |             "1" | "yes" | "true" | "on" => {
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ with this pattern
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match

11 months agorust/http2: remove redundant pattern match
Jason Ish [Tue, 6 Aug 2024 16:39:30 +0000 (10:39 -0600)] 
rust/http2: remove redundant pattern match

Fix clippy lint for if_let_redundant_pattern_matching by using
.is_some().

11 months agorust/dcerpc: clippy fix for match
Jason Ish [Tue, 6 Aug 2024 16:30:13 +0000 (10:30 -0600)] 
rust/dcerpc: clippy fix for match

error: this `match` can be collapsed into the outer `match`
   --> src/dcerpc/detect.rs:215:20
    |
215 |           Some(x) => match x {
    |  ____________________^
216 | |             DCERPC_TYPE_REQUEST | DCERPC_TYPE_RESPONSE => {}
217 | |             _ => {
218 | |                 return 0;
219 | |             }
220 | |         },
    | |_________^
    |
help: the outer pattern can be modified to include the inner pattern
   --> src/dcerpc/detect.rs:215:14
    |
215 |         Some(x) => match x {
    |              ^ replace this binding
216 |             DCERPC_TYPE_REQUEST | DCERPC_TYPE_RESPONSE => {}
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with this pattern
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match

11 months agorust/ssh: fix clippy warning, reference can be used
Jason Ish [Tue, 6 Aug 2024 16:11:21 +0000 (10:11 -0600)] 
rust/ssh: fix clippy warning, reference can be used

Fix done by clippy --fix.

11 months agorust: fix clippy warnings for match as if statements
Jason Ish [Tue, 6 Aug 2024 16:10:43 +0000 (10:10 -0600)] 
rust: fix clippy warnings for match as if statements

Fix done by clippy --fix.

11 months agofuzz: make confyaml.c an explicit source
Philippe Antoine [Mon, 29 Jul 2024 14:10:11 +0000 (16:10 +0200)] 
fuzz: make confyaml.c an explicit source

Ticket: 7181

Allows confyaml.c to be in the release archive

(cherry picked from commit 3f8251bd47d4445befe38a57fe1485374657d246)

11 months agooutput/json: Close jb object on error
Jeff Lucovsky [Wed, 31 Jul 2024 14:24:33 +0000 (10:24 -0400)] 
output/json: Close jb object on error

Issue: 7194

Ensure that the jb object is closed on errors.

11 months agodetect/integers: harmonize parser return handling
Philippe Antoine [Mon, 15 Jul 2024 07:23:06 +0000 (09:23 +0200)] 
detect/integers: harmonize parser return handling

Ticket: 7172

When parsing an integer for a rule keyword fails, we return error
straight away, without bothering to try to free the NULL pointer.

On the way, remove some one-line wrapper around DetectUxParse

(cherry picked from commit daad7f2d417bb730e51df142fb837d216938089f)

12 months agodpdk: replace TSC clock with GetTime (gettimeofday) function 11492/head 11511/head
Lukas Sismis [Sun, 14 Jul 2024 09:08:49 +0000 (11:08 +0200)] 
dpdk: replace TSC clock with GetTime (gettimeofday) function

Getting clock through Time Stamp Counter (TSC) can be precise and fast,
however only for a short duration of time.
The implementation across CPUs seems to vary. The original idea is to
increment the counter with every tick. Then dividing the delta of CPU ticks
by the CPU frequency can return the time that passed.
However, the CPU clock/frequency can change over time, resulting in uneven
incrementation of TSC. On some CPUs this is handled by extra logic.
As a result, obtaining time through this method might drift from the real
time.

This commit therefore substitues TSC time retrieval by the standard system
call wrapped in GetTime function - on Linux it is gettimeofday.

Ticket: 7116

(cherry picked from commit 35dffc6b32edefdccff18710abdb6f7bc6a1145f)

12 months agodns: allow triggering raw stream reassembly 11482/head
Juliana Fajardini [Tue, 21 May 2024 20:35:34 +0000 (17:35 -0300)] 
dns: allow triggering raw stream reassembly

For TCP streams, app proto stream reassembly can start earlier, instead
of waiting and queueing up data before doing so.

Task #7018
Related to
Bug #7004

(cherry picked from commit bb45ac71ef572acb5591c135eb3c73e901a1cc51)

12 months agosmb/ntlmssp: improve version check 11450/head
Victor Julien [Tue, 25 Jun 2024 08:35:35 +0000 (10:35 +0200)] 
smb/ntlmssp: improve version check

Don't assume the ntlmssp version field is always present if the flag is
set. Instead keep track of the offsets of the data of the various blobs
and see if there is space for the version.

Inspired by how Wireshark does the parsing.

Bug: #7121.
(cherry picked from commit f59c43b1c7b8eada987d642cbc1645abefb3984c)

12 months agoutil/thash: decrease memuse if array was allocated 11445/head
Philippe Antoine [Thu, 4 Jul 2024 11:55:27 +0000 (13:55 +0200)] 
util/thash: decrease memuse if array was allocated

THashInitConfig may not allocate array and increase memuse.
Such a failure leads to THashShutdown which should not decrease
the memuse.

Ticket: 7135
(cherry picked from commit eeec609ac822a9d3ffc407428d6e6a75f4e30afa)

12 months agodoc/userguide: document iprep isset/isnotset 11441/head
Victor Julien [Thu, 6 Jun 2024 15:38:55 +0000 (17:38 +0200)] 
doc/userguide: document iprep isset/isnotset

(cherry picked from commit 8b42182fee1a3cd79e58063a86ebeb202e7e4bd6)

12 months agodoc/userguide: add more operators to iprep
Victor Julien [Thu, 6 Jun 2024 15:38:34 +0000 (17:38 +0200)] 
doc/userguide: add more operators to iprep

(cherry picked from commit 2f74d435d369eaf6b8ef01565f6c8afd8743f216)

12 months agodetect/iprep: implement isset and isnotset
Victor Julien [Mon, 13 May 2024 12:37:51 +0000 (14:37 +0200)] 
detect/iprep: implement isset and isnotset

Implement special "isset" and "isnotset" modes.

"isset" matches if an IP address is part of an iprep category with any
value.

It is internally implemented as ">=,0", which should always be true if
there is a value to evaluate, as valid reputation values are 0-127.

"isnotset" matches if an IP address is not part of an iprep category.

Internally it is implemented outside the uint support.

Ticket: #6857.
(cherry picked from commit 83976a4cd4ed0583c2c9f49a75e71d894ce65888)

12 months agoreputation: minor cleanup
Victor Julien [Mon, 13 May 2024 12:37:02 +0000 (14:37 +0200)] 
reputation: minor cleanup

No need to init ptrs to NULL after SCCalloc.

(cherry picked from commit 3e46c516514cde867f34723a77958e8fd10bebb5)

12 months agodetect/iprep: update keyword parser for extendibility
Victor Julien [Mon, 13 May 2024 10:33:57 +0000 (12:33 +0200)] 
detect/iprep: update keyword parser for extendibility

(cherry picked from commit 539ab3a4046720f58d7b6b7b1d12f9cb266eadb9)

12 months agobypass: really bypass udp flow from first packet
Philippe Antoine [Thu, 30 May 2024 07:56:43 +0000 (09:56 +0200)] 
bypass: really bypass udp flow from first packet

Ticket: 7053

As flow state would be overwritten by established...

(cherry picked from commit df5dcfef5f1d974779e653d2d1d8b3b5d83dc6fc)

12 months agofilestore: do not try to store a file set to nostore
Philippe Antoine [Thu, 7 Dec 2023 09:32:03 +0000 (10:32 +0100)] 
filestore: do not try to store a file set to nostore

Ticket: 6390

This can happen with keyword filestore:both,flow
If one direction does not have a signature group with a filestore,
the file is set to nostore on opening, until a signature in
the other direction tries to set it to store.
Subsequent files will be stored in both directions as flow flags
are now set.

(cherry picked from commit 5f3503592861df335655657299f2edcdcdc13b1c)

13 months agodetect/snmp: do not bother to free a null pointer 11419/head 11432/head
Philippe Antoine [Tue, 2 Jul 2024 07:26:23 +0000 (09:26 +0200)] 
detect/snmp: do not bother to free a null pointer

Ticket: 7134

13 months agogithub-actions: remove build for EOL centos:7 11405/head
Victor Julien [Tue, 2 Jul 2024 18:02:49 +0000 (20:02 +0200)] 
github-actions: remove build for EOL centos:7

13 months agodetect/noalert: point noalert/alert to new doc
Victor Julien [Fri, 7 Jun 2024 19:02:00 +0000 (21:02 +0200)] 
detect/noalert: point noalert/alert to new doc

(cherry picked from commit d02054fa3168c05de7eb87ae5ce0120b44aba8b4)

13 months agodoc/userguide: add noalert/alert keyword docs
Victor Julien [Thu, 6 Jun 2024 10:25:51 +0000 (12:25 +0200)] 
doc/userguide: add noalert/alert keyword docs

(cherry picked from commit 50ef646d4524d9e53554b618bc0e4bede3745dde)

13 months agodoc/userguide: give pcre1 to pcre2 proper heading
Victor Julien [Thu, 6 Jun 2024 09:46:55 +0000 (11:46 +0200)] 
doc/userguide: give pcre1 to pcre2 proper heading

(cherry picked from commit c83e3285ae6f5dfd01a750e83ccfd4d9e57b7d47)

13 months agodetect: implement 'alert' keyword as a companion to 'noalert'
Victor Julien [Fri, 12 Jan 2024 13:00:37 +0000 (14:00 +0100)] 
detect: implement 'alert' keyword as a companion to 'noalert'

This can be used to implement alert then pass logic.

Add support for alert-then-pass to alert handling routines.

Ticket: #5466.
(cherry picked from commit d5fb8204b6b30b9617ebd95dd12c87a812b2cb5a)

13 months agodetect: set ACTION_ALERT for rules that should alert
Victor Julien [Fri, 12 Jan 2024 10:14:27 +0000 (11:14 +0100)] 
detect: set ACTION_ALERT for rules that should alert

Replaces default "alert" logic and removed SIG_FLAG_NOALERT.

Instead, "noalert" unsets ACTION_ALERT. Same for flowbits:noalert and
friends.

In signature ordering rules w/o action are sorted as if they have 'alert',
which is the same behavior as before, but now implemented explicitly.

Ticket: #5466.
(cherry picked from commit 92581dbc0669464e2e3ed2b84c8e0695418879c3)

13 months agodetect/flowbits: remove DETECT_FLOWBITS_CMD_NOALERT
Shivani Bhardwaj [Sat, 9 Dec 2023 07:19:31 +0000 (12:49 +0530)] 
detect/flowbits: remove DETECT_FLOWBITS_CMD_NOALERT

DETECT_FLOWBITS_CMD_NOALERT is misleading as it gives an impression that
noalert is a flowbit specific command that'll be used and dealt with at
some point but as soon as noalert is found in the rule lang, signature
flag for noalert is set and control is returned. It never gets added to
cmd of the flowbits object.

(cherry picked from commit 75471dd69b78d0915819b978e937483dca8b4a04)

13 months agodetect/alert: minor loop cleanup
Victor Julien [Fri, 12 Jan 2024 12:41:17 +0000 (13:41 +0100)] 
detect/alert: minor loop cleanup

(cherry picked from commit 8f72a04973764ea849096cec3ee828e7ce4891ec)