]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
4 months agodetect: delay tx cleanup in some edge case 12730/head
Philippe Antoine [Tue, 25 Feb 2025 09:54:13 +0000 (10:54 +0100)] 
detect: delay tx cleanup in some edge case

Ticket: 7552

f->sgh_toserver may be NULL but because FLOW_SGH_TOSERVER is unset
and thus, we want to delay cleanup until detection has really been
run with the right signature group head.

This may happen for a rule using
`alert tcp any any -> any any` and
a app-layer keyword to client
with a app-layer supporting both udp and tcp
with stream.midstream=true
and with the first packet of a flow being a server response

In this case, we swap the flow and reset its signature group heads

4 months agodetect: reset signature groups when reversing flow
Philippe Antoine [Tue, 25 Feb 2025 09:49:41 +0000 (10:49 +0100)] 
detect: reset signature groups when reversing flow

Ticket: 7552

When we use midstream, and the first packet we see of a flow is
a response from server, and we want to match on some signature
to client :
- we had first set sgh_toserver/FLOW_SGH_TOSERVER as we first
  thought this was a packet to server
- we then swap/reverse the flow, so sgh_toclient becomes sgh_toserver
  but it contains signatures to server and cannot match our
  to_client signature

The detect engine with DetectRunSetup will set again the
signatures group heads properly

4 months agoeve-parity: skip transform keywords 12717/head
Jason Ish [Fri, 21 Feb 2025 20:58:47 +0000 (14:58 -0600)] 
eve-parity: skip transform keywords

4 months agoschema: mark dns.version and dns.grouped as having no keywords
Jason Ish [Thu, 20 Feb 2025 22:13:03 +0000 (16:13 -0600)] 
schema: mark dns.version and dns.grouped as having no keywords

4 months agoschema: mark "stats" and "drop" as having no keywords
Jason Ish [Thu, 20 Feb 2025 22:05:03 +0000 (16:05 -0600)] 
schema: mark "stats" and "drop" as having no keywords

4 months agodetect-dns-response: remove unit tests
Jason Ish [Thu, 20 Feb 2025 18:05:44 +0000 (12:05 -0600)] 
detect-dns-response: remove unit tests

Should have coverage by S-V now.

4 months agoscript/eve-parity: add script for checking eve/keyword parity
Jason Ish [Wed, 19 Feb 2025 22:36:57 +0000 (16:36 -0600)] 
script/eve-parity: add script for checking eve/keyword parity

Currently this script has two commands: "missing" and "having".

"missing" will show eve fields that do not map to any keywords.

"having" will sohw eve fields along with their keyword mappsings,
while also validating that those keywords really exist.

Related to tickets: #6463, #4772

4 months agoschema: add an object for mapping fields to keywords
Jason Ish [Wed, 19 Feb 2025 22:34:22 +0000 (16:34 -0600)] 
schema: add an object for mapping fields to keywords

To some EVE fields and a "suricata" object that contains an array of
keywords. These are the keywords that map directly to this field, or
somehow cover this field.

This is an attempt at tooling to help with EVE and keyword parity.

Related to tickets: #5642, #6463, #4772

4 months agodns: add keywords for additionals and authorities rrnames
Jason Ish [Tue, 28 Jan 2025 23:21:00 +0000 (17:21 -0600)] 
dns: add keywords for additionals and authorities rrnames

Add keywords dns.additionals.rrname and dns.authorities.rrname. Along
the way, consolidate dns.query.name and dns.answer.name into a single file
and register them altogether since there is a lot of common code.

4 months agodetect: split new keyword id from registration
Jason Ish [Fri, 17 Jan 2025 20:46:07 +0000 (14:46 -0600)] 
detect: split new keyword id from registration

Split DetectHelperKeywordRegister into 2 functions, one for acquiring
a new keyword ID, and another to perform the registration.

This makes it easier to do the traditional C keyword initialization
with a dynamic ID.

4 months agodns: refactor function to get rrname to be safe
Jason Ish [Tue, 28 Jan 2025 22:34:07 +0000 (16:34 -0600)] 
dns: refactor function to get rrname to be safe

Make the function safe by returning a reference to the DNSName object,
the unsafe C wrapper can do the conversion to pointers.

