Commit Graph

19404 Commits (06235a3232e24df8476f3ea8f7754b50c28736ec)
 

Author SHA1 Message Date
Jason Ish 06235a3232 ndpi: use flow access functions
To prevent direct access to the flow structure and be subject to changes
in its size.

Ticket: #8632
2 months ago
Jason Ish 358b0b621b flow: include cleanup
Include flow-bindgen.h into flow.h and use flow.h in our source.
flow-bindgen.h exists for the purposes of bindgen only.
2 months ago
Jason Ish c0de5bca46 flow: add accessor functions
Add accessor functions to allow NDPI and our plugin examples to access
flow fields in an opaque manner.

Provides accessors for:

- is ipv4
- is ipv6
- ip protocol
- to server packet count
- to destination packet count

Ticket: #8632
2 months ago
Jason Ish 038d4a21e3 ndpi: flow storage can fail, cleanup if it does 2 months ago
Jason Ish f739a8a73c ndpi: don't access flow storage directly
Remove the check for Flow.storage being NULL. With flex arrays, as long as the
flow is allocated, .storage will never be NULL. We do make sure the flow
is not NULL, and the storage functions are safe to the storage being
NULL.

Prevents NDPI from accessing this flow field to be less sensitive to ABI
changes with respect to data structure sizes.

Ticket: #8632
2 months ago
Jason Ish e51cc381b7 flow-storage: include cleanup 2 months ago
Jason Ish 4481f27657 smtp: avoid scan-build false-positive null dereference
Scan-build reports a possible NULL dereference that is not reachable.
2 months ago
Jason Ish 0be6e345fd smtp: handle mid-session helo/ehlo like rset
RFC 5321 says a mid-session EHLO should work just like RSET. We more or
less ignored it, which meant transaction state could carry over.

Treat a HELO/EHLO received during a transaction as RSET once the server
accepts it.

Ticket: #8715
2 months ago
Lukas Sismis b82b4496af detect/firewall: group policies under packet and app nodes
The policy config was a flat map mixing packet hooks and app-layer
protocols: `packet-filter` next to `dns`. There was no node that meant
"the packet hooks" or "the app-layer hooks", so a setting could not be
scoped to one group.

Move each group under its own node:

    packet-filter     -> packet.filter
    packet-pre-flow   -> packet.pre-flow
    packet-pre-stream -> packet.pre-stream
    <proto>.<hook>    -> app.<proto>.<hook>

Ticket: 8712
2 months ago
Lukas Sismis 04c9fd9e22 detect/firewall: address HTTP/1 policies as http1
AppProtoToString(ALPROTO_HTTP1) returns "http", so an HTTP/1 policy had to
be written as `http:` while its rule hooks were already spelled `http1:`.
Use the same name in both places.

Ticket: 8712
2 months ago
Lukas Sismis 3adbd677e8 app-layer: query raw protocol names
To avoid back-and-forth of http1 conversion
a second query function was added to support
existing use cases.

