Commit Graph

18228 Commits (078ab2ff7028ebb8243ef8f5467acd7e84c26387)
 

Author SHA1 Message Date
Philippe Antoine 078ab2ff70 conf: uses SCConfGetNonNull
Ticke: 8651

Uses it in place when we dereferenced the value straight away
after checking SCConfGet result but not its value

(cherry picked from commit 6bb271cee9)
3 months ago
Philippe Antoine 819299852c conf: introduce SCConfGetNonNull
Ticket: 8651

Behaves like SCConfGet but returns 0 on null value

(cherry picked from commit a9e1dff4a6)
3 months ago
Andreas Dolp 3e4bc398ae doc: improve manpage of suricatasc
- describe all options
- describe optional socket path

Redmine ticket: #8563

(cherry picked from commit 2f972b6759)
3 months ago
Victor Julien 2d17c31e48 decode/vlan: implement max layers for IEEE8021ah
Ticket: #8615.
(cherry picked from commit b11aa94d42)
3 months ago
Victor Julien 94a82f83ff defrag: decrement memuse on alloc failure
Ticket: #8613.
(cherry picked from commit 377462ea63)
3 months ago
Shivani Bhardwaj 69c777d617 rust: exclude DETECT_BYTEMATH_ENDIAN_DEFAULT from bindings
to deal with the failure due to cbindgen updates and mismatches in
generated bindings.

detect-bytemath.c:61: error: "DETECT_BYTEMATH_ENDIAN_DEFAULT" redefined [-Werror]
   61 | #define DETECT_BYTEMATH_ENDIAN_DEFAULT (uint8_t) BigEndian
      |
In file included from rust.h:34,
                 from detect-bytemath.c:32:
./../rust/gen/rust-bindings.h:5071: note: this is the location of the previous definition
 5071 | #define DETECT_BYTEMATH_ENDIAN_DEFAULT BigEndian
      |

(cherry picked from commit 0345b91ddd)
3 months ago
dependabot[bot] aedc0edec0 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>
(cherry picked from commit 39688a6252)

Cherry-pick note:
- old version wasn't actually 6.0.1
3 months ago
Victor Julien 46b98c97d2 detect/firewall: support hook LTE mode for built-in hooks
LTE support depended on registered hook names, but did not support the
built-in names. This commit adds the support.

Ticket: #8645.
(cherry picked from commit d154484cc6)
3 months ago
Victor Julien fd51eb2b83 detect: add helper for getting hook name
To fetch hook name from app-layer, or use built-ins.

(cherry picked from commit b02fa53134)
3 months ago
Victor Julien 0ea62b4943 detect: propagate inspect engine setup failures
(cherry picked from commit 569d27e153)
3 months ago
Victor Julien fe14bc8d37 detect: don't register unrelated inspect engines
For rules that specify an explicit app-layer hook,
e.g. http1:request_headers, don't register inspect engines for
other protocols like HTTP/2. These have their own progress tracking,
so should be excluded from these rules.

(cherry picked from commit d64954a873)
3 months ago
Victor Julien 892360565b github-ci: add --enable-qa-simulation to debug validation job 3 months ago
Juliana Fajardini a90ef60210 qa/live: update tests for fw stats counters
Part of
Ticket #7699

(cherry picked from commit 040369ed1a)
3 months ago
Victor Julien 1c4a1a2413 qa: add rule reload step to firewall test
Additionally, use bsize, pcre and urilen.