4 months agodetect-dns-response: disable clang-format around byte arrays
Jason Ish [Tue, 28 Jan 2025 22:19:37 +0000 (16:19 -0600)] 
detect-dns-response: disable clang-format around byte arrays

These arrays are manually formatted for readability.

4 months agodns: rename dns.response keyword to dns.response.rrname
Jason Ish [Tue, 28 Jan 2025 22:15:00 +0000 (16:15 -0600)] 
dns: rename dns.response keyword to dns.response.rrname

This is a better name as the keyword is looking at all rrname type
fields in the response.

4 months agodoc/userguide: document dns.response
Nathan Scrivens [Tue, 20 Aug 2024 02:45:02 +0000 (22:45 -0400)] 
doc/userguide: document dns.response

Feature: 7012

4 months agodns: add dns.response sticky buffer
Nathan Scrivens [Mon, 19 Aug 2024 18:01:21 +0000 (14:01 -0400)] 
dns: add dns.response sticky buffer

Feature: 7012
Add dns.response sticky buffer to match on dns response fields.
Add rust functions to return dns response packet data.
Unit tests verifying signature matching.

4 months agofiles: append data on closing even with FILE_NOSTORE
Philippe Antoine [Tue, 4 Mar 2025 15:30:19 +0000 (16:30 +0100)] 
files: append data on closing even with FILE_NOSTORE

Ticket: 7577

When HTTP1 post multipart handles a small file, it will call
HTPFileClose with some data
This data needs to be appended to the streaming buffer for usage
by file.data keyword even if we do not end up storing the file

4 months agodetect: add ldap.responses.message
Alice Akaki [Tue, 11 Feb 2025 08:20:33 +0000 (04:20 -0400)] 
detect: add ldap.responses.message

ldap.responses.message matches on LDAPResult error message
This keyword maps the following eve fields:
ldap.responses[].bind_response.message
ldap.responses[].search_result_done.message
ldap.responses[].modify_response.message
ldap.responses[].add_response.message
ldap.responses[].del_response.message
ldap.responses[].mod_dn_response.message
ldap.responses[].compare_response.message
ldap.responses[].extended_response.message
It is a sticky buffer
Supports prefiltering

Ticket: #7532

4 months agodetect: add ldap.responses.result_code
Alice Akaki [Thu, 6 Feb 2025 06:07:05 +0000 (02:07 -0400)] 
detect: add ldap.responses.result_code

ldap.responses.result_code matches on LDAP result code
This keyword maps the following eve fields:
ldap.responses[].bind_response.result_code
ldap.responses[].search_result_done.result_code
ldap.responses[].modify_response.result_code
ldap.responses[].add_response.result_code
ldap.responses[].del_response.result_code
ldap.responses[].mod_dn_response.result_code
ldap.responses[].compare_response.result_code
ldap.responses[].extended_response.result_code
It is an unsigned 32-bit integer
Doesn't support prefiltering

Ticket: #7532

4 months agoldap: create a generic funtion to match integer responses
Alice Akaki [Thu, 27 Feb 2025 23:38:07 +0000 (19:38 -0400)] 
ldap: create a generic funtion to match integer responses

4 months agoldap: refactor function aux_ldap_parse_protocol_resp_op
Alice Akaki [Thu, 20 Feb 2025 22:32:35 +0000 (18:32 -0400)] 
ldap: refactor function aux_ldap_parse_protocol_resp_op

Split code to create a generic function that parses LdapIndex

4 months agoldap: rename DetectLdapRespData struct to be more specific
Alice Akaki [Mon, 10 Feb 2025 15:56:23 +0000 (11:56 -0400)] 
ldap: rename DetectLdapRespData struct to be more specific

4 months agoldap: return empty buffer in ldap_tx_get_responses_dn
Alice Akaki [Mon, 3 Mar 2025 22:52:39 +0000 (18:52 -0400)] 
ldap: return empty buffer in ldap_tx_get_responses_dn

Funciton ldap_tx_get_responses_dn returns empty buffer in case
the response doesn't contain the distinguished name field

Fixes: 73ae6e997f6c ("detect: add ldap.responses.dn")
4 months agoldap: fix LDAPDN nits
Alice Akaki [Fri, 28 Feb 2025 00:09:17 +0000 (20:09 -0400)] 
ldap: fix LDAPDN nits