This change will be handy for the upcoming
default-policy for firewall settings
2 months ago
Jason Ish 9a2b700471 github-ci: run dist in rust-vars job 2 months ago
Jason Ish df58deac96 github-ci: update rust-vars job to rust 1.85 2 months ago
Jason Ish 7c283ba954 rust: set CARGO_ENV when generating ffi bindings
This is required when rustc is not in a standard path. The other
cbindgen calls already had this, so it was just missed while adding the
ffi bindings, but shows up when rustc is at a path like
/usr/lib/rust-1.89/bin/rustc, but that directory is not in your path.
2 months ago
Jason Ish 6af3bf93f3 github-ci/builds: update ubuntu builds to rust 1.89 2 months ago
Jason Ish 0b86dce1f1 github-ci/docs: use rust 1.89 2 months ago
Jason Ish b639fb0d67 github-ci/commits: update to ubuntu 24.04; rust 1.89 2 months ago
Jason Ish bd522291cf github-ci/formatting: update to rust 1.89 2 months ago
Jason Ish bc868647fe github-ci/nix: update to nixos-25.11
To pick up a newer version of Rust.
2 months ago
Jason Ish eb887f00dc github-ci: update rust vars job to rust 1.85 2 months ago
Jason Ish 98f42f8462 rust: disable clippy warning for manual c str literals
Disable the clippy warning for not using modern C string
literals. Ubuntu 24.04 still ships cbindgen 0.26.0 that doesn't
support these, so migrating to modern C string literals would require
Ubuntu 24.04 users wishing to build from git to install cbindgen with
cargo.
2 months ago
Jason Ish 2bea5b6aad rust: set minimum rust version to 1.85
1.85 was chosen for now as it supports edition 2024. However, we have
not set our edition to 2024 yet.
2 months ago
Jason Ish 6b8c482012 github-ci: break ubuntu/debian script into 2 scripts
Debian 13 ships Rust 1.85 by default, Ubuntu requires installing a
specific patch to get newer then 1.75. So to support a newer MSRV,
these operating systems need different examples.
2 months ago
Jason Ish 05882e7be0 github-ci: cleanups to almalinux minimal build
Don't install extra repo's in the script, do it in CI. These are covered
by the documentation as they vary depending on the version and variant.
2 months ago
Shivani Bhardwaj bc4c06481c detect/flowbits: store iid and sid in analyzer
sid is much more useful for logging and debugging.
3 months ago
Shivani Bhardwaj 83d52582b1 detect/flowbits: fix sid misnomer in analyzer arrays
Analyzer arrays store internal IDs of the signature for an easy lookup
later from the DetectEngineCtx. However, the storage arrays were
inappropriately named as sid arrays. Make it coherent.

Bring Analyzer structs and fns to the header for later use in a wider
context.
3 months ago
Denis Balashov 8e551f2860 util/file: add unit test for inspect window overflow
Ticket: 8678

With an inspect window of 0xAAAAAAAB the `window * 3` guard wrapped to 1
in uint32_t arithmetic, so it passed for a 64 byte file and
content_inspected was set to `file->size - window`, an underflow.
3 months ago
Denis Balashov f3910d557d util/file: fix integer overflow in inspect window comparison
Ticket: 8678

In FilePruneFile() `window * 3` was computed in uint32_t arithmetic.
The guard exists to ensure `file->size > window`, so on wrap around
`file->size - window` underflows and content_inspected is set to a
bogus value, breaking file inspection.

Make window uint64_t so the multiplication cannot wrap.
3 months ago
Shivani Bhardwaj 2eb0b60b83 smb/log: map dcerpc uuid, opnum to service names
With this patch, the logged uuids will also have corresponding
stringified service names. The requests that will have an opnum will
have a corresponding stringified procedure name.

Feature 2727
Feature 8523
3 months ago
Shivani Bhardwaj d77f73d9a6 dcerpc/log: map uuid, opnum to service and procedure
Log the service and procedure names corresponding to a UUID and opnum
for each DCERPC event where it's available.

Feature 2727
Feature 8523
3 months ago
Shivani Bhardwaj 35d28272b2 dcerpc: add interface-service name data
This data directly comes from Zeek @d11a8750. It was scriptually
converted to NDJSON ingestible to Suricata using serde and serde_json.
The script used for this conversion lives in
scripts/extract_dce_rpc_interfaces.py.

Part of this data within Zeek codebase comes from the MITRE BZAR
project. Hence, the LICENSE file alongwith this data consists of both
the licenses: Zeek and BZAR.

Feature 2727
Feature 8523
3 months ago
Shivani Bhardwaj cee102c76d rust: add serde and serde_json as dependencies
Feature 2727
Feature 8523
3 months ago
Jason Ish 57ae57152c smtp: assign response frames to owning transaction
SMTPGetLine assigned response frames to the current transaction even when a
queued reply belonged to an older transaction.

Use the queued command owner so frame EVE output and frame-based detection
receive the correct transaction id.

Includes some re-org to avoid prototypes for static functions.

