Commit Graph

19143 Commits (3b5bdc4261769db3c50037d1202c2414cf693507)
 

Author SHA1 Message Date
Denis Balashov 3b5bdc4261 examples: check rate filter callback registration result
Check DetectEngineEnabled() before registering, and warn if the
registration call returns false.
2 months ago
Denis Balashov 17151571b8 detect: guard rate filter callback registration, return bool on failure
SCDetectEngineRegisterRateFilterCallback() dereferences the result of
DetectEngineGetCurrent() unconditionally. Add a NULL guard with
SCLogError and return false so callers can detect registration failure.

Flagged by Svace and confirmed by gcc -fanalyzer.

Ticket: 8560
2 months ago
Denis Balashov 4d4c6227e1 detect/parse: assert HashListTableLookup results in duplicate sig check
Add DEBUG_VALIDATE_BUG_ON() at four sites in DetectEngineSignatureIsDuplicate()
where HashListTableLookup() is assumed to return non-NULL. Documents the
invariant that every Signature in sig_list has a dup_sig_hash_table entry
and catches violations in debug builds.

Flagged by Svace static analyzer.

Ticket: 8635
2 months ago
Denis Balashov 3828de20ed decode: propagate PacketAlertCreate failure instead of crashing
PacketAlertCreate is called from PacketInit on the packet allocation
path. Make PacketInit return bool and propagate the NULL result from
PacketAlertCreate up through PacketGetFromAlloc, which already returns
NULL to signal allocation failure to its callers.

Update the UNITTESTS-only helpers in defrag.c accordingly: helpers
returning Packet * use an explicit NULL check; the one returning int
keeps the existing FAIL_IF style.
2 months ago
Denis Balashov 344e89e3c6 qa/cocci: fix broken regex alternation in malloc-error-check
Coccinelle uses OCaml Str, not PCRE. The '|' and '()' characters are
literals in OCaml Str, so 'identifier func =~ "(SCMalloc|SCCalloc|...)"'
never matched anything — making the entire script a no-op since its
introduction.

Replace all five patterns with OCaml Str alternation syntax 'A\|B'.

Ticket: 8641
2 months ago
Denis Balashov 7124fdebf1 tests/fuzz: guard SCCalloc result in fuzz_decodebase64
If SCCalloc fails, decoded is NULL and the subsequent SCBase64Decode
call would dereference it. Return early on allocation failure.
2 months ago
Denis Balashov 2c16fb716b util/mpm-hs: fix null check parentheses; simplify SCHSConfigInit
Two fixes:
- Remove extra parentheses in existing NULL check: (*ext) -> *ext,
  which was causing the cocci script to miss the check as a false negative.
- Simplify SCHSConfigInit to return SCCalloc() directly; the caller
  in detect-engine.c already checks the return value for NULL.
2 months ago
Denis Balashov 04a1de1192 detect/reference: guard SCStrdup calls in DetectReferenceParse
Two SCStrdup calls that set ref->key had no NULL check. On allocation
failure the pointer would be used immediately, causing a NULL dereference.
2 months ago
Denis Balashov 01f64ea335 detect/flowbits: check SCRealloc result before overwriting pointer
The original pointer was overwritten with the SCRealloc result before
checking for NULL, causing a memory leak if reallocation fails.
Check the temporary pointer first before assigning.
2 months ago
Denis Balashov 21bcbe14c1 detect/alert: guard SCStrdup result before use
SCStrdup result was stored and immediately used without checking for
NULL, which would cause a NULL dereference if allocation fails.
2 months ago
Denis Balashov b2cd08bb91 util/log-redis: guard SCCalloc result for redis stream format
When Redis output is configured in stream/xadd mode with a positive
stream-maxlen, SCConfLogOpenRedis() allocates redis_setup.stream_format
and immediately passes it to snprintf().

If SCCalloc() fails, snprintf() receives a NULL destination pointer and
the process can crash during Redis output initialization. Handle this
unrecoverable setup failure with FatalError(), matching the surrounding
Redis initialization error handling.