Change variable name 'req' to 'resp' in function ldap_tx_get_responses_dn and documentation nits

Fixes:
73ae6e997f6c ("detect: add ldap.responses.dn")
16dcee46fc8a ("detect: add ldap.request.dn")

4 months agoldap: apply rustfmt
Alice Akaki [Mon, 3 Mar 2025 22:57:41 +0000 (18:57 -0400)] 
ldap: apply rustfmt

Fixes: 4554c4778d67 ("rust: use AppProto from generated bindings instead of duplicating")
4 months agoci: fix clusterfuzzlite build 12711/head 12712/head
Philippe Antoine [Tue, 4 Mar 2025 10:11:58 +0000 (11:11 +0100)] 
ci: fix clusterfuzzlite build

5 months agogithub-actions: bump actions/upload-artifact from 4.6.0 to 4.6.1 12706/head
dependabot[bot] [Sat, 1 Mar 2025 19:22:33 +0000 (19:22 +0000)] 
github-actions: bump actions/upload-artifact from 4.6.0 to 4.6.1

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.0 to 4.6.1.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08...4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1)

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

Signed-off-by: dependabot[bot] <support@github.com>
5 months agogithub-actions: bump codecov/codecov-action from 5.3.1 to 5.4.0
dependabot[bot] [Sat, 1 Mar 2025 19:22:31 +0000 (19:22 +0000)] 
github-actions: bump codecov/codecov-action from 5.3.1 to 5.4.0

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.3.1 to 5.4.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3...0565863a31f2c772f9f0395002a31e3f06189574)

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

Signed-off-by: dependabot[bot] <support@github.com>
5 months agogithub-actions: bump github/codeql-action from 3.28.8 to 3.28.10
dependabot[bot] [Sat, 1 Mar 2025 19:22:28 +0000 (19:22 +0000)] 
github-actions: bump github/codeql-action from 3.28.8 to 3.28.10

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.8 to 3.28.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.8...v3.28.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
5 months agogithub-actions: bump actions/download-artifact from 4.1.8 to 4.1.9
dependabot[bot] [Sat, 1 Mar 2025 19:22:13 +0000 (19:22 +0000)] 
github-actions: bump actions/download-artifact from 4.1.8 to 4.1.9

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.8 to 4.1.9.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/fa0a91b85d4f404e444e00e005971372dc801d16...cc203385981b70ca67e1cc392babf9cc229d5806)

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

Signed-off-by: dependabot[bot] <support@github.com>
5 months agogithub-actions: bump ossf/scorecard-action from 2.4.0 to 2.4.1 12701/head
dependabot[bot] [Sat, 1 Mar 2025 19:22:11 +0000 (19:22 +0000)] 
github-actions: bump ossf/scorecard-action from 2.4.0 to 2.4.1

Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/62b2cac7ed8198b15735ed49ab1e5cf35480ba46...f49aabe0b5af0936a0987cfb85d86b75731b0186)

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

Signed-off-by: dependabot[bot] <support@github.com>
5 months agomqtt: naming and visibility cleanups 12693/head
Jason Ish [Thu, 27 Feb 2025 21:23:25 +0000 (15:23 -0600)] 
mqtt: naming and visibility cleanups

- remove rs_prefix, replace with SC if needed
- remove pub and no_mangle where not needed
- remove some unused functions and fields

Related to ticket: #7498

5 months agoenip: remove rs_ prefix
Jason Ish [Thu, 27 Feb 2025 21:14:38 +0000 (15:14 -0600)] 
enip: remove rs_ prefix

Related to ticket: #7498

5 months agodcerpc: visibility and naming cleanups
Jason Ish [Thu, 27 Feb 2025 21:09:12 +0000 (15:09 -0600)] 
dcerpc: visibility and naming cleanups

- replace rs_ prefixed names with SC
- remove no_mangle and pub where not needed
- remove some unused functions

Related to ticket: #7498

5 months agobittorrent: no_mangle, pub and naming cleanups
Jason Ish [Thu, 27 Feb 2025 17:30:07 +0000 (11:30 -0600)] 
bittorrent: no_mangle, pub and naming cleanups

