]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
18 months agomqtt: fix logic when setting event 10278/head 10308/head
Philippe Antoine [Tue, 17 Oct 2023 08:26:57 +0000 (10:26 +0200)] 
mqtt: fix logic when setting event

Especially sets transactions to complete when we get a response
without having seen the request, so that the transactions
end up getting cleaned (instead of living/leaking in the state).

Also try to set the event on the relevant transaction, instead
of creating a new transaction just for the purpose of having
the event.

Ticket: #6299
(cherry picked from commit 89936b6530690c6d03869b2ad8b82f9f84776f94)

18 months agodetect: merge sorted lists instead of qsort
Philippe Antoine [Mon, 18 Sep 2023 11:27:47 +0000 (13:27 +0200)] 
detect: merge sorted lists instead of qsort

Ticket: #6299

Simply because it is faster (just linear).

This is for merging match_array into tx_candidates

(cherry picked from commit 5bb8800588e7b4a09e1770f049cd88be71e2d30b)

18 months agodetect: avoids case of useless detection on txs
Philippe Antoine [Thu, 7 Sep 2023 12:33:04 +0000 (14:33 +0200)] 
detect: avoids case of useless detection on txs

When a TCP flow packet has not led to app-layer updates,
it is useless to run DetectRunTx, as there cannot be new
matches.

This happens for instance, when one side sends in a row multiple
packets which are not acked (and thus not parsed in IDS mode).

Doing so requires to move up the call to
AppLayerParserSetTransactionInspectId
so that it is run the same times DetectRunTx is run, and not in the
case where the transaction was not updated.

Ticket: 6299
(cherry picked from commit 9240ae250cc369306803740279df2ab3eca6b54a)

18 months agodoc: note what version "requires" was added in 10253/head
Jason Ish [Wed, 24 Jan 2024 15:55:37 +0000 (09:55 -0600)] 
doc: note what version "requires" was added in

(cherry picked from commit 8bf8131c31088f501f4d151f8748a817f89f7c1f)

18 months agodetect/requires: reset sigerror flags for each rule
Jason Ish [Wed, 24 Jan 2024 15:02:19 +0000 (09:02 -0600)] 
detect/requires: reset sigerror flags for each rule

"sigerror_ok" and "sigerror_requires" were not being reset after each
rule which could lead to a rule load error being incorrectly tracked
as skipped rather than failed.

Also initialize "skippedsigs" to 0 along with "goodsigs" and
"badsigs", while not directly related to this issue, could also throw
off some stats.

Ticket: #6710
(cherry picked from commit de3cbe4c90fb7fb6d54b6876ab515f791145271a)

18 months agorequirements: use libhtp 0.5.x
Jason Ish [Wed, 24 Jan 2024 20:41:47 +0000 (14:41 -0600)] 
requirements: use libhtp 0.5.x

Move to libhtp to the 0.5.x branch instead of 0.5.45.

(cherry picked from commit c3b3c11e30e1afdbde5c196a0692ee5e2c379cb1)

18 months agodoc: remove references to prehistoric versions
Lukas Sismis [Mon, 11 Dec 2023 00:47:55 +0000 (01:47 +0100)] 
doc: remove references to prehistoric versions

Remove references that are mentioning Suricata 3 or less
As a note - only one Suricata 4 reference found:
(suricata-yaml.rst:"In 4.1.x")
Fast pattern selection criteria can be internally found by inspecting
SupportFastPatternForSigMatchList and SigTableSetup functions.

Ticket: #6699
(cherry picked from commit 6e4cc79b398d91e243bd1574cbbcbbf7cd021c5d)

18 months agodpdk: rework hugepage hints to use per-numa information
Lukas Sismis [Mon, 30 Oct 2023 11:33:57 +0000 (12:33 +0100)] 
dpdk: rework hugepage hints to use per-numa information

Previous integration of hugepage analysis only fetched data
from /proc/meminfo. However this proved to be often
deceiving mainly for providing only global information and
not taking into account different hugepage sizes (e.g. 1GB
hugepages) and different NUMA nodes.

Ticket: #6697
(cherry picked from commit ca6f7c2d002cdad8eb3630860b5023560626aee0)

18 months agoflow-bypass: Set bypass thread to running state
Vincent Li [Fri, 4 Aug 2023 17:49:35 +0000 (17:49 +0000)] 
flow-bypass: Set bypass thread to running state

When running Suricata in XDP bypass mode (bypass: yes),

Suricata started up with error:
Error: threads: thread "FB" failed to start in time: flags 0003

"FB" thread does not transition from THV_INIT_DONE to THV_RUNNING.

Set "FB" thread THV_RUNNING state in BypassedFlowManager().

Bug: #6254

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
(cherry picked from commit f80d26db0b62d4a547290a1cf536754f79927a3b)

18 months agoipfw: close(2) instead shutdown(2) of the divert(4) socket
Gleb Smirnoff [Thu, 11 Jan 2024 21:35:21 +0000 (13:35 -0800)] 
ipfw: close(2) instead shutdown(2) of the divert(4) socket