Ticket: #8204.
Ticket: #8397.
(cherry picked from commit 7ac32910c9)
3 months ago
Victor Julien ae3655f87d mpm/hs: fix compile warnings
CC       util-mpm-hs-cache.o
util-mpm-hs-cache.c:301:59: error: implicit conversion loses integer precision: '__size_t' (aka 'unsigned long') to 'uint32_t'
      (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
  301 |         SCSha256Update(hasher, (const uint8_t *)ref_info, strlen(ref_info));
      |         ~~~~~~~~~~~~~~                                    ^~~~~~~~~~~~~~~~
util-mpm-hs-cache.c:310:46: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t'
      (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
  310 |     if (!SCSha256FinalizeToHex(hasher, hash, hash_len)) {
      |          ~~~~~~~~~~~~~~~~~~~~~               ^~~~~~~~
2 errors generated.

(cherry picked from commit 736f50600f)
3 months ago
Victor Julien 497a69c5a8 clang-format: support clang 17
Update Github CI runner to use it.

Bump to Ubuntu 24.04 as well.

(cherry picked from commit 781bd5184e)
3 months ago
Victor Julien c1dbdaddf2 detect: cleanup last tx logic
Move into DetectTransaction.

(cherry picked from commit e0b501a4b7)
3 months ago
Victor Julien eddff49ebc detect: make progress values uint8_t
Also reflect that it can be >= 48, like in prefilter.

(cherry picked from commit 3d00e73d91)
3 months ago
Victor Julien 28f1b6b15f detect/firewall: minor code cleanup
(cherry picked from commit a9b3ad49ea)
3 months ago
Victor Julien 4a75eb9d4d detect/firewall: clean up apply accept logic
Use end state from tx.

Handle flow control from inside the function consistently.

(cherry picked from commit 4db84cfa28)
3 months ago
Victor Julien af8e861a2a detect/firewall: refactor per tx rule result handling
Break out the 3 options: match, partial match, no match for firewall
into separate functions.

Additionally, handle the re-match case for matches on a hook where the
progress value didn't yet progress further. In this case the continue
inspection logic revisits the rule and the accept needs to be
re-applied.

(cherry picked from commit 68885e75e1)
3 months ago
Victor Julien d095860fa1 detect/firewall: further simplify flow control
For the last for progress case we can just break on a firewall drop.

For the accept:flow and accept:tx cases the next sig (if any) will check
the flow/tx flag and manage flow control from there.

(cherry picked from commit 9c76480ac3)
3 months ago
Victor Julien 48ab24cba8 doc/userguide: add new constructs to firewall examples
(cherry picked from commit 0a84015214)
3 months ago
Victor Julien 05b9fd6969 doc/userguide: document firewall lte rule support
(cherry picked from commit 8728f9ffc0)
3 months ago
Victor Julien 166707f2f2 doc/userguide: fix default policies for pre_* hooks
Minor other cleanups.

(cherry picked from commit ac59883c26)
3 months ago
Victor Julien b0004fb7e1 doc: update firewall design
Bring in line with recent changes.

(cherry picked from commit da6af0879e)
3 months ago
Victor Julien b9aedae021 detect/firewall: clean up per rule run check
(cherry picked from commit bb6dc93789)
3 months ago
Victor Julien a1e3f90285 detect/firewall: minor flow control cleanup
(cherry picked from commit 035e8bc851)
3 months ago
Victor Julien c23e028369 detect/firewall: simplify pre-check flow
Simplify pre-check logic. Pre-check takes care of enforcing
FLOW_ACTION_ACCEPT, APP_LAYER_TX_ACCEPT and default policy enforcement
before the current rule's hook. This should be done in firewall mode for
each rule regardless whether it is a firewall or TD rule.

No need to track verdict state anymore.

(cherry picked from commit bb7aff36a8)
3 months ago
Victor Julien d74f9537c3 detect/firewall: clean up tx inspection loop
(cherry picked from commit 68f73302ce)
3 months ago
Victor Julien a97aa1a402 detect/firewall: consolidate action handling
Step towards consolidating all action handling into a central location.

(cherry picked from commit a86fe01cc3)
3 months ago
Victor Julien a39e36ce25 detect/firewall: clean up pre-check policy logic
(cherry picked from commit 1ad9c3ec29)
3 months ago
Victor Julien fa5ecdddec detect/firewall: fix accept:tx,alert in default policy
(cherry picked from commit 52967c69ec)
3 months ago
Victor Julien 22c3fb2ad0 detect/firewall: inject alert before default policy
If default policy is invoked because of missing rules for next hooks,
make sure to inject an alert before the next hook policies might do so.

(cherry picked from commit 247c6a2333)
3 months ago
Victor Julien 08376ae63a detect/firewall: update discarded logic
Only count alert queue overflow here, not alerts in the queue after a drop.

(cherry picked from commit 90a837cef3)
3 months ago
Victor Julien 8c94f108bc detect/firewall: drop in fw mode does not include alert
In TD mode the drop action also includes alert.

In firewall mode it should not to stay in line with accept.

Ticket: #8601.
(cherry picked from commit 57b16c964e)
3 months ago
Victor Julien 816e70029e detect/firewall: log alert for app default with alert
Fix missing alert on drop:flow,alert

(cherry picked from commit f1090da254)
3 months ago
Victor Julien ea666020d1 detect/firewall: improve handle fw alert handling
More clearly define the relationship between PacketAlerts for firewall
and threat detection events.

Also no longer count firewall_discarded if drop rule came before a
another rule, causing the later rule to not be evaluated/alerted.

When packet:filter and app:filter alert appear in a single alert queue,
handle accept:hook by keeping track of the detect_table.

(cherry picked from commit 485f5243d5)
3 months ago
Victor Julien f5ee931d6b detect/alert: fix suppressed drop handling
If drop was issued for suppressed rule, still consider it for the
next alert.

(cherry picked from commit 7e9402a2e0)
3 months ago
Victor Julien 9bd0ce75d6 detect: minor action handling cleanup
Don't run exact same check twice.

(cherry picked from commit 508bb71d78)
3 months ago
Victor Julien ca79a30b97 detect/firewall: fix TD drop:flow after FW accept:flow
Threat detection can drop a flow that is but in accept:flow by the
firewall.

(cherry picked from commit 9bcf0f332b)
3 months ago
Victor Julien 3670b36296 detect/firewall: fixup debug message
(cherry picked from commit ecf2161f3b)
3 months ago
Victor Julien 24736ed8ff detect/firewall: minor code cleanup
(cherry picked from commit fb9747df8e)
3 months ago
Victor Julien 5868e54fca eve/alert: firewall default policy logging improvements
Add firewall.hook to indicate the hook that the policy was set on.

Ticket: #8566.
(cherry picked from commit 8572088b0f)
3 months ago
Victor Julien 2b09cb8ab4 detect/firewall: support alert in packet default policy
Support `alert` as a secondary action in packet firewall policies.

To implement this a Signature object is created per policy that uses
alert, and this is stored in a array table. When the policy is applied
the signature is looked up and used in the PacketAlert.

Ticket: #8566.
(cherry picked from commit dc4c22e906)
3 months ago
Victor Julien 6440d4486c detect/firewall: support alert in default app policy
Support `alert` as a secondary action in app-layer firewall policies.

To implement this a Signature object is created per policy that uses
alert, and this is stored in a hash table. When the policy is applied
the signature is looked up and used in the PacketAlert.

Ticket: #8566.
(cherry picked from commit 2d4f1968b8)
3 months ago
Victor Julien 97e774bd6c detect/analyzer: log firewall lte rule for prior states as well
(cherry picked from commit 6e037d9783)
3 months ago
Victor Julien 74c2233e22 detect/firewall: limit auto accept notation
Limit to accept:flow, accept:tx and accept:hook.

(cherry picked from commit 71a6a9a746)
3 months ago
Victor Julien 85f2685388 detect/firewall: implement initial state range support
Allow a single rule to accept a hook and the hooks prior to it.

Example:

        accept:flow tls:<client_hello_done ... \
                tls.sni; content:"suricata.io"; endswith;

This will evaluate the SNI at the client_hello_done hook, but will
act as if there is a `accept:hook tls:client_in_progress ...` as well.

Implementation is currently specific to this `<` operator. During
parsing the sig gets flagged for this case. During setup this has 3 main
effects:

1. prefilter is disabled as we need to eval this right at the first
   state (0)
2. for state 0 a non-PF "prefilter" engine is setup to make sure the
   rule is flagged for evaluation
3. In the Signature::app_inspect list a dummy inspect engine is
   registered per state before Signature::app_progress_hook

The matching logic is building on the stateful rule handling. The
stateful rule handling can now tell the inspection loop that a partial
match occured. For this rule type the partial match will act as a match
with action accept:hook.

Next app updates will then use the continue detection logic to continue
the stateful match. When that fully matches, the final actions are
applied, like accept:flow or accept:tx.

Ticket: #8472.
(cherry picked from commit 651afba883)
3 months ago
Victor Julien c82e5ddf01 detect/firewall: fix last for progress handling
In last_for_progress handling set accept only on packet if it was also
triggered on the last tx.

If there are more transactions, the accept can be set later (if policy
allows).

(cherry picked from commit f6dc772677)
3 months ago