- Remove rs_prefix
- Remove no_mangle and pub when not needed

Related to ticket: #7498

5 months agorust: use CBINDGEN variable and not "cbindgen"
Jason Ish [Thu, 27 Feb 2025 17:05:26 +0000 (11:05 -0600)] 
rust: use CBINDGEN variable and not "cbindgen"

This uses the cbindgen found during ./configure, and not the one
found on the path during "make", which while often the same, aren't
always the same.

Ticket: #6384

5 months agogithub-ci: re-enable RPM builds
Jason Ish [Thu, 27 Feb 2025 16:02:23 +0000 (10:02 -0600)] 
github-ci: re-enable RPM builds

The RPM has been updated to handle the conversion of suricatasc and
suricatactl to Rust.

Also fixes the "if" expression to prevent one job running both upload
sections.

5 months agoapplayer/ftp: Misc cleanup 12687/head
Jeff Lucovsky [Thu, 27 Feb 2025 16:49:05 +0000 (11:49 -0500)] 
applayer/ftp: Misc cleanup

Issue: 4082

Small fixups.

5 months agoapplayer/ftp: Move MPM declaration
Jeff Lucovsky [Thu, 27 Feb 2025 16:48:16 +0000 (11:48 -0500)] 
applayer/ftp: Move MPM declaration

This commit moves the MPM fn declaration into core.rs making it
available for other Rust modules.

Issue: 4082

5 months agoapp-layer/ftp: Fixup state values
Jeff Lucovsky [Thu, 27 Feb 2025 16:41:53 +0000 (11:41 -0500)] 
app-layer/ftp: Fixup state values

Issue: 4082

Fixup the incorrect state values -- they should be the default enum
values to match the pre-Rust implementation.

5 months agogithub-ci: skip rpm builds for now 12685/head
Jason Ish [Tue, 25 Feb 2025 16:53:44 +0000 (10:53 -0600)] 
github-ci: skip rpm builds for now

RPMs will need to be fixed after merge.

5 months agogithub-ci: add var to disable rpm builds
Jason Ish [Tue, 11 Feb 2025 23:09:23 +0000 (17:09 -0600)] 
github-ci: add var to disable rpm builds

There will be changes in our development branch that the RPMs need to
adapt to, but that can't be done until the changes have been merged to
master, then the RPM can catchup.

This gives us a single variable to turn off RPM building.

5 months agodoc: add upgrade note about suricatasc and suricatactl
Jason Ish [Mon, 10 Feb 2025 22:09:23 +0000 (16:09 -0600)] 
doc: add upgrade note about suricatasc and suricatactl

5 months agodist: include generate-evedoc.sh
Jason Ish [Mon, 10 Feb 2025 21:21:20 +0000 (15:21 -0600)] 
dist: include generate-evedoc.sh

Without this script `make distcheck` fails on a system with
documentation tooling installed, as its required to build the EVE
appendix.

5 months agogithub-ci: add check for update to date Cargo.lock.in
Jason Ish [Mon, 10 Feb 2025 19:47:57 +0000 (13:47 -0600)] 
github-ci: add check for update to date Cargo.lock.in

After a build, check if Cargo.lock.in and Cargo.lock differ, if so,
Cargo.lock.in needs an update as part of a depedency update.

5 months agodoc: remove python references related to suricatasc
Jason Ish [Thu, 6 Feb 2025 21:12:39 +0000 (15:12 -0600)] 
doc: remove python references related to suricatasc

These should probably be removed even without the rewrite, and
suricatasc has been installed as a proper program for many releases.

5 months agoqa: fix suricatasc path
Jason Ish [Sun, 22 Dec 2024 16:46:28 +0000 (10:46 -0600)] 
qa: fix suricatasc path

5 months agopython: remove python implementation of suricatasc/suricatactl
Jason Ish [Thu, 16 Nov 2023 22:19:23 +0000 (16:19 -0600)] 
python: remove python implementation of suricatasc/suricatactl

5 months agosuricatactl: rust version of suricatactl
Jason Ish [Tue, 27 Jun 2023 06:28:07 +0000 (00:28 -0600)] 
suricatactl: rust version of suricatactl