Ticket: 8588
2 months ago
dependabot[bot] 39688a6252 github-actions: bump codecov/codecov-action from 6.0.1 to 7.0.0
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6.0.1 to 7.0.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](e79a6962e0...fb8b3582c8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
dependabot[bot] 6150d61d79 github-actions: bump github/codeql-action from 4.36.1 to 4.36.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.36.1 to 4.36.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.36.1...v4.36.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
Giuseppe Longo d892eb8e0e doc/sctp: add sctp keywords
Add documentation for all sctp keywords.

Ticket #4251
2 months ago
Giuseppe Longo dc44447ce6 detect/sctp: add sctp.chunk_data sticky buffer
Add a sctp.data sticky multi-buffer that allows content matching on the bytes
inside any of the SCTP DATA chunks extracted.

Ticket #4251
2 months ago
Giuseppe Longo 1413b082d3 decode/sctp: set p->payload to data chunk
Track the first DATA chunk's data offset and length during chunk iteration,
then reassign p->payload to point at the user data.

When no DATA chunk is present (INIT, SACK, HEARTBEAT, etc.),
payload_len is set to 0 since there is no application data.

Ticket #4251
2 months ago
Giuseppe Longo ede1bce923 output/json: add sctp metadata to alerts
Log SCTP-specific fields in the EVE JSON "sctp" object for alert events.

Ticket #4251
2 months ago
Giuseppe Longo 2116c3cafc detect/sctp: add sctp.vtag keyword
Add a U32 numeric keyword to match the SCTP verification tag
from the common header with prefilter support.

Ticket #4251
2 months ago
Giuseppe Longo 855f49b649 detect/sctp: add sctp.chunk_cnt keyword
Add a U8 numeric keyword to match the number of SCTP chunks
parsed in a packet with prefilter support.

Ticket #4251
2 months ago
Giuseppe Longo 88f17d7b20 detect/sctp: add sctp.chunk_type keyword
Add a U8 numeric keyword to match the first SCTP chunk type in a packet
with prefilter support.

Ticket #4251
2 months ago
Giuseppe Longo bbd0ecb616 detect/sctp: add sctp.hdr sticky buffer
Implement a sticky buffer to match the raw SCTP header
(common header + chunks)

Ticket #4251
2 months ago
Giuseppe Longo 21d35f6b37 decoder/sctp: extend decoder
Extend the SCTP decoder to parse chunk headers after the 12-byte common
header. Each chunk is validated for minimum header size and length
consistency per RFC 4960 sec 3.2.

Add SCTPChunkHdr and SCTPVars structs to track per-packet chunk metadata

Add five new decoder events for protocol violations:
- SCTP_CHUNK_TOO_SMALL: insufficient data for a chunk header
- SCTP_CHUNK_LEN_INVALID: chunk length < 4 or exceeds packet
- SCTP_INIT_CHUNK_NOT_ALONE: INIT/INIT_ACK bundled (RFC 4960 sec 6.10)
- SCTP_INIT_WITH_NON_ZERO_VTAG: INIT with vtag != 0 (RFC 4960 sec 8.5.1)
- SCTP_DATA_WITH_ZERO_VTAG: DATA chunk with vtag == 0

Ticket #4251
2 months ago
Martin Rehak 2ce2ebcdba suricata: guard RLIMIT_NPROC usage
Only use RLIMIT_NPROC when the platform exposes that resource limit constant.
2 months ago
Martin Rehak f34acfdeed util/cpu: enable SPARC misalignment emulation at startup
Call a SPARC-specific helper during pre-init so the kernel emulates unaligned accesses for this process instead of terminating on alignment faults. This matches the Solaris/SPARC portability fix that motivated the original patch.
2 months ago
Martin Rehak 1faa2921c1 util/syslog: guard LOG_FTP for Solaris
Only expose the ftp facility when the platform syslog headers define LOG_FTP.
2 months ago
Martin Rehak 823322cb1c util/time: avoid tm_gmtoff on Solaris
Skip tm_gmtoff and tm_zone initialization on Solaris where those struct tm members are not available.
2 months ago
Martin Rehak cf65f7692a build/solaris: use __sun and Solaris byteorder helpers
Replace uses of the non-standard sun macro with __sun and use Solaris byte swap helpers from <sys/byteorder.h>. This keeps the Solaris-specific code paths reachable when building with standard-conforming toolchains.
2 months ago
Martin Rehak 955827bc59 util/path: handle missing d_type definitions on Solaris
Guard DT_REG usage so directory walking code still builds on platforms where dirent does not expose d_type or DT_REG, such as Solaris.
2 months ago
Philippe Antoine e39075557a rust: check llmnr format
Ticket: 3836
2 months ago
Philippe Antoine 4144d9c709 rust: format snmp files
Ticket: 3836
2 months ago
Antoine Abou Faysal b09b04857a doc/userguide: add dataset match subdomain documentation
Ticket: 8385
2 months ago
Antoine Abou Faysal a3ab00e920 detect/dataset: add match subdomain option
Ticket: 8385

Add a new match subdomain option that enables blocking a domain and all its subdomains using datasets.
2 months ago
Shivani Bhardwaj 899eb38691 flowbits: deprecate toggle command
toggle command is not used by any major rulesets and increases the state
complexity of flowbits management. Also, all operations can be carried
out with the combination of other available commands. So, remove it.

Task 8595
2 months ago
Jason Ish 546209ff12 bindgen: fix include ordering
At some point, bindgen include ordering changed such that
AppLayerGetFileState was being bindgen'd as opaque, as the definition of
StreamBufferingConfig was not available when bindgen hit
AppLayerGetFileState, and bindgen processes in order.

Move the util includes before the app-layer includes to fix the ordering
problem, but still keep util includes grouped.

The sys diff is large as many things have been re-ordered.
2 months ago
Philippe Antoine 42fc785e12 fuzz/iprep: initialize to 0 buffer buffer before writing to it
And make MSAN happy
2 months ago
William Ling 30628e45bc rust: replace helper with built-in
Replace custom u32_as_bytes with built-in to_be_bytes

Issue: 5785
2 months ago
William Ling e7edc2a1e2 unittests: convert util-spm tests to FAIL/PASS API
Issue: 6334
2 months ago
Philippe Antoine 9318bbfbdb rust: format tftp files
Ticket: 3836
2 months ago
Philippe Antoine 9ec200e834 rust: format x509 files
Ticket: 3836
2 months ago
Philippe Antoine dd66276f82 rust: format telnet files
Ticket: 3836
2 months ago
Philippe Antoine 709ad1bdf4 rust: format sip files
Ticket: 3836
2 months ago
Samaresh Kumar Singh af3abf100e doc: dhcp eve note for option 52 overload
Document that DHCP options carried in the overloaded BOOTP sname or
file fields are now merged into the EVE log option set alongside the
main options area.

Bug: #8538.
2 months ago
Samaresh Kumar Singh f06bb7d43e dhcp: support option 52 overload
Per RFC 2132 the BOOTP sname and file fields can hold extra DHCP
options when option 52 is present, but the parser ignored them. After
parsing the main options we now look up option 52 and walk sname or
file as additional option streams, appending what we find to the same
options vector so the logger and detection keywords see the
overloaded values too.

Bug: #8538.
2 months ago
dependabot[bot] 0eda09f302 github-actions: bump codecov/codecov-action from 6.0.0 to 6.0.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](57e3a136b7...e79a6962e0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
dependabot[bot] aa24d7022b github-actions: bump github/codeql-action from 4.35.3 to 4.36.1
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.3 to 4.36.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.35.3...v4.36.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
dependabot[bot] 87a1521019 github-actions: bump actions/checkout from 6.0.2 to 6.0.3
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v6.0.2...v6.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
dependabot[bot] 9febbf6149 github-actions: bump vmactions/freebsd-vm from 1.4.5 to 1.4.6
Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 1.4.5 to 1.4.6.
- [Release notes](https://github.com/vmactions/freebsd-vm/releases)
- [Commits](d1e6581156...a6de9343ef)

---
updated-dependencies:
- dependency-name: vmactions/freebsd-vm
  dependency-version: 1.4.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
Philippe Antoine af7fad5514 detect: allocate arrays on the heap
buffer_type_id is a u32

Ticket: 8001
2 months ago
Philippe Antoine 2eede11195 detect: clean app-layer txs when we pass the flow
Ticket: 8619

Do not wait to run inspection on the other side of transactions
as we do not run any tx detection on passing flows.
Avoids accumulating txs
2 months ago
Juliana Fajardini f8945e7a1a yaml/firewall: expand firewall options explanation 2 months ago