]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
7 weeks agojson/schema: link file.name to email.attachment 13423/head
Alice Akaki [Wed, 4 Jun 2025 00:26:48 +0000 (20:26 -0400)] 
json/schema: link file.name to email.attachment

As a Suricata keyword.

Ticket: #7683

7 weeks agodoc/upgrade: note about dns address swap on responses 13419/head
Jason Ish [Tue, 10 Jun 2025 15:08:01 +0000 (09:08 -0600)] 
doc/upgrade: note about dns address swap on responses

Document the change in DNS addresses for ticket 6400.

Ticket: https://redmine.openinfosecfoundation.org/issues/6400

7 weeks agofuzz: fix -Wshorten-64-to-32 warnings
Philippe Antoine [Thu, 22 May 2025 15:41:36 +0000 (17:41 +0200)] 
fuzz: fix -Wshorten-64-to-32 warnings

Ticket: #6186

7 weeks agoutil: fix -Wshorten-64-to-32 warnings for afpacket
Philippe Antoine [Thu, 22 May 2025 12:59:16 +0000 (14:59 +0200)] 
util: fix -Wshorten-64-to-32 warnings for afpacket

Ticket: #6186

7 weeks agoconfigure: add -Wshorten-64-to-32 to the flags
Philippe Antoine [Tue, 20 May 2025 09:12:59 +0000 (11:12 +0200)] 
configure: add -Wshorten-64-to-32 to the flags

when configure is run with --enable-warnings

Ticket: 6186

Also add -Wimplicit-int-conversion to the flags

Both are not compatible with unit tests

7 weeks agodetect/engine: fix -Wshorten-64-to-32 warnings
Philippe Antoine [Tue, 20 May 2025 09:11:21 +0000 (11:11 +0200)] 
detect/engine: fix -Wshorten-64-to-32 warnings

Ticket: #6186

Especially take care of the case where byte_extract extracts a u64
value that does not fit in a u32

7 weeks agotime: replace usleep by SleepUsec/SleepMsec
Victor Julien [Tue, 10 Jun 2025 10:47:25 +0000 (12:47 +0200)] 
time: replace usleep by SleepUsec/SleepMsec

Helps cross platform support, esp Windows

7 weeks agothreads: clean up module flags
Victor Julien [Tue, 10 Jun 2025 10:40:21 +0000 (12:40 +0200)] 
threads: clean up module flags

Remove unused TM_FLAG_STREAM_TM.

Rename TM_FLAG_DETECT_TM to TM_FLAG_FLOWWORKER_TM as it was mostly used
to check if a thread is a flow worker. TM_FLAG_DETECT_TM was always set
for a flow worker, even when there was no detection in use.

7 weeks agothreading: fix shutdown of IPS autofp modes
Victor Julien [Tue, 10 Jun 2025 09:33:03 +0000 (11:33 +0200)] 
threading: fix shutdown of IPS autofp modes

For IPS modes with a verdict thread in autofp there was an issue with
the verdict thread not shutting down, leading to a long shutdown time
until an error condition was reached.

The problem was that when the packet threads, of which the verdict
thread is one, were told to enter their flow timeout loop the verdict
thread got stuck as it immediately progressed to THV_RUNNING_DONE
instead of the expected THV_FLOW_LOOP.

This patch updates the shutdown logic to only apply the flow timeout
logic to the relevant threads, and skip the verdict thread(s).

Add TM_FLAG_VERDICT_TM to indicate a thread has a verdict module to more
explicitly shut it down.

Fixes: 12f8f03532e5 ("threads: fix autofp shutdown race condition")
Bug: #7681.

7 weeks agorust: bindgen AppLayerParserConfParserEnabled
Philippe Antoine [Tue, 10 Jun 2025 08:08:57 +0000 (10:08 +0200)] 
rust: bindgen AppLayerParserConfParserEnabled

Ticket: 7667

7 weeks agorust: bindgen SCAppLayerParserRegisterLogger
Philippe Antoine [Tue, 10 Jun 2025 08:01:15 +0000 (10:01 +0200)] 
rust: bindgen SCAppLayerParserRegisterLogger