5 months agogithub-ci: do one Windows build from dist archive
Jason Ish [Thu, 4 May 2023 17:40:13 +0000 (11:40 -0600)] 
github-ci: do one Windows build from dist archive

As we have 2 Windows builds, do one using the release-style
distribution file.

5 months agosuricatasc: a Rust implementation of suricatasc
Jason Ish [Fri, 3 Mar 2023 14:54:07 +0000 (08:54 -0600)] 
suricatasc: a Rust implementation of suricatasc

This is a re-implementation of suricatasc program in Rust that
attempts to be a 100% drop-in replacement.

5 months agorust: remove allow of static mutables
Jason Ish [Mon, 24 Feb 2025 22:47:28 +0000 (16:47 -0600)] 
rust: remove allow of static mutables

As references to static mutables are highly discouraged, remove the
global suppressing of the compiler warning. Each use case can be
suppressed as needed.

Ticket: #7417

5 months agosmb: wrap read access to static mutables in function
Jason Ish [Wed, 26 Feb 2025 15:29:40 +0000 (09:29 -0600)] 
smb: wrap read access to static mutables in function

Simply wrapping in a function removes static_mut_refs compiler
warning.

Ticket: #7417

5 months agosmtp: suppress static_mut_refs where needed
Jason Ish [Tue, 25 Feb 2025 16:18:12 +0000 (10:18 -0600)] 
smtp: suppress static_mut_refs where needed

Allows us to get rid of the global supression.

Ticket: #7417

5 months agosmtp: remove SCMimeSmtpConfigExtractUrlsSchemeReset
Jason Ish [Tue, 25 Feb 2025 16:15:57 +0000 (10:15 -0600)] 
smtp: remove SCMimeSmtpConfigExtractUrlsSchemeReset

It doesn't appear to be needed. The vec being cleared is only set once
per run, so never needs to be cleared.

Removes one point where we have to supress the static_mut_refs compiler
warning.

Ticket: #7417

5 months agodns: move unit tests to suricata-verify 12679/head
Philippe Antoine [Tue, 25 Feb 2025 20:14:51 +0000 (21:14 +0100)] 
dns: move unit tests to suricata-verify

Ticket: 3725
Ticket: 7529

5 months agomain/flush: Support periodic flush logs
Jeff Lucovsky [Sat, 7 Oct 2023 21:08:27 +0000 (17:08 -0400)] 
main/flush: Support periodic flush logs

Issue: 3449

5 months agodetect/flag: Pseudo pkt "flush log" flag
Jeff Lucovsky [Sat, 7 Oct 2023 21:06:52 +0000 (17:06 -0400)] 
detect/flag: Pseudo pkt "flush log" flag

Issue: 3449

Add a flush directive to the packet that is distinct from the existing
"log flush" flag as the new flag is to distinguish between the 2 use
cases.

5 months agooutput/log: Add flushing infrastructure
Jeff Lucovsky [Tue, 30 Apr 2024 14:44:54 +0000 (10:44 -0400)] 
output/log: Add flushing infrastructure

Issue: 3449

Add flushing functions and infrastructure. This includes:
- Flushing functions for packet loggers
- Log file flushing support

5 months agooutput: Support buffer-size value
Jeff Lucovsky [Mon, 2 Oct 2023 15:01:45 +0000 (11:01 -0400)] 
output: Support buffer-size value

Issue: 3449

5 months agodoc/output: EVE output buffering related settings
Jeff Lucovsky [Sat, 14 Oct 2023 13:00:14 +0000 (09:00 -0400)] 
doc/output: EVE output buffering related settings

5 months agoconf/output: Buffering related config settings
Jeff Lucovsky [Mon, 2 Oct 2023 15:00:46 +0000 (11:00 -0400)] 
conf/output: Buffering related config settings

This commit adds 2 EVE output buffering settings
- buffer-size value which specifies the amount of buffering, if any,
  for regular/file output types.
- flush-interval Specifies the cadence at which Suricata will direct
  detect threads to flush EVE output.

Issue: 3449

5 months agooutput/log: Add flush function, collapse params
Jeff Lucovsky [Tue, 30 Apr 2024 13:45:25 +0000 (09:45 -0400)] 
output/log: Add flush function, collapse params

Issue: 3449