Ticket: #8741
3 months ago
Jason Ish 60e0df6530 smtp: recover from invalid BDAT command syntax
A BDAT command that failed to parse, such as "BDAT 5 X", returned -1,
disabling SMTP parsing for the rest of the flow. A server may reject the
command and continue the session, leaving following messages
uninspected.

Instead raise a decoder event and queue the command as an ordinary
command.

Ticket: #8741
3 months ago
Jason Ish ec0fec1a37 smtp: complete BDAT transactions at LAST
Track the BDAT LAST marker so the final chunk and its reply complete the
transaction in each direction, preventing a following MAIL FROM from
being merged into the previous transaction.

Ticket: #8741
3 months ago
Jason Ish 2676d1bc83 smtp: move transaction completion helpers
Simply makes the follow diff a little easier to read.
3 months ago
Stephen Donnelly a37b75a8ba dag: check rlen is a valid length
Ticket: 8797

Add check to rlen value read from ERF record to avoid potential infinite loop, must be >= dag_record_length (16).

Similar check exists in source_erf_file already.
3 months ago
Jason Ish 7827f357b5 github-ci: suppress RUSTSEC-2026-0253
RUSTSEC-2026-0253 in the lru crate requires that items we put in the
lru have a drop implementation that may panic, and we catch
that panic. The current items we put in the lru cache do not have a drop
implementation, and we treat panic's as fatal so will not run into the
issue presented in RUSTSEC-2026-0253.
3 months ago
Dmitry Uryvchikov d2497790f9 detect-engine-mpm: change transforms->cnt to uint8_t 3 months ago
Stephen Donnelly 03bc717877 dag: wrong stats registration causes compilation errors with --enable-dag
Bug: 8812
3 months ago
Uwez Khan 38b4ad79a3 decode/ipv6: bound hop-by-hop option to the option area
The TLV loop for the IPv6 hop-by-hop and destination option headers
gates each option on (offset + 1 + ip6_optlen) > optslen. An option is
two header bytes (type, length) plus ip6_optlen data bytes, so its data
ends at offset + 1 + ip6_optlen and the bound has to be
offset + 2 + ip6_optlen.

Before: an option that declares its data running one byte past the
option area is accepted, and the Router Alert / Jumbo / Home Address
memcpy then copies sizeof(value) bytes ending one byte past the area;
when the header sits at the tail of the IPv6 payload that read goes
past the payload.

After: the option is rejected with IPV6_EXTHDR_INVALID_OPTLEN, matching
how the IPv4 option loop already bounds a full option against the
remaining length. The check stays next to the read so each option type
does not need its own guard.

Ticket: #8817.
3 months ago
Victor Julien dde0d7295b tls: improve client/server hello parsing loops
Bug: #8795.
3 months ago
Philippe Antoine 46880985ef http2: find content-encoding without case-sensitivity
See RFC 9110 8.4.1

> All content codings are case-insensitive

Ticket: 8760
3 months ago
Philippe Antoine 425b9c6777 ftp/expectation: fix ippair leak
Ticket: 5204

ippair use_cnt increased by AppLayerExpectationCreate calling
IPPairGetIPPairFromHash was never decreased
3 months ago
Philippe Antoine dee0f03db4 detect/modbus: move modbus keyword to rust
Ticket: 3195
3 months ago
Philippe Antoine 3e70a79ed2 detect/nfs: move nfs.version to rust
Ticket: 3195
3 months ago
Philippe Antoine e976db7261 detect/template: remove template2
Ticket: 7278

Its usage was removed in 512bbe4de8
3 months ago
Philippe Antoine d0cc39c79a rfb/jsonschema: add missing field
Ticket: 6478
3 months ago
dependabot[bot] 060808f36e github-actions: bump ossf/scorecard-action from 2.4.3 to 2.4.4
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.3 to 2.4.4.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](4eaacf0543...2d1146689b)

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

Signed-off-by: dependabot[bot] <support@github.com>
3 months ago
dependabot[bot] 279317327c github-actions: bump github/codeql-action from 4.36.2 to 4.37.3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.36.2 to 4.37.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v4.36.2...v4.37.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
3 months ago