Ticket: 7667

7 weeks agorust: bindgen AppLayerParserRegisterParserAcceptableDataDirection
Philippe Antoine [Tue, 10 Jun 2025 07:53:45 +0000 (09:53 +0200)] 
rust: bindgen AppLayerParserRegisterParserAcceptableDataDirection

Ticket: 7667

7 weeks agorust: bindgen AppLayerParserSetStreamDepth
Philippe Antoine [Tue, 10 Jun 2025 07:49:10 +0000 (09:49 +0200)] 
rust: bindgen AppLayerParserSetStreamDepth

Ticket: 7667

7 weeks agorust: bindgen SCAppLayerParserStateIssetFlag
Philippe Antoine [Tue, 10 Jun 2025 07:33:19 +0000 (09:33 +0200)] 
rust: bindgen SCAppLayerParserStateIssetFlag

Ticket: 7667

7 weeks agorust: bindgen AppLayerParserStateSetFlag
Philippe Antoine [Mon, 9 Jun 2025 20:12:44 +0000 (22:12 +0200)] 
rust: bindgen AppLayerParserStateSetFlag

Ticket: 7667

7 weeks agosrc: clean includes for app-layer-parser.h
Philippe Antoine [Mon, 9 Jun 2025 20:05:12 +0000 (22:05 +0200)] 
src: clean includes for app-layer-parser.h

To prepare bindgening

7 weeks agodetect/config: add flow tracking doc 13410/head
Victor Julien [Sat, 24 May 2025 07:23:01 +0000 (09:23 +0200)] 
detect/config: add flow tracking doc

7 weeks agodetect/config: remove unused include
Victor Julien [Sat, 24 May 2025 07:22:36 +0000 (09:22 +0200)] 
detect/config: remove unused include

7 weeks agodetect/config: add func docs
Victor Julien [Sat, 24 May 2025 05:44:48 +0000 (07:44 +0200)] 
detect/config: add func docs

7 weeks agodetect/config: remove filestore reference from comments
Victor Julien [Sat, 24 May 2025 05:43:14 +0000 (07:43 +0200)] 
detect/config: remove filestore reference from comments

7 weeks agodetect/config: add support for skipping flow tracking
Victor Julien [Wed, 21 May 2025 10:17:01 +0000 (12:17 +0200)] 
detect/config: add support for skipping flow tracking

Allow rules in the `pre_flow` hook to disable flow tracking for a
packet:

    config:packet tcp:pre_flow any any <> any 12345 (           \
        config: tracking disable, type flow, scope packet;      \
        sid:1;)

This rule will be evaluated before a packet is handled by the flow
engine, and a match will ensure that the flow engine is skipped.

Ticket: #7715.

7 weeks agodetect: set detect table for non-firewall mode as well
Victor Julien [Thu, 5 Jun 2025 08:43:22 +0000 (10:43 +0200)] 
detect: set detect table for non-firewall mode as well

This also exposed a difference between the handling of TD alerts in
firewall vs non-firewall mode. In firewall mode the table/hook is also
part of the alert ordering to make sure actions from packet:td are
applied before app:td. Handle that explicitly for now.

7 weeks agodetect/config: allow setting a scope for action config
Victor Julien [Wed, 21 May 2025 10:15:03 +0000 (12:15 +0200)] 
detect/config: allow setting a scope for action config

7 weeks agoutil/config: comment out unused types
Victor Julien [Wed, 21 May 2025 10:11:56 +0000 (12:11 +0200)] 
util/config: comment out unused types

7 weeks agodetect/config: clean up keyword value parsing
Victor Julien [Wed, 21 May 2025 08:47:52 +0000 (10:47 +0200)] 
detect/config: clean up keyword value parsing

7 weeks agodetect: clean up signature validate logic
Victor Julien [Thu, 5 Jun 2025 07:48:26 +0000 (09:48 +0200)] 
detect: clean up signature validate logic

`SigValidate` was doing more than just validation. Break out the
function into validation steps and consolidation steps.