Add a flush function to packet logger registration and collapse the
parameter count for registration functions.

5 months agoflow: remove unused definition 12675/head
Philippe Antoine [Tue, 25 Feb 2025 09:12:48 +0000 (10:12 +0100)] 
flow: remove unused definition

Fixes: 3f3964555e4e ("detect/iponly: use flow first flags")
5 months agodetect/alert: optimize no-alert path
Victor Julien [Sun, 23 Feb 2025 11:04:17 +0000 (12:04 +0100)] 
detect/alert: optimize no-alert path

Skip qsort call if no alerts are queued. Move logic into inline helper func.

5 months agodetect: constify arguments
Victor Julien [Sun, 23 Feb 2025 11:03:03 +0000 (12:03 +0100)] 
detect: constify arguments

5 months agodetect/tx: improve branch prediction
Victor Julien [Mon, 11 Sep 2023 15:04:15 +0000 (17:04 +0200)] 
detect/tx: improve branch prediction

5 months agoapp-layer: optimize pstate check
Victor Julien [Mon, 11 Sep 2023 07:22:16 +0000 (07:22 +0000)] 
app-layer: optimize pstate check

To assist branch prediction, which showed a 100% miss rate, assume pstate
is non-NULL. Code review suggests all paths leading to the function actually
check pstate first, or alstate which can only be non-NULL if pstate was first
initialized. For now add a debug check.

5 months agothreads/flow: assist branch prediction
Victor Julien [Mon, 11 Sep 2023 07:21:47 +0000 (07:21 +0000)] 
threads/flow: assist branch prediction

5 months agodetect/pmq: assist branch prediction
Victor Julien [Mon, 11 Sep 2023 07:21:28 +0000 (07:21 +0000)] 
detect/pmq: assist branch prediction

5 months agoftp: Move config file handling to Rust
Jeff Lucovsky [Sun, 2 Feb 2025 16:10:59 +0000 (11:10 -0500)] 
ftp: Move config file handling to Rust

Issue: 4082

Move the configuration file handling to Rust.

These changes will no longer terminate Suricata when there's an invalid
value for ftp.memcap. Like earlier Suricata releases, an error message
is logged "Invalid value <value> for ftp.memcap" but Suricata will no
longer terminate execution. It will use a default value of "0" instead.

5 months agoftp: convert enumerations to Rust
Jeff Lucovsky [Sun, 2 Feb 2025 14:12:59 +0000 (09:12 -0500)] 
ftp: convert enumerations to Rust

As part of the effort to convert the FTP/FTPDATA parser to rust, move
the enums from C to rust.

Issue: 4082

5 months agodcerpc: consume bytes after gap resync
Philippe Antoine [Thu, 20 Feb 2025 22:36:27 +0000 (23:36 +0100)] 
dcerpc: consume bytes after gap resync

Ticket: 7567

After a gap, we search a new record that may start later than
the beginning of current stream slice.
If so, consume the first bytes before the start of the record,
so that AppLayerResult::incomplete can be consistent and not
trigger assertion !((res.needed + res.consumed < input_len))

5 months agorust: fix clippy 1.85 precedence warnings 12653/head
Philippe Antoine [Fri, 21 Feb 2025 10:22:27 +0000 (11:22 +0100)] 
rust: fix clippy 1.85 precedence warnings

warning: operator precedence can trip the unwary
   --> src/jsonbuilder.rs:781:36
    |
781 |                 buf[offset] = HEX[(x >> 4 & 0xf) as usize];
    |                                    ^^^^^^^^^^^^ help: consider parenthesizing your expression: `(x >> 4) & 0xf`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
    = note: `#[warn(clippy::precedence)]` on by default

5 months agoquic: discard late retry packets
Philippe Antoine [Fri, 21 Feb 2025 09:38:06 +0000 (10:38 +0100)] 
quic: discard late retry packets

Ticket: 7556

See RFC 9000 section 17.2.5.2 :
After the client has received and processed an Initial
or Retry packet from the server,
it MUST discard any subsequent Retry packets that it receives.

5 months agodetect/transform: Refactor setup/apply pattern
Jeff Lucovsky [Thu, 10 Oct 2024 13:31:12 +0000 (09:31 -0400)] 
detect/transform: Refactor setup/apply pattern