The shutdown(2) syscall would always return ENOTCONN for FreeBSD 11,
FreeBSD 12, FreeBSD 13 and FreeBSD 14.  It could do some action on the
socket in the kernel in FreeBSD 10 and before, did not test.

(cherry picked from commit b239e88c9303d83a3074ed69c4989bd136bbf8b4)

18 months agodetect: case-insensitive comparison for requires
Philippe Antoine [Thu, 4 Jan 2024 10:42:55 +0000 (11:42 +0100)] 
detect: case-insensitive comparison for requires

Ticket: 6656
(cherry picked from commit d3218385e942a4a01f3938f0cd7050f5dc7c9a6f)

18 months agosource/erf-dag: compiler warnings
Stephen Donnelly [Wed, 10 Jan 2024 03:39:34 +0000 (16:39 +1300)] 
source/erf-dag: compiler warnings

Bug: #6667.

Fix compiler warnings for function pointer parameters missing const with --enable-dag

(cherry picked from commit c28cc93e23e829dac34ca0170df754ab1063c482)

18 months agoendace: Fix source-dag timestamps
Stephen Donnelly [Mon, 11 Dec 2023 02:32:06 +0000 (15:32 +1300)] 
endace: Fix source-dag timestamps

Bug: #6618.

Fix Endace ERF to SCTime_t timestamp conversion

Fix typo preventing compilation with --enable-dag

(cherry picked from commit 879db3dbc3e93912c784375c85d88404a9371f31)

18 months agostats: add rules skipped 10211/head
Jason Ish [Tue, 19 Dec 2023 18:13:23 +0000 (12:13 -0600)] 
stats: add rules skipped

Rule skipped is a count of the number of rules that are skipped due to
missing requirements.

Feature: #6637
(cherry picked from commit b453eea1502cc5455f383c4fe82c6011fee93495)

18 months agodetect-parse: parse sid in pre-scan
Jason Ish [Wed, 29 Nov 2023 18:57:23 +0000 (12:57 -0600)] 
detect-parse: parse sid in pre-scan

During the pre-scan for "requires", also parse the SID if possible. If
the rule fails high level parsing (syntax), the SID will not be
parsed.

But every keyword other than "sid" and "requires" should expect to be
provided with a parsed sid.

(cherry picked from commit 71bbba9248e696f0fd2e912ad9631052b3788775)

18 months agorequires: pre-scan rule for requires expressions
Jason Ish [Wed, 29 Nov 2023 16:54:54 +0000 (10:54 -0600)] 
requires: pre-scan rule for requires expressions

Add a "pre-scan" rule parse that will check for requires statement. It
will return a special error code (-4) if the requires fails due to
missing requirements.

Syntactic errors will also abort parsing here.

Feature: #5972
(cherry picked from commit 435c03172ed7ebaa117765760e75bdfd38c7fca0)

18 months agorequires: add requires keyword
Jason Ish [Tue, 28 Nov 2023 21:35:09 +0000 (15:35 -0600)] 
requires: add requires keyword

Add a new rule keyword "requires" that allows a rule to require specific
Suricata versions and/or Suricata features to be enabled.

Example:

  requires: feature geoip, version >= 7.0.0, version < 8;
  requires: version >= 7.0.3 < 8
  requires: version >= 7.0.3 < 8 | >= 8.0.3

Feature: #5972

Co-authored-by: Philippe Antoine <pantoine@oisf.net>
(cherry picked from commit 5d5b0509a543f2b6f09cc81acf0248a361b03aa1)

18 months agofeature: provide a Rust binding to the feature API
Jason Ish [Fri, 15 Dec 2023 00:19:41 +0000 (18:19 -0600)] 
feature: provide a Rust binding to the feature API

As the feature module is not available for Rust unit tests, a mock
version is also provided.

(cherry picked from commit 15ed51f9b87011025615245d89152da9c567f49b)

18 months agohtp/swf: Remove flash deprecation notice
Jeff Lucovsky [Tue, 16 Jan 2024 15:36:07 +0000 (10:36 -0500)] 
htp/swf: Remove flash deprecation notice

Issue: 6605

Flash decompression will remain so the deprecation notice is not needed.

(cherry picked from commit 995f5fc8c5fa925e8ac1540f8f4bc2e68df3908a)

18 months agolog/sguil: Issue deprecation notice if sguil mode
Jeff Lucovsky [Tue, 16 Jan 2024 15:10:35 +0000 (10:10 -0500)] 
log/sguil: Issue deprecation notice if sguil mode

Issue: 6688

18 months agouserguide: remove old css files 10196/head
Jason Ish [Thu, 30 Nov 2023 17:46:14 +0000 (11:46 -0600)] 
userguide: remove old css files

In our conf.py we reference some ReadTheDocs stylesheets that appear to
be old and break formatting of some items like bulletted lists.