7 weeks agodetect: tables support per keyword
Victor Julien [Thu, 29 May 2025 12:56:02 +0000 (14:56 +0200)] 
detect: tables support per keyword

Allow keywords to specify in which detect table they can function.

E.g. the pre_flow table will not support flow keywords, as no flow is
availble at this time.

7 weeks agodetect: use accept:hook policy for pre_* hooks
Victor Julien [Wed, 21 May 2025 10:13:22 +0000 (12:13 +0200)] 
detect: use accept:hook policy for pre_* hooks

Set firewall policy in scratch pad. Default to drop:packet for filter tables,
use accept:hook for pre_stream and pre_hook.

7 weeks agodetect: add pre_flow hook
Victor Julien [Tue, 20 May 2025 14:15:15 +0000 (16:15 +0200)] 
detect: add pre_flow hook

Allows dropping of packets before a flow is created/updated.
Directionless as direction is inferred from the flow.

Ticket: #7714.

7 weeks agodetect: add pre_stream hook
Victor Julien [Wed, 14 May 2025 10:16:46 +0000 (12:16 +0200)] 
detect: add pre_stream hook

Meant to be used from the detection engine, to allow rules to drop
traffic before it modifies the stream state.

Ticket: #7712.

7 weeks agodetect: add tcp.wscale keyword
Victor Julien [Sat, 17 May 2025 19:37:50 +0000 (21:37 +0200)] 
detect: add tcp.wscale keyword

Allows matching on wscale option value in TCP header options.

Ticket: #7713.

7 weeks agoflow-worker: use explicit type for DetectEngineThreadCtx
Victor Julien [Tue, 20 May 2025 08:00:03 +0000 (10:00 +0200)] 
flow-worker: use explicit type for DetectEngineThreadCtx

7 weeks agodetect: only reset packet alert things in unittest mode
Victor Julien [Sat, 17 May 2025 10:21:57 +0000 (12:21 +0200)] 
detect: only reset packet alert things in unittest mode

7 weeks agodetect: pass de_ctx around as const
Victor Julien [Fri, 16 May 2025 14:19:33 +0000 (16:19 +0200)] 
detect: pass de_ctx around as const

7 weeks agodetect/bsize: constify signature pointer in callback
Victor Julien [Wed, 4 Jun 2025 08:51:54 +0000 (10:51 +0200)] 
detect/bsize: constify signature pointer in callback

7 weeks agodetect/absent: constify signature pointer in callback
Victor Julien [Wed, 4 Jun 2025 08:50:39 +0000 (10:50 +0200)] 
detect/absent: constify signature pointer in callback

7 weeks agoeve/schema: reformat with clang-format
Victor Julien [Wed, 21 May 2025 14:44:13 +0000 (16:44 +0200)] 
eve/schema: reformat with clang-format

7 weeks agorust: allow some lints in suricatactl and suricatasc
Jason Ish [Mon, 9 Jun 2025 15:28:53 +0000 (09:28 -0600)] 
rust: allow some lints in suricatactl and suricatasc

These are lints we allow in the Suricata Rust source code for style
reasons.

7 weeks agosuricatasc: reconnect on loss of connection
Jason Ish [Mon, 9 Jun 2025 01:43:24 +0000 (19:43 -0600)] 
suricatasc: reconnect on loss of connection

If the connection is lost (for example, Suricata is restarted), try to
re-open the connect and re-execute the command.

This was the behavior of the Python implementation.

Ticket: #7746

7 weeks agoaffinity: avoid zero-division in the CPU selector
Lukas Sismis [Mon, 9 Jun 2025 08:29:11 +0000 (10:29 +0200)] 
affinity: avoid zero-division in the CPU selector

Ticket: 7747

7 weeks agorunmodes: remove redundant NULL check
Lukas Sismis [Mon, 9 Jun 2025 08:05:54 +0000 (10:05 +0200)] 
runmodes: remove redundant NULL check

Ticket: 7747

7 weeks agodetect: Ensure byte* variable usages is for same buffers
Jeff Lucovsky [Sat, 7 Jun 2025 13:25:52 +0000 (09:25 -0400)] 
detect: Ensure byte* variable usages is for same buffers

Issue: 7549

Use the active buffer list to fetch SM variables to ensure that they are
part of the same list so a variable created with bytemath or byteextract
will have context when used with bytejump, e.g

Not needed for content modifiers.

7 weeks agodns: log addresses in order of packet
Jason Ish [Thu, 5 Jun 2025 15:20:08 +0000 (09:20 -0600)] 
dns: log addresses in order of packet

DNS logs have always been logged in flow direction, this can be
confusing as DNS responses have a src_ip of the client, but it makes
more sense to have the src_ip for the server, as that is the src_ip of
the response packet.

As this is a breaking change, limit it DNS v3 logging which was
introduced, and is the default for Suricata 8.0.

Ticket: #6400

8 weeks agooutput: delayed initialization for custom loggers 13397/head
Jason Ish [Thu, 5 Jun 2025 21:41:40 +0000 (15:41 -0600)] 
output: delayed initialization for custom loggers

When a plugin is first initialized, it is too early to register
transaction loggers. Instead, a plugin can register a callback to be
called when Suricata is ready for outputs like transaction loggers to
be registered.

Likewise for library users, there is a window in SuricataInit where
transaction loggers can be registered that library users don't have
access to. So a lifecycle callback useful here as well.

Ticket #7236

8 weeks agopgsql: install rules
Juliana Fajardini [Fri, 6 Jun 2025 18:35:58 +0000 (15:35 -0300)] 
pgsql: install rules

8 weeks agosmtp: trigger raw stream inspection
Shivani Bhardwaj [Fri, 6 Jun 2025 09:36:11 +0000 (15:06 +0530)] 
smtp: trigger raw stream inspection

Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream inspection which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

SMTP parser can handle multiple command lines per direction, however an
SMTP transaction comprises of the full communication starting from HELO
till there's a RST or QUIT request. Appropriate calls to trigger raw stream
inspection have been added on succesful parsing of each full request and response.

Task 7026
Bug 7004

8 weeks agosip: fix inspection direction
Shivani Bhardwaj [Tue, 27 May 2025 07:32:03 +0000 (13:02 +0530)] 
sip: fix inspection direction

8 weeks agodnp3: trigger raw stream inspection
Shivani Bhardwaj [Fri, 23 May 2025 05:31:45 +0000 (11:01 +0530)] 
dnp3: trigger raw stream inspection

Internals
---------
Suricata's stream engine returns data for inspection to the detection
engine from the stream when the chunk size is reached.

Bug
---
Inspection triggered only in the specified chunk sizes may be too late
when it comes to inspection of smaller protocol specific data which
could result in delayed inspection, incorrect data logged with a transaction
and logs misindicating the pkt that triggered an alert.

Fix
---
Fix this by making an explicit call from all respective applayer parsers to
trigger raw stream inspection which shall make the data available for inspection
in the following call of the stream engine. This needs to happen per direction
on the completion of an entity like a request or a response.

Important notes
---------------
1. The above mentioned behavior with and without this patch is
affected internally by the following conditions.
- inspection depth
- stream depth
In these special cases, the inspection window will be affected and
Suricata may not consider all the data that could be expected to be
inspected.
2. This only applies to applayer protocols running over TCP.
3. The inspection window is only considered up to the ACK'd data.
4. This entire issue is about IDS mode only.

DNP3 parser creates a transaction per direction. Appropriate calls to trigger
raw stream inspection have been added on succesful parsing of each request and
response.

Task 7026
Bug 7004

8 weeks agothreading: add unittests for cpu affinity YAML parsing
Lukas Sismis [Sat, 24 May 2025 10:25:23 +0000 (12:25 +0200)] 
threading: add unittests for cpu affinity YAML parsing

8 weeks agoaffinity: error out on defining CPUs outside valid range
Lukas Sismis [Fri, 6 Jun 2025 06:12:49 +0000 (08:12 +0200)] 
affinity: error out on defining CPUs outside valid range

8 weeks agothreading: let cpu set building callback return a value
Lukas Sismis [Sat, 24 May 2025 10:16:50 +0000 (12:16 +0200)] 
threading: let cpu set building callback return a value

8 weeks agothreading: support thread autopinning and interface-specific affinity
Lukas Sismis [Fri, 3 Jan 2025 15:08:36 +0000 (16:08 +0100)] 
threading: support thread autopinning and interface-specific affinity

Using the new configuration format, it is now possible to set CPU affinity
settings per interface.

The threading.autopin option has been added to automatically use CPUs from the
same NUMA node as the interface. The autopin option requires
hwloc-devel / hwloc-dev to be installed and --enable-hwloc flag in configure
script.

Ticket: 7036

8 weeks agodoc: remove title in threading section with no content
Lukas Sismis [Fri, 3 Jan 2025 12:09:49 +0000 (13:09 +0100)] 
doc: remove title in threading section with no content

8 weeks agothreading: support previous threading configuration format
Lukas Sismis [Fri, 3 Jan 2025 12:08:49 +0000 (13:08 +0100)] 
threading: support previous threading configuration format

Provide backward compatibility with the previous configuration
format to allow smooth transition to the new format.
The commit adds docs about the new format and the introduced changes.

8 weeks agothreading: transform *-cpu-set nodes from list items to nodes
Lukas Sismis [Fri, 6 Dec 2024 12:47:43 +0000 (13:47 +0100)] 
threading: transform *-cpu-set nodes from list items to nodes

Part of Ticket 2321 work to remove unnecessary lists from
the config file.

Ticket: 2321

8 weeks agoutil-affinity: move properties of *-cpu-set node one layer up in YAML
Lukas Sismis [Fri, 6 Dec 2024 12:42:21 +0000 (13:42 +0100)] 
util-affinity: move properties of *-cpu-set node one layer up in YAML

8 weeks agothreading: refactor CPU affinity code
Lukas Sismis [Thu, 2 Jan 2025 17:35:52 +0000 (18:35 +0100)] 
threading: refactor CPU affinity code

Split the code into multiple functions for easier readability.

8 weeks agoactions: test hwloc build
Lukas Sismis [Thu, 19 Dec 2024 20:52:20 +0000 (21:52 +0100)] 
actions: test hwloc build

8 weeks agogithub-ci: install hwloc as a mandatory dependency
Lukas Sismis [Tue, 3 Sep 2024 11:23:44 +0000 (13:23 +0200)] 
github-ci: install hwloc as a mandatory dependency

8 weeks agodpdk: move DPDK socket retrieval to utils
Lukas Sismis [Fri, 6 Dec 2024 12:31:13 +0000 (13:31 +0100)] 
dpdk: move DPDK socket retrieval to utils

8 weeks agorunmodes: query the active runmode with a function call
Lukas Sismis [Sun, 8 Dec 2024 14:26:27 +0000 (15:26 +0100)] 
runmodes: query the active runmode with a function call

8 weeks agorust: fix compiler warning for confusing lifetimes 13396/head
Jason Ish [Fri, 6 Jun 2025 15:05:12 +0000 (09:05 -0600)] 
rust: fix compiler warning for confusing lifetimes

For example:

error: lifetime flowing from input to output with different syntax can be confusing
   --> htp/src/headers.rs:475:16
    |
475 | fn null(input: &[u8]) -> IResult<&[u8], ParsedBytes> {
    |                ^^^^^             -----  ----------- the lifetimes get resolved as `'_`
    |                |                 |
    |                |                 the lifetimes get resolved as `'_`
    |                this lifetime flows to the output
    |
note: the lint level is defined here
   --> htp/src/lib.rs:3:9

This currently only happens when using the Rust nightly compiler, which
we use for our fuzz builds.

8 weeks agohs-cache: adjust printing directive to match uint64_t
Lukas Sismis [Fri, 6 Jun 2025 09:22:40 +0000 (11:22 +0200)] 
hs-cache: adjust printing directive to match uint64_t

8 weeks agolua: update to Lua 5.4.8
Jason Ish [Thu, 5 Jun 2025 20:29:22 +0000 (14:29 -0600)] 
lua: update to Lua 5.4.8

Also uses a proper Lua tagged version that is not a pre-release.

Ticket: #7632

8 weeks agorust: update deps
Jason Ish [Thu, 5 Jun 2025 17:47:04 +0000 (11:47 -0600)] 
rust: update deps

Update all deps with cargo update. Additionally, apply the updated
versions to the Cargo.toml, which while not stricly required, does
make it more clear what the version in use is.

8 weeks agorust: fix new clippy issues with MSRV update
Jason Ish [Thu, 5 Jun 2025 17:30:28 +0000 (11:30 -0600)] 
rust: fix new clippy issues with MSRV update

8 weeks agorust: update clap and rustyline
Jason Ish [Thu, 5 Jun 2025 17:23:42 +0000 (11:23 -0600)] 
rust: update clap and rustyline

With a MSRV of 1.75.0 we can now use current Clap. Rustlyline is
updated, but still needs to be held back from the most current
release.

8 weeks agorust: unpin once_cell from old version
Jason Ish [Thu, 5 Jun 2025 17:04:23 +0000 (11:04 -0600)] 
rust: unpin once_cell from old version

We can now update to the current version of once_cell with Rust 1.75.

8 weeks agorust: set MSRV to 1.75.0
Jason Ish [Thu, 5 Jun 2025 16:59:20 +0000 (10:59 -0600)] 
rust: set MSRV to 1.75.0

This is the Rust version found on Ubuntu LTS releases as of today, and
is the oldest we need to support.

Ticket: #6573

8 weeks agodoc/entropy: Document the entropy log output
Jeff Lucovsky [Wed, 4 Jun 2025 13:33:37 +0000 (09:33 -0400)] 
doc/entropy: Document the entropy log output

8 weeks agodetect/entropy: Add calculated entropy value to flowvars
Jeff Lucovsky [Sat, 31 May 2025 14:18:32 +0000 (10:18 -0400)] 
detect/entropy: Add calculated entropy value to flowvars

When the entropy keyword is used, record the calculated entropy value to
a flow variable for logging use.

8 weeks agodoc: Add missing contributors to ack file 13383/head
Jeff Lucovsky [Fri, 30 May 2025 18:59:42 +0000 (14:59 -0400)] 
doc: Add missing contributors to ack file

Add missing contributors as identified by
    git shortlog -s -n --no-merges -- .

8 weeks agodoc/lua: document request_host lua lib
Juliana Fajardini [Thu, 5 Jun 2025 13:55:05 +0000 (10:55 -0300)] 
doc/lua: document request_host lua lib

Seems that we missed bringing this one, when documenting HTTP lua lib
functions.

8 weeks agopop3: install rules
Philippe Antoine [Thu, 5 Jun 2025 11:58:24 +0000 (13:58 +0200)] 
pop3: install rules

8 weeks agopop3: fix event rule
Philippe Antoine [Thu, 5 Jun 2025 11:55:49 +0000 (13:55 +0200)] 
pop3: fix event rule

8 weeks agorust: remove some unneeded cbindgen:ignore
Philippe Antoine [Thu, 5 Jun 2025 09:22:12 +0000 (11:22 +0200)] 
rust: remove some unneeded cbindgen:ignore

Ticket: 7667

8 weeks agorust: bindgen app-layer-detect-proto.h
Philippe Antoine [Thu, 5 Jun 2025 08:29:34 +0000 (10:29 +0200)] 
rust: bindgen app-layer-detect-proto.h

Ticket: 7667

8 weeks agodetect/content: account for distance variables
Jeff Lucovsky [Tue, 17 Dec 2024 12:56:42 +0000 (07:56 -0500)] 
detect/content: account for distance variables

Under some cases (below), the depth and offset values are used
twice. This commit disregards the distance variable (if any), when
computing the final depth.

These rules are logically equivalent::
1. alert tcp any any -> any 8080 (msg:"distance name"; flow:to_server; content:"Authorization:"; content:"5f71ycy"; distance:0; byte_extract:1,0,option_len,string,relative; content:!"|38|"; distance:option_len; within:1; content:"|37|"; distance:-1; within:1; content:"|49|"; distance:option_len; within:1; sid:1;)
2. alert tcp any any -> any 8080 (msg:"distance number"; flow:to_server; content:"Authorization:"; content:"5f71ycy"; distance:0; byte_extract:1,0,option_len,string,relative; content:!"|38|"; distance:7; within:1; content:"|37|"; distance:-1; within:1; content:"|49|"; distance:option_len; within:1; sid:2;)

The differences:
Rule 1: content:!"|38|"; distance:option_len; within:1; //option_len == 7

Rule 2: content:!"|38|"; distance:7; within:1;

Without this commit, rule 2 triggers an alert but rule 1 doesn't.

Issue: 7390

8 weeks agoflow: convert flow_id to uint64 as no signdess is necessary
Lukas Sismis [Sat, 24 May 2025 00:04:21 +0000 (02:04 +0200)] 
flow: convert flow_id to uint64 as no signdess is necessary

8 weeks agodpdk: change thread_id field to uint16_t
Lukas Sismis [Sat, 26 Apr 2025 13:01:36 +0000 (15:01 +0200)] 
dpdk: change thread_id field to uint16_t

8 weeks agodpdk: update types to avoid type-warnings
Lukas Sismis [Sat, 26 Apr 2025 13:00:58 +0000 (15:00 +0200)] 
dpdk: update types to avoid type-warnings

8 weeks agodetect-engine: remove redundant configuration check
Lukas Sismis [Fri, 25 Apr 2025 12:34:58 +0000 (14:34 +0200)] 
detect-engine: remove redundant configuration check

8 weeks agodetect-engine: check return value of SCGetConf
Lukas Sismis [Fri, 25 Apr 2025 12:33:00 +0000 (14:33 +0200)] 
detect-engine: check return value of SCGetConf

Ticket: 7634
coverity id: 1645571

8 weeks agodecode/ipv4: add missing ip-in-ip case handling 13370/head
Juliana Fajardini [Wed, 4 Jun 2025 17:56:25 +0000 (14:56 -0300)] 
decode/ipv4: add missing ip-in-ip case handling

A flow with IPv4 IP in IP traffic won't handle this tunneling case
properly.
This leads to potential malicious traffic not triggering alerts, as well
as other inaccuracies in the logs.

Bug #7725

8 weeks agodecode/ipv4: apply-clang formatting changes
Juliana Fajardini [Wed, 4 Jun 2025 19:33:22 +0000 (16:33 -0300)] 
decode/ipv4: apply-clang formatting changes

8 weeks agodoc/lua: remove reference to removed functions
Jason Ish [Wed, 4 Jun 2025 17:32:11 +0000 (11:32 -0600)] 
doc/lua: remove reference to removed functions

These have all been replaced by libs and already documented in their
lib format.

Ticket: #7728

8 weeks agolua/output: access luastate within lock
Jason Ish [Wed, 4 Jun 2025 17:26:52 +0000 (11:26 -0600)] 
lua/output: access luastate within lock

Fixes Coverity issue:

CID 1648445: (#1 of 1): Data race condition (MISSING_LOCK)
4. missing_lock: Accessing td->lua_ctx->luastate without holding lock
LogLuaCtx_.m. Elsewhere, LogLuaCtx_.luastate is written to with
LogLuaCtx_.m held 41 out of 41 times.

8 weeks agopgsql: fix clippy warnings 13366/head
Juliana Fajardini [Thu, 22 May 2025 13:48:15 +0000 (10:48 -0300)] 
pgsql: fix clippy warnings

8 weeks agopgsql: fix typo in comment that changed meaning
Juliana Fajardini [Tue, 20 May 2025 21:13:18 +0000 (18:13 -0300)] 
pgsql: fix typo in comment that changed meaning

8 weeks agopgsql: debug validation on duplicated request msgs
Juliana Fajardini [Tue, 20 May 2025 15:59:10 +0000 (12:59 -0300)] 
pgsql: debug validation on duplicated request msgs

There shouldn't be duplicated messages in the requests Vec. And thus
the parser shouldn't log duplicated keys nor messages. Add debug
validations to ensure this.

With PGSQL's current state machine, most frontend/ client messages will
lead to the creation of a new transaction - which would prevent
duplicated messages being pushed to the requests array and reaching the
logger.

The current exceptions for that are:

- CopyDataIn
- CopyDone
- CopyFail

Thus, debug statements were added for those cases.

CopyDone and CopyFail, per the documentation, shouldn't be seen
duplicated on the wire for the same transaction. CopyDataIn -- yes, but
we consolidate those, so the expectation is that they won't be
duplicated in the requests array or when reaching the logger either.

Related to
Task #7645

8 weeks agopgsql: separate request completion and state type
Juliana Fajardini [Tue, 20 May 2025 18:56:03 +0000 (15:56 -0300)] 
pgsql: separate request completion and state type

Since some of state types could indicate a request completion, don't
process them in if/else statements.

Related to
Task #7645

8 weeks agopgsql: be more strict with pub usage
Juliana Fajardini [Thu, 22 May 2025 13:28:01 +0000 (10:28 -0300)] 
pgsql: be more strict with pub usage

Review pub visibility to:
Make it pub crate-only wherever possible.
Remove pub altogether where not-needed.

8 weeks agopgsql: reorganize pgsql states for CopyData msgs
Juliana Fajardini [Fri, 16 May 2025 16:17:23 +0000 (13:17 -0300)] 
pgsql: reorganize pgsql states for CopyData msgs

To set apart states that are both for frontend and backend.

8 weeks agopgsql: rename copy in/out response field
Juliana Fajardini [Tue, 13 May 2025 16:33:31 +0000 (13:33 -0300)] 
pgsql: rename copy in/out response field

We used `copy_column_count`, while just `columns` is more accurate with
what PostgreSQL describes, and what Wireshark shows.

Related to
Task #7644
Task #7645

8 weeks agopgsql: rename 'dummy' response variables
Juliana Fajardini [Sat, 10 May 2025 19:35:08 +0000 (16:35 -0300)] 
pgsql: rename 'dummy' response variables

While this could be considered minor, they were not just bad, but
misleading names, as the variables weren't really `dummy` responses,
but consolidating several messages.

8 weeks agopgsql: add initial support to CopyIn mode/subproto
Juliana Fajardini [Tue, 29 Apr 2025 13:33:38 +0000 (10:33 -0300)] 
pgsql: add initial support to CopyIn mode/subproto

This sub-protocol inspects messages sent mainly from the frontend to
the backend after a 'COPY FROM STDIN' has been processed by the
backend.

Parses new messages:
- CopyInResponse -- initiates copy-in mode/sub-protocol
- CopyData (In) -- data transfer message, from frontend to backend
- CopyDone -- signals that no more CopyData messages will be seen from
  the frontend, for the current transaction
- CopyFail -- used by the frontend to signal some failure to proceed
  with sending CopyData messages

Task #7645

8 weeks agoschema/psgql: fix fields order
Juliana Fajardini [Thu, 22 May 2025 16:35:02 +0000 (13:35 -0300)] 
schema/psgql: fix fields order

8 weeks agopgsql: document CopyOut messages
Juliana Fajardini [Thu, 1 May 2025 17:20:41 +0000 (14:20 -0300)] 
pgsql: document CopyOut messages

Related to
Task #7644

8 weeks agopgsql: allow multi-request transactions
Juliana Fajardini [Thu, 1 May 2025 00:48:07 +0000 (21:48 -0300)] 
pgsql: allow multi-request transactions

Important for CopyIn mode/ subprotocol, where the frontend is the one
sending 0 or more messages to the backend as part of a transaction.

Related to
Task #7645

8 weeks agopgsql: make CopyData struct generic
Juliana Fajardini [Tue, 29 Apr 2025 13:31:52 +0000 (10:31 -0300)] 
pgsql: make CopyData struct generic

We have a data structure that can be used both for backend and frontend
messages, but was named as backend only.

Related to
Task #7645