git grep -A 1 -w InspectionBufferSetup shows many cases of the following
call patterns:
    - InspectionBufferSetup
    - InspectionBufferApplyTransforms

Refactor the implementations of those functions into
InspectionBufferSetupAndApplyTransforms to reduce function call count.

Issue: 2290 (related to changed for this issue)

5 months agodcerpc: add iface to dcerpc request event
Shivani Bhardwaj [Wed, 19 Feb 2025 07:58:47 +0000 (13:28 +0530)] 
dcerpc: add iface to dcerpc request event

so as to avoid extra steps for correlation among events to find
this information.

Feature 7565

5 months agorust/bindgen: use temp file to generating bindings
Jason Ish [Wed, 19 Feb 2025 21:31:31 +0000 (15:31 -0600)] 
rust/bindgen: use temp file to generating bindings

Prefixing a file with sed doesn't appear to be portable. Instead, make
use of a temporary file.

Fixes generating the bindings on FreeBSD and Mac.

5 months agodetect: add ldap.responses.dn
Alice Akaki [Thu, 6 Feb 2025 04:16:20 +0000 (00:16 -0400)] 
detect: add ldap.responses.dn

ldap.responses.dn matches on LDAPDN from responses operations
This keyword maps the following eve fields:
ldap.responses[].search_result_entry.base_object
ldap.responses[].bind_response.matched_dn
ldap.responses[].search_result_done.matched_dn
ldap.responses[].modify_response.matched_dn
ldap.responses[].add_response.matched_dn
ldap.responses[].del_response.matched_dn
ldap.responses[].mod_dn_response.matched_dn
ldap.responses[].compare_response.matched_dn
ldap.responses[].extended_response.matched_dn
It is a sticky buffer
Supports prefiltering

Ticket: #7471

5 months agodetect: add ldap.request.dn
Alice Akaki [Tue, 4 Feb 2025 02:37:15 +0000 (22:37 -0400)] 
detect: add ldap.request.dn

ldap.request.dn matches on LDAPDN from request operations
This keyword maps the following eve fields:
ldap.request.bind_request.name
ldap.request.add_request.entry
ldap.request.search_request.base_object
ldap.request.modify_request.object
ldap.request.del_request.dn
ldap.request.mod_dn_request.entry
ldap.request.compare_request.entry
It is a sticky buffer
Supports prefiltering

Ticket: #7471

5 months agodoc: use the ldap protocol in rule examples in the LDAP keywords documentation
Alice Akaki [Wed, 19 Feb 2025 00:00:36 +0000 (20:00 -0400)] 
doc: use the ldap protocol in rule examples in the LDAP keywords documentation

5 months agodoc: replace 'eve' with 'EVE' in the LDAP keywords documentation
Alice Akaki [Tue, 18 Feb 2025 23:56:43 +0000 (19:56 -0400)] 
doc: replace 'eve' with 'EVE' in the LDAP keywords documentation

5 months agomisc: fix name prefix in detect register functions
Alice Akaki [Sun, 9 Feb 2025 04:50:25 +0000 (00:50 -0400)] 
misc: fix name prefix in detect register functions

5 months agoutil: fix -Wshorten-64-to-32 warnings
Philippe Antoine [Tue, 19 Sep 2023 12:45:47 +0000 (14:45 +0200)] 
util: fix -Wshorten-64-to-32 warnings

Ticket: #6186

5 months agoquic: decrypt only initial packets 12631/head
Philippe Antoine [Wed, 19 Feb 2025 09:08:58 +0000 (10:08 +0100)] 
quic: decrypt only initial packets

Ticket: 7556

Avoids failed_decrypt events when the first packet seen is not
a Quic Initial packet

5 months agoquic: handle retry packets
Philippe Antoine [Wed, 19 Feb 2025 12:01:36 +0000 (13:01 +0100)] 
quic: handle retry packets

Ticket: 7556

5 months agoquic: handle fragmented hello over multiple packets
Philippe Antoine [Mon, 17 Feb 2025 10:13:20 +0000 (11:13 +0100)] 
quic: handle fragmented hello over multiple packets

Ticket: 7556

To do so, we need to add 2 buffers (one for each direction)
to the QuicState structure, so that on parsing the second packet
with hello/crypto fragment, we still have the data of the first
hello/crypto fragment.

Use a hardcoded limit so that these buffers cannot grow indefinitely
and set an event when reaching the limit

5 months agoquic: parse ack frame number 3
Philippe Antoine [Mon, 17 Feb 2025 14:04:59 +0000 (15:04 +0100)] 
quic: parse ack frame number 3

cf rfc9000 section 19.3. ACK Frames

Ticket: 7556

5 months agoquic: move all_consuming check to callee
Philippe Antoine [Mon, 17 Feb 2025 10:04:50 +0000 (11:04 +0100)] 
quic: move all_consuming check to callee

Will alow to have decode_frames accept one additional parameter
with past fragment data

5 months agoquic: rustfmt
Philippe Antoine [Mon, 17 Feb 2025 09:27:49 +0000 (10:27 +0100)] 
quic: rustfmt

5 months agohtp: macro hygiene
Philippe Antoine [Tue, 18 Feb 2025 20:23:19 +0000 (21:23 +0100)] 
htp: macro hygiene

make clang-tidy happy even if unneeded for the temporary workaround

5 months agohttp: aliases for htp log code
Philippe Antoine [Thu, 6 Feb 2025 15:09:10 +0000 (16:09 +0100)] 
http: aliases for htp log code

In preparation of libhtp rust

5 months agohttp: constify some variables
Philippe Antoine [Thu, 6 Feb 2025 13:51:28 +0000 (14:51 +0100)] 
http: constify some variables

In preparation of libhtp rust

5 months agohttp: aliases for opaque htp_conn_t
Philippe Antoine [Thu, 6 Feb 2025 13:31:40 +0000 (14:31 +0100)] 
http: aliases for opaque htp_conn_t

In preparation of libhtp rust

5 months agohttp: aliases for opaque htp_tx_data_t
Philippe Antoine [Thu, 6 Feb 2025 13:26:14 +0000 (14:26 +0100)] 
http: aliases for opaque htp_tx_data_t

In preparation of libhtp rust

5 months agobuild: use expanded localstatedir for #define 12625/head
Jason Ish [Tue, 18 Feb 2025 21:15:43 +0000 (15:15 -0600)] 
build: use expanded localstatedir for #define

Use the expanded form of localstatedir in autoconf.h instead of the
unexpanded one, the difference being:

    #define LOCAL_STATE_DIR "${prefix}/var"

and

    #define LOCAL_STATE_DIR "/usr/local/var"

assuming default ./configure arguments.

Fixes commit b6a610df2669336756c67f77eb857b190b77770a.

5 months agopgsql/parser: fix type complexity clippy warning
Juliana Fajardini [Tue, 18 Feb 2025 20:17:13 +0000 (17:17 -0300)] 
pgsql/parser: fix type complexity clippy warning

Cf https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

5 months agopgsql/logger: don't log empty transactions
Juliana Fajardini [Mon, 17 Feb 2025 19:50:38 +0000 (16:50 -0300)] 
pgsql/logger: don't log empty transactions

This may happen in some situations if the app-layer parser only sees
unknown messages and sets an event: there will be an empty transaction,
but nothing to log.

Related to
Task #5566

5 months agopgsql: add case for Unknown response message state
Juliana Fajardini [Mon, 17 Feb 2025 15:06:39 +0000 (12:06 -0300)] 
pgsql: add case for Unknown response message state

No state change, but since we added Unknown responses, we should handle
that case -- should we have a specific state for such cases?

Related to
Bug #5524
Task #5566

5 months agopgsql: add events
Juliana Fajardini [Mon, 17 Feb 2025 15:05:09 +0000 (12:05 -0300)] 
pgsql: add events

Events for:
- parsing error when parsing pgsql packet length
- parsing error for pgsql requests (post length parsing)
- parsing error for pgsql responses (post length parsing)
- too many transactions

Include `pgsql-events.rules` file, and PGSQL events SID range definition

Task #5566

5 months agopgsql/parser: add more debug statements
Juliana Fajardini [Fri, 14 Feb 2025 17:46:00 +0000 (14:46 -0300)] 
pgsql/parser: add more debug statements