Bug: #6589
(cherry picked from commit cc0adaaf4a747fbefa5e8d5afec73760cbb8b2f9)

18 months agodetect/stream_size: fix prefiltering registration
Eric Leblond [Sat, 18 Nov 2023 21:07:47 +0000 (22:07 +0100)] 
detect/stream_size: fix prefiltering registration

Ticket: #6551
(cherry picked from commit 180459eeb6c248b70a8b20b1e14f829318bb242d)

18 months agodetect: strip_pseudo_headers transform 10170/head
Philippe Antoine [Tue, 12 Dec 2023 08:34:04 +0000 (09:34 +0100)] 
detect: strip_pseudo_headers transform

Ticket: 6546
(cherry picked from commit adf5e6da7bdf81d65ccfeb115e6bc50e7031a0ca)

18 months agodoc: fix byte_test examples 10143/head
Philippe Antoine [Wed, 6 Dec 2023 19:32:50 +0000 (20:32 +0100)] 
doc: fix byte_test examples

As this keyword has 4 mandatory arguments, and some examples
had only three...

Ticket: 6629
(cherry picked from commit 4933b817aacc649edc52409426500a9ec271ccc6)

18 months agopgsql: fix u16 overflow in query data_row 10137/head
Juliana Fajardini [Wed, 11 Oct 2023 20:24:45 +0000 (17:24 -0300)] 
pgsql: fix u16 overflow in query data_row

Found by oss-fuzz with quadfuzz.

Cf https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63113

According to PostgreSQL documentation the maximum number of rows can be
the maximum of tuples that can fit onto max u32 pages - 4,294,967,295 (cf
https://www.postgresql.org/docs/current/limits.html). Some rough
calculations for that indicate that this could go over max u32, so
updating the data_row data type to u64.

Bug #6389

(cherry picked from commit 8d3de85edda97b0c585253803da3faeccc257942)

18 months agogithub/action: fix Debian 12 intermittent failures
Victor Julien [Thu, 7 Dec 2023 09:07:24 +0000 (10:07 +0100)] 
github/action: fix Debian 12 intermittent failures

Parallel builds caused issues during `cargo vendor`. So do just a single
thread build.

 make[4]: Entering directory '/__w/suricata/suricata/rust'
cbindgen --config /__w/suricata/suricata/rust/cbindgen.toml \
--quiet --output /__w/suricata/suricata/rust/dist/rust-bindings.h
CARGO_HOME="/github/home/.cargo"  /usr/bin/cargo vendor
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
ERROR: Couldn't execute `cargo metadata` with manifest "/__w/suricata/suricata/rust/Cargo.toml": Metadata(Output { status: ExitStatus(unix_wait_status(25856)), stdout: "", stderr: "    Blocking waiting for file lock on package cache\n    Blocking waiting for file lock on package cache\nerror: failed to download `adler v1.0.2`\n\nCaused by:\n  unable to get packages from source\n\nCaused by:\n  failed to parse manifest at `/github/home/.cargo/registry/src/github.com-1ecc6299db9ec823/adler-1.0.2/Cargo.toml`\n\nCaused by:\n  no targets specified in the manifest\n  either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n" })
ERROR: Couldn't generate bindings for /__w/suricata/suricata/rust.
make[4]: *** [Makefile:597: dist/rust-bindings.h] Error 1
make[4]: *** Waiting for unfinished jobs....

(cherry picked from commit c82d93490c4b41f3047f78aa34c4e135ddbf2c79)

18 months agodetect/bytejump: don't reuse content flag
Victor Julien [Fri, 8 Dec 2023 08:38:38 +0000 (09:38 +0100)] 
detect/bytejump: don't reuse content flag

To avoid future problems with overlapping flag values, give bytejump
its own DETECT_BYTEJUMP_OFFSET_VAR flag.

The values are currently not overlapping, so this patch should have
no side effects.

(cherry picked from commit 101452056d559b4e5eab27c2d9fb651d2e32c412)

18 months agodetect/analyzer: print int keyword values correctly
Victor Julien [Fri, 8 Dec 2023 09:31:21 +0000 (10:31 +0100)] 
detect/analyzer: print int keyword values correctly

To avoid negative values to be misrepresented.

Bug: #6615.
(cherry picked from commit de5b8ae0b45636352e641cff7eeb4f1fc89c8129)

18 months agojsonbuilder: add set_int for signed ints
Victor Julien [Fri, 8 Dec 2023 09:30:25 +0000 (10:30 +0100)] 
jsonbuilder: add set_int for signed ints

Bug: #6615
(cherry picked from commit b8440a0917548061049df19e4d42200df67cb478)

18 months agorust: allow clippy::items_after_test_module
Philippe Antoine [Thu, 4 Jan 2024 08:51:33 +0000 (09:51 +0100)] 
rust: allow clippy::items_after_test_module

As clippy began to complain about jsonbuilder.rs

(cherry picked from commit 673d13d44555843883915eb691b58a195ad021e8)

18 months agodetect/profiling: improve pcap reading performance
Victor Julien [Sat, 16 Dec 2023 15:45:00 +0000 (16:45 +0100)] 
detect/profiling: improve pcap reading performance

When reading a pcap, packet time can move much faster than wall
clock time. This would trigger many more profile syncs than before.

As the sync is using a lock to synchronize with other threads, this
is an expensive operation.

Bug: #6619.

Fixes: b591813b8690 ("profiling/rules: reduce sync logic scope")
(cherry picked from commit bcb2b50cfc34430e0e91dea781c90d2259ef8f0d)

18 months agodetect/content: fix offset for negative distance
Victor Julien [Wed, 20 Dec 2023 20:40:47 +0000 (21:40 +0100)] 
detect/content: fix offset for negative distance

Fix offset calculation on sigs with negative distance. Can lead to FN
in certain cases.

Bug: #6661.
(cherry picked from commit 2911656d6c11e8ef64a55ce64216382cd22151fe)

18 months agoeve/email: improve logging binary data
Victor Julien [Mon, 8 Jan 2024 06:43:04 +0000 (07:43 +0100)] 
eve/email: improve logging binary data

Use jb_append_string_from_bytes() as it works better than
BytesToString+jb_append_string when logging binary data.

Bug: #6664.
(cherry picked from commit f5565f42e7ae993963d7135271813ff30780bc96)

19 months agostats: incr app-proto flow counter for detection-only 10099/head
Philippe Antoine [Thu, 14 Dec 2023 10:31:37 +0000 (11:31 +0100)] 
stats: incr app-proto flow counter for detection-only

Ticket: 6633
(cherry picked from commit 3103505cb0fa87f18b63434a94c1b3814f5b8003)

19 months agopgsql: remove unused msg field 10081/head
Juliana Fajardini [Fri, 15 Dec 2023 16:57:01 +0000 (13:57 -0300)] 
pgsql: remove unused msg field

The `ConsolidatedDataRow` struct had a `length` field that wasn't truly
used.

Related to
Bug #6389

(cherry picked from commit 1afb485dfa253f4b409fa1acf0b7790cf1d2f09b)

19 months agodetect/transform: Clarify transformation validation 10067/head 10068/head
Jeff Lucovsky [Tue, 14 Nov 2023 13:23:43 +0000 (08:23 -0500)] 
detect/transform: Clarify transformation validation

Issue: 6439

Clarify the transform validation step. When a transform indicates that
the content/byte-array is not compatible, validation will stop.

Content is incompatible is some cases -- e.g., following the
to_lowercase transform with content containing uppercase characters.
An alert is not possible since the content contains uppercase and the
transform has converted the buffer into all lowercase.

(cherry picked from commit a46779d866b1b121adc73164215ba6437f53c208)

19 months agodetect/transform: Register case-change transforms
Jeff Lucovsky [Thu, 9 Nov 2023 13:35:46 +0000 (08:35 -0500)] 
detect/transform: Register case-change transforms

Issue: 6439
(cherry picked from commit 1110a86cb9bc3815aec2db1b5cc3253d63db53f5)

19 months agodoc/transform: Document case-changing transforms.
Jeff Lucovsky [Thu, 9 Nov 2023 11:22:55 +0000 (06:22 -0500)] 
doc/transform: Document case-changing transforms.

Issue: 6439
(cherry picked from commit 9ee55d23949a1bb42e6b48429d720fcc6c15147b)

19 months agodetect/transform: Add case changing transforms
Jeff Lucovsky [Thu, 9 Nov 2023 10:39:33 +0000 (05:39 -0500)] 
detect/transform: Add case changing transforms

This commit adds the implementation for the case changing transforms:
to_lowercase and to_uppercase

Issue: 6439
(cherry picked from commit e5c2f9a56dee82fc498d85aec68d028b89237544)

19 months agodetect/transform: Add case-change transform constants
Jeff Lucovsky [Thu, 9 Nov 2023 10:38:44 +0000 (05:38 -0500)] 
detect/transform: Add case-change transform constants

Add the constants for the to_lowercase and to_uppercase transforms

Issue: 6439
(cherry picked from commit ffd559cd8e941dafaa2f143437a1253abb77c745)

19 months agouserguide/eve: explain pgsql requests & responses 10063/head 10065/head
Juliana Fajardini [Mon, 11 Dec 2023 20:55:37 +0000 (17:55 -0300)] 
userguide/eve: explain pgsql requests & responses

Add a more visible explanation of that requests, responses, frontend and
and backend are, in Pgsql context, to avoid having to repeat that over
different portions of the docs.

(cherry picked from commit bba3d4fc6375b62b774ad584a953442da9f4cbde)

19 months agopgsql: add cancel request message
Juliana Fajardini [Mon, 11 Dec 2023 20:10:13 +0000 (17:10 -0300)] 
pgsql: add cancel request message

A CanceldRequest can occur after any query request, and is sent over a
new connection, leading to a new flow. It won't take any reply, but, if
processed by the backend, will lead to an ErrorResponse.

Task #6577

(cherry picked from commit 30ac77ce65ece4a84ebd5cd64e3f741cd9b0c1bf)

19 months agodoc/eve-format: break pgsql section to char limit
Juliana Fajardini [Mon, 11 Dec 2023 20:26:31 +0000 (17:26 -0300)] 
doc/eve-format: break pgsql section to char limit

(cherry picked from commit 7dcc2e7a713de20af0dbc1e935ec791cba2e6f95)

19 months agopgsql: extract length validation into function
Juliana Fajardini [Thu, 30 Nov 2023 21:55:13 +0000 (18:55 -0300)] 
pgsql: extract length validation into function

This is called so many times that it seems to make sense that we use a
function for this.

(cherry picked from commit 7fa8bbfe43f396215238e7d8a2b7ce94a22560bc)

19 months agohttp2: do not have leading space for response line 10046/head 10055/head
Philippe Antoine [Sun, 19 Nov 2023 19:28:28 +0000 (20:28 +0100)] 
http2: do not have leading space for response line

Ticket: 6547
(cherry picked from commit 1b5e04bee3c8bb0469b53af0059ec86ce15f9b9c)

19 months agodetect: header_lowercase transform 10038/head
Philippe Antoine [Thu, 9 Nov 2023 08:57:58 +0000 (09:57 +0100)] 
detect: header_lowercase transform

Ticket: 6290
(cherry picked from commit 32cce122e1d8bb568cd5ff1b0db51c488cfb9f58)

19 months agopgsql: don't log password msg if password disabled
Juliana Fajardini [Tue, 5 Dec 2023 13:56:28 +0000 (10:56 -0300)] 
pgsql: don't log password msg if password disabled

If the logging of the password is disabled, there isn't much point in
logging the password message itself.

(cherry picked from commit bdec2d8ea80cf69a8d1ce9c4505452f17f6058fe)

19 months agopgsql: remove probe_ts function 10020/head
Juliana Fajardini [Mon, 27 Nov 2023 20:01:33 +0000 (17:01 -0300)] 
pgsql: remove probe_ts function

With the changes in the probing_ts function, this other one could become
obsolete. Remove it, and directly call `parser::parse_request` when
checking for gaps, instead.

(cherry picked from commit 9aeeac532eadc57c399b17d364d7337c5c69bd8e)

19 months agopgsql: remove unused error handling call
Juliana Fajardini [Mon, 27 Nov 2023 20:17:11 +0000 (17:17 -0300)] 
pgsql: remove unused error handling call

(cherry picked from commit 53d29f652ac0fe3ce342140d88492b077b0f2c01)

19 months agopgsql: don't log unknown message type
Juliana Fajardini [Mon, 27 Nov 2023 20:16:52 +0000 (17:16 -0300)] 
pgsql: don't log unknown message type

(cherry picked from commit afd6e4dc414708f12c46b251d2ca8df1afd3f66b)

19 months agopgsql: fix probing functions
Juliana Fajardini [Thu, 23 Nov 2023 11:14:24 +0000 (08:14 -0300)] 
pgsql: fix probing functions

Some non-pgsql traffic seen by Suricata is mistankenly identified as
pgsql, as the probing function is too generic. Now, if the parser sees
an unknown message type, even if it looks like pgsql, it will fail.

Bug #6080

(cherry picked from commit 4f85d061926e870a48aeaf13bdbb4666ad7fc07e)

19 months agopgsql: add unknonwn frontend message type
Juliana Fajardini [Mon, 27 Nov 2023 20:22:19 +0000 (17:22 -0300)] 
pgsql: add unknonwn frontend message type

We had unkonwn message type for the backend, but not the frontend
messages. It's important to better identify those to improve pgsql
probing functions.

Related to
Bug #6080

(cherry picked from commit 1ac5d97259994f73e64533366d74e40f9fe22694)

19 months agogithub-ci: add cherry-pick line check
Victor Julien [Mon, 5 Sep 2022 07:08:39 +0000 (09:08 +0200)] 
github-ci: add cherry-pick line check

19 months agoutil/time: Improve usecs handling in time macros 10013/head
Stephen Donnelly [Tue, 28 Nov 2023 21:23:45 +0000 (10:23 +1300)] 
util/time: Improve usecs handling in time macros

Fix SCTIME_ADD_SECS zeroing subsecond part

When adding s seconds to SCtime_t ts, don't zero out the ts.usecs field.

Issue: 6584

Fix SCTIME_FROM_TIMESPEC garbage microseconds part

When converting nanosecond to microseconds divide by 1000 instead
of multiplying by 1000.

Issue: 6585
(cherry picked from commit 0850e3d137e553e22fd8f598d276794ddd098c41)

19 months agonapatech: Fix packet timestamps
Ilya Bakhtin [Fri, 29 Sep 2023 14:56:48 +0000 (16:56 +0200)] 
napatech: Fix packet timestamps

Initialize both seconds and useconds of packet timestamp from napatech
timestamp format.

This commit uses updated macro definitions from util-utime.h to avoid
zero seconds value.

Issue: 6372
(cherry picked from commit 417806ca35e643d4120552ac569bba7484295e70)

19 months agoutil/time: Prevent usecs overflow
Ilya Bakhtin [Fri, 29 Sep 2023 14:23:04 +0000 (16:23 +0200)] 
util/time: Prevent usecs overflow

This commit takes care of original seconds value and prevents the
useconds field from overflowing pas its maximum value.

Issue: 6372
(cherry picked from commit d3095ac0589228a4c63a466f5ff3b99bab98bf25)

20 months agodoc: update file.data keyword documentation 9863/head
jason taylor [Thu, 16 Nov 2023 13:49:50 +0000 (13:49 +0000)] 
doc: update file.data keyword documentation

Signed-off-by: jason taylor <jtfas90@gmail.com>
20 months agouserguide: update tls not_after/not_before mentions 9855/head
Juliana Fajardini [Thu, 16 Nov 2023 17:37:32 +0000 (14:37 -0300)] 
userguide: update tls not_after/not_before mentions

Our tls fields not_after and not_before are actually logged as
`notafter` and `notbefore`, but were documented with the underscore.

Update the documentation, since updating the log format itself would be
a breaking change.

Task #5494

(cherry picked from commit a649a92afd4ed71b264ee1df408875322d9dfaf9)

20 months agouserguide: document flow_id, with examples
Juliana Fajardini [Tue, 14 Nov 2023 09:46:31 +0000 (06:46 -0300)] 
userguide: document flow_id, with examples

Flow_id explanation expanded from version shared by Peter Manev.

Task #6445

(cherry picked from commit 58fb559594f8e00e9c63dcb9fee167d694689fd4)

20 months agodoc/userguide: add tag keyword page 9826/head
Victor Julien [Wed, 15 Nov 2023 08:11:32 +0000 (09:11 +0100)] 
doc/userguide: add tag keyword page

Ticket: #3015.
(cherry picked from commit 6b2c33990f2c61643d94c74396f930e465305b38)

20 months agodoc/userguide: document host table yaml settings
Victor Julien [Wed, 15 Nov 2023 09:13:14 +0000 (10:13 +0100)] 
doc/userguide: document host table yaml settings

(cherry picked from commit 4a02a14df1be3821042b1c60e3722b114d26fa14)

20 months agohttp2: app-layer event for userinfo in uri 9820/head
Philippe Antoine [Tue, 7 Nov 2023 16:23:23 +0000 (17:23 +0100)] 
http2: app-layer event for userinfo in uri

Ticket: #6426

as per RFC 9113
":authority" MUST NOT include the deprecated userinfo subcomponent
for "http" or "https" schemed URIs.

(cherry picked from commit e3cd0d073f18a9d760e332852d53bce080ea96f0)

20 months agomacset: remove dead flow init/cleanup code 9789/head
Victor Julien [Fri, 8 Sep 2023 08:01:41 +0000 (10:01 +0200)] 
macset: remove dead flow init/cleanup code

FlowInit() will only be called on a newly allocated, or a fully cleaned
up flow, so no existing storage will exist.

The only caller of `FLOW_RECYCLE` first calls `FlowFreeStorage()`, so
the reset logic in `FLOW_RECYCLE` can never trigger.

Remove now unused MacSetReset logic.

20 months agodetect/flow: fix DETECT_FLOW_FLAG_ESTABLISHED check
daniel zhao [Tue, 14 Nov 2023 11:04:10 +0000 (19:04 +0800)] 
detect/flow: fix DETECT_FLOW_FLAG_ESTABLISHED check

Ticket: #6448

20 months agogithub-ci: Fedora 37 to 39; use packaged cbindgen
Victor Julien [Sat, 16 Sep 2023 09:17:58 +0000 (11:17 +0200)] 
github-ci: Fedora 37 to 39; use packaged cbindgen

20 months agooutputs: call plugin ThreadDeinit, not Deinit
Jason Ish [Wed, 1 Nov 2023 22:57:39 +0000 (16:57 -0600)] 
outputs: call plugin ThreadDeinit, not Deinit

With the change to the hash table for tracking threaded loggers, this
call is now called once per thread, so should be changed to the
ThreadDeinit, as that is not longer being called.

Then call Deinit for the primary logger. In threaded mode this would be
the parent, its just the logger in non-threaded mode.

Bug: #6438

20 months agoeve: remove some dead code
Jason Ish [Mon, 30 Oct 2023 23:05:50 +0000 (17:05 -0600)] 
eve: remove some dead code

20 months agohttp2: normalize host when there is user info
Philippe Antoine [Thu, 9 Nov 2023 13:19:59 +0000 (14:19 +0100)] 
http2: normalize host when there is user info

Ticket: 6479

20 months agohttp2: update brotli crate 9767/head
Philippe Antoine [Wed, 8 Nov 2023 10:12:59 +0000 (11:12 +0100)] 
http2: update brotli crate

Fixes debug assertion found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63144

20 months agohttp2: event on mismatch between authority and host 9748/head
Philippe Antoine [Mon, 6 Nov 2023 15:38:27 +0000 (16:38 +0100)] 
http2: event on mismatch between authority and host

Ticket: #6425

21 months agodetect: parse units for integers 9745/head
Philippe Antoine [Mon, 6 Nov 2023 13:42:42 +0000 (14:42 +0100)] 
detect: parse units for integers

Ticket: #6423

Especially for filesize, instead of just a number, a signature
can use a number and a unit such as kb, mb or Gb

21 months agodoc/rule-profiling: fix suricatasc typo 9736/head
Kirjan Kohuladas [Wed, 1 Nov 2023 19:29:57 +0000 (15:29 -0400)] 
doc/rule-profiling: fix suricatasc typo

21 months agoprivs: refactor SCGetUser/GroupID to void functions
Lukas Sismis [Fri, 8 Sep 2023 09:13:26 +0000 (11:13 +0200)] 
privs: refactor SCGetUser/GroupID to void functions

SCGetUserID/SCGetGroupID either FatalErrored out or
returned zero. As a result, the functions got refactored
into non-returning void functions.

21 months agoprivs: hint the user of unset user/group name
Lukas Sismis [Fri, 8 Sep 2023 09:13:01 +0000 (11:13 +0200)] 
privs: hint the user of unset user/group name

Ticket: #6278

21 months agopacketpool: signal waiter within lock 9727/head
Victor Julien [Thu, 14 Sep 2023 04:49:31 +0000 (06:49 +0200)] 
packetpool: signal waiter within lock

Needed for predictable scheduling. From pthread_cond_signal man page:

"The pthread_cond_signal() or pthread_cond_broadcast() functions may
 be called by a thread whether or not it currently owns the mutex that
 threads calling pthread_cond_wait() or pthread_cond_timedwait() have
 associated with the condition variable during their waits; however, if
 predictable scheduling behaviour is required, then that mutex is locked
 by the thread calling pthread_cond_signal() or pthread_cond_broadcast()."

21 months agopacketpool: return one packet as well on sync now
Victor Julien [Tue, 12 Sep 2023 10:27:03 +0000 (12:27 +0200)] 
packetpool: return one packet as well on sync now

If a thread is hitting the packet pool return on a 'sync_now' return
the packet also if it is the first packet since the last flush.

Bug: #6435.

21 months agopacketpool: remove WaitForN logic as it is unused
Victor Julien [Tue, 12 Sep 2023 10:15:54 +0000 (12:15 +0200)] 
packetpool: remove WaitForN logic as it is unused

21 months agoflow/timeout: no need to wait for packetpool
Victor Julien [Tue, 12 Sep 2023 10:13:52 +0000 (12:13 +0200)] 
flow/timeout: no need to wait for packetpool

The timeout logic no longer passes packets around, so don't depend
on the packet pool.

Bug: #6292.

21 months agohost/iprep: run all timeout logic
Victor Julien [Mon, 11 Sep 2023 05:05:48 +0000 (07:05 +0200)] 
host/iprep: run all timeout logic

Run all timeout logic if iprep is in use as well.

Minor code cleanups.

Bug: #6436.

21 months agodetect/urilen: fix discontinue matching logic
Victor Julien [Fri, 22 Sep 2023 07:48:15 +0000 (09:48 +0200)] 
detect/urilen: fix discontinue matching logic

Actually discontinue matching.

Fixes: 21f9cc3a39a0 ("discontinue matching on buffer if urilen returns a match failure.")
21 months agodetect/bytetest: convert unittests to FAIL/PASS 9716/head
Daniel Olatunji [Tue, 31 Oct 2023 00:09:43 +0000 (00:09 +0000)] 
detect/bytetest: convert unittests to FAIL/PASS

Issue: #6332

21 months agodns/eve: make removed v1 style a warning, not an error 9714/head
Jason Ish [Mon, 30 Oct 2023 18:16:33 +0000 (12:16 -0600)] 
dns/eve: make removed v1 style a warning, not an error

We don't error out in this case, but instead default to v2. So use a
warning instead of an error.

21 months agodns/eve: use default formats if formats is empty
Jason Ish [Fri, 27 Oct 2023 16:19:31 +0000 (10:19 -0600)] 
dns/eve: use default formats if formats is empty

If the configuration field "formats" is empty, DNS response records do
not have any relevant information other than that there was a
response, but not much about the response.

I'm pretty sure the intention here was to log the response details if
no formats were provided, which is what happens when the field is
commented out.

So if no formats are specified, use the default of all.

Bug: #6420

21 months agodetect/bytejump: convert unittests to FAIL/PASS
Daniel Olatunji [Mon, 30 Oct 2023 01:13:17 +0000 (01:13 +0000)] 
detect/bytejump: convert unittests to FAIL/PASS

Issue: #6328

21 months agorunmodes: remove obsolete references to pcap auto modes
Jason Ish [Fri, 27 Oct 2023 22:58:08 +0000 (16:58 -0600)] 
runmodes: remove obsolete references to pcap auto modes

These auto modes were remove many years ago. Also cleanup the wording
a little.

Task: #6427

21 months agodetect/bytejump: Improve end-of-buffer handling
Jeff Lucovsky [Fri, 27 Oct 2023 13:10:47 +0000 (09:10 -0400)] 
detect/bytejump: Improve end-of-buffer handling

Issue: 4623

This commit addresses the issues reported in issue 4623 when the jump
value points at the last byte in the buffer.

21 months agodetect/bytejump: Remove unused "Match" function
Jeff Lucovsky [Fri, 27 Oct 2023 13:09:43 +0000 (09:09 -0400)] 
detect/bytejump: Remove unused "Match" function

Issue: 4623

DetectBytejumpMatch is no longer used -- it's counterpart --
DetectByteJumpDoMatch is and will remain.

21 months agounix-manager: prioritize the shutdown check
Lukas Sismis [Mon, 25 Sep 2023 13:37:07 +0000 (15:37 +0200)] 
unix-manager: prioritize the shutdown check

Make sure Suricata is in the running state before
you attempt to execute commands on the Unix sockets.
UnixMain is being called in an infinite loop where
TmThreadsCheckFlag(th_v, THV_KILL) is checked for the
deinit phase. However, it may take some time between
the start of Suricata's deinitialization and
the receipt of THV_KILL flag in the Unix thread.

In between this time period, the Unix manager can still
perform select() operation on the Unix socket while
the socket being already deinitialized.

Likely with a longer time span between the initial shutdown
command and actual closing of Unix sockets resulted in
an error of invalid file descriptors.

Ticket: #6272

21 months agogithub: improve template CLA request info 9701/head
Juliana Fajardini [Mon, 23 Oct 2023 18:25:44 +0000 (15:25 -0300)] 
github: improve template CLA request info

Indicate that the CLA only has to be signed once, as we have had
contributors think that was required for each new PR.

21 months agouserguide: add proper label to RPM install section
Juliana Fajardini [Mon, 23 Oct 2023 18:19:45 +0000 (15:19 -0300)] 
userguide: add proper label to RPM install section

Use a reference label that is stable, instead of one that could change
in case a new section is added above it.

21 months agodetect-tcp-window: Convert unittests to new FAIL/PASS API
Hadiqa Alamdar Bukhari [Mon, 23 Oct 2023 15:25:28 +0000 (20:25 +0500)] 
detect-tcp-window: Convert unittests to new FAIL/PASS API

Task #6339

21 months agoflow-bit: Convert unittests to new FAIL/PASS API
Hadiqa Alamdar Bukhari [Fri, 20 Oct 2023 21:25:50 +0000 (02:25 +0500)] 
flow-bit: Convert unittests to new FAIL/PASS API

Task #6329

21 months agoutil-misc: Convert unittests to new FAIL/PASS API
Hadiqa Alamdar Bukhari [Thu, 19 Oct 2023 19:40:50 +0000 (00:40 +0500)] 
util-misc: Convert unittests to new FAIL/PASS API

Task #6345

21 months agomisc: improve code documentation
Liza Opar [Thu, 12 Oct 2023 11:07:48 +0000 (14:07 +0300)] 
misc: improve code documentation

Task #6383

21 months agorust: remove cbindgen:ignore on frames module
Daniel Olatunji [Thu, 12 Oct 2023 11:13:41 +0000 (11:13 +0000)] 
rust: remove cbindgen:ignore on frames module

This directive is no longer required, and does
mess up the rustdoc description of the module.

21 months agorust/doc: add docstring to rust module files.
Daniel Olatunji [Wed, 11 Oct 2023 19:24:03 +0000 (19:24 +0000)] 
rust/doc: add docstring to rust module files.

Issue: #4584

21 months agodoc: be consistent with the use of "sudo"
Daniel Olatunji [Wed, 11 Oct 2023 21:42:47 +0000 (21:42 +0000)] 
doc: be consistent with the use of "sudo"

Issue: #5720

21 months agoversion: start development towards 7.0.3
Victor Julien [Thu, 19 Oct 2023 14:13:19 +0000 (16:13 +0200)] 
version: start development towards 7.0.3

21 months agorelease: 7.0.2; update changelog suricata-7.0.2
Shivani Bhardwaj [Wed, 18 Oct 2023 14:14:53 +0000 (19:44 +0530)] 
release: 7.0.2; update changelog

21 months agomime: avoid quadratic complexity in MimeDecAddEntity
Philippe Antoine [Mon, 11 Sep 2023 14:49:48 +0000 (16:49 +0200)] 
mime: avoid quadratic complexity in MimeDecAddEntity

Ticket: #6306

Keep a reference to last child, consume a bit more RAM to save CPU