Commit Graph

15805 Commits (872704f72fa445641624717b6f91eb8e2e171aae)
 

Author SHA1 Message Date
Shivani Bhardwaj 872704f72f version: start development towards 7.0.18 3 days ago
Shivani Bhardwaj f707f3208d release: 7.0.17; update changelog 4 days ago
Philippe Antoine bc39274a63 stream: disrupt never seen direction with async-oneside
Ticket: 8629

When we are in async-oneside mode, we see only one direction
of the traffic, and should not wait for the other direction
before cleaning up a transaction.

(cherry picked from commit 7ec9d72d28)
5 days ago
Philippe Antoine 181b3b2fdd flow: check ip family when comparing
Ticket: 8558

Do not accept an IPv6 as an IPv4 (even if the hash is likely
different in the first place)

Do the check also for ESP, and ebpf

(cherry picked from commit bc41dcc854)
5 days ago
Philippe Antoine 5cde93dea3 mqtt: bounds number of messages per tx
Ticket: 8525
(cherry picked from commit 03ba8a71d8)
5 days ago
Philippe Antoine 9d788575c5 ippair: check ip family when comparing
Ticket: 8559

Do not accept an IPv6 as an IPv4 (even if the hash is likely
different in the first place)

(cherry picked from commit 4a728464e6)
5 days ago
Philippe Antoine 19880f9d5b mime: fix buffer overread with small chunk during escape
Ticket: 8608
5 days ago
Jeff Lucovsky 88adab8bd3 smb: fail transaction creation once the limit is reached
new_tx() now refuses to create a transaction when the list is already at
SMB_MAX_TX, returning None instead of a transaction. Every creation path --
the new_*_tx helpers and their callers across smb1/smb2/dcerpc/session/
files/ioctl -- propagates that, so no single input can create more than the
limit, including a compound SMB2 request that chains many PDUs in one
record. When the list is full the parser puts the flow into an error state
and stops processing it.

This replaces the previous force-completion of old transactions, which did
not reliably bound the list and could leave transactions unreclaimable on
asymmetric flows. The now-unused tx_index_completed bookkeeping is removed.

Issue: 8629
(cherry picked from commit c8f68b0e4f)
5 days ago
Philippe Antoine 82af0aeb7c swf: prevents overflow with bad config value
Ticket: 8642

Do not allocate too much by using the config value, when the flash
file does not require that much data anyways

(cherry picked from commit d9fae18432)
2 weeks ago
Philippe Antoine 3dc82176e7 fuzz: forbid usage of pcre with \X
Ticket: 8634
(cherry picked from commit 097975e289)
3 weeks ago
Philippe Antoine 0dad38fff0 windows: always quote path for windows functions needing it
Ticket: 8600

CreateServiceA doc states for example :

> If the path contains a space, it must be quoted so that it is
  correctly interpreted.

Also fixes strlcat usage and check return value to error out on
truncated path

(cherry picked from commit ac1b3cc1ef)
3 weeks ago
Shivani Bhardwaj 6a23995c7d 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
      |
3 weeks ago
Shivani Bhardwaj d189f7a961 flowbits: add deprecation notice for toggle command
Task 8638
3 weeks ago
Shivani Bhardwaj 6e7907ecf9 http2: fix unneeded cast found by clippy
error: casting to the same type is unnecessary (`u16` -> `u16`)
    --> src/http2/http2.rs:1286:47
     |
1286 |     if !orig_state.is_null() && orig_proto == ALPROTO_HTTP1 as u16 {
     |                                               ^^^^^^^^^^^^^^^^^^^^ help: try: `ALPROTO_HTTP1`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#unnecessary_cast
note: the lint level is defined here
    --> src/lib.rs:23:38
     |
  23 | #![cfg_attr(feature = "strict", deny(warnings))]
     |                                      ^^^^^^^^
     = note: `#[deny(clippy::unnecessary_cast)]` implied by `#[deny(warnings)]`
2 months ago
Victor Julien 256aeaeb86 util/path: fix compile warning
util-path.c:251:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  251 |     char *final = strrchr(path, DIRECTORY_SEPARATOR);
      |           ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

(cherry picked from commit 72e3d7ad08)
2 months ago
Victor Julien b185b188d9 util/magic: fix compile warning in test
util-magic.c:443:11: error: initializing 'char *' with an expression of type 'const char *' discards
      qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  443 |     char *str = strstr(result, "OpenDocument Text");
      |           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
2 months ago
Victor Julien 93954d2a5f detect/pcre: fix compile warnings
detect-pcre.c:419:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  419 |     char *fcap = strstr(regexstr, "flow:");
      |           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~
detect-pcre.c:420:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  420 |     char *pcap = strstr(regexstr, "pkt:");
      |           ^      ~~~~~~~~~~~~~~~~~~~~~~~~
detect-pcre.c:421:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  421 |     char *acap = strstr(regexstr, "alert:");
      |           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.

(cherry picked from commit 0a4685f2ab)
2 months ago
Victor Julien b2bec23a54 decode: fix compile warning
decode.c:767:19: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  767 |             char *dot = strchr(DEvents[i].event_name, '.');
      |                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

(cherry picked from commit a45a70babd)
2 months ago
Victor Julien 361231a99a datasets: fix compile warning
datasets.c:159:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  159 |     char *got_colon = strchr(line, ':');
      |           ^           ~~~~~~~~~~~~~~~~~
1 error generated.

(cherry picked from commit 90ce1c54c4)
2 months ago
Victor Julien 6f6f690389 conf/yaml-loader: fix compile warning
conf-yaml-loader.c:87:8: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
   87 |     ep = strrchr(filename, '\\');
      |        ^ ~~~~~~~~~~~~~~~~~~~~~~~
conf-yaml-loader.c:89:12: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
   89 |         ep = strrchr(filename, '/');
      |            ^ ~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
2 months ago
Victor Julien a18921944d smtp: fix compile warning
app-layer-smtp.c:566:14: error: initializing 'uint8_t *' (aka 'unsigned char *') with an expression of type 'const void *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  566 |     uint8_t *lf_idx = memchr(input->buf + input->consumed, 0x0a, input->len);
      |              ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

(cherry picked from commit 5aee5ff6ed)
2 months ago
Victor Julien d34fbfa234 ftp: fix compile warnings
app-layer-ftp.c:278:14: error: initializing 'uint8_t *' (aka 'unsigned char *') with an expression of type 'const void *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  278 |     uint8_t *lf_idx = memchr(input->buf + input->consumed, 0x0a, input->len);
      |              ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
app-layer-ftp.c:1392:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
 1392 |     char *c = strchr(buffer, '\n');
      |           ^   ~~~~~~~~~~~~~~~~~~~~
2 errors generated.

(cherry picked from commit c21275cab3)
2 months ago
Victor Julien 067b9854a4 util/logopenfile: fix compile warnings
util-logopenfile.c:837:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  837 |     char *dot = strrchr(base, '.');
      |           ^     ~~~~~~~~~~~~~~~~~~
util-logopenfile.c:848:13: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  848 |         dot = strrchr(original_name, '.');
      |             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

(cherry picked from commit cd1c5967a5)
2 months ago
Shivani Bhardwaj 7c37d146f9 version: start development towards 7.0.17 2 months ago
Shivani Bhardwaj 534864353e release: 7.0.16; update changelog 2 months ago
Philippe Antoine 5c6af4419b http2: better compression against decompression bombs
Ticket: 8513

Suricata decides at 2 levels if a http2 flow is doing a compression
bomb.

There is a direct computation when one chunk of TCP data
is being parsed.
In this case, do not take the ratio into account, just use the size
of the decompressed data, so that if we get a big chunk of TCP data
like 1 MiB, and a not so high ratio of 200, we do not trigger
the debug assertion in util-file.c about 64MiB

The other case stays unchanged : when accumulating over the lifetile of
a flow with multiple txs, take into account the compression ratio,
so that a flow of many txs, having a super high (brotli) compression
ratio, ends up classified as a compression bomb.
(For example, having 100 txs each turning a 100 byte input into a 700 KiB
one)

(cherry picked from commit bf64b52b95)
2 months ago
Philippe Antoine b468bd631c http2: protection against decompression bombs
Ticket: 8513

During decompression, fail early if we have a big decompression
ratio, and enough data.
Track this data also during a tx lifetime, and even a flow/state
lifetime, so that we set event and fail also if the compression
bomb is split over multiple packets

(cherry picked from commit 7bf48b02be)
2 months ago
Philippe Antoine 16c689cbec http2: code refactoring to split big function
(cherry picked from commit 29e4b08647)
2 months ago
Philippe Antoine a41b135c5c http1: do not re-parse Content-Disposition header
Ticket: 8529

When Suricata handles a HTTP1 response body, it does so with a
file, and tries to get the filename from the Content-Disposition
header if any, then from the uri.

If it failed to find a file name, it tried again every time
there was new data from the response body, even if there was
no new data to find a file name in either the header nor the uri.

This causes a slowdown in the case the Content-Disposition header
is big.

Fix is to set the flag on the first call of the callback, to be
sure that we will parse the Content-Disposition header for a
filename header only once per http1 response.

(cherry picked from commit 9aaa6f7854)
2 months ago
Philippe Antoine 89cde65f8d detect/transforms: dotprefix can be chained
Ticket: 8537

Otherwise, it may cause a use-after-free, in case of reallocated
buffer and we used the buffer inspect which was freed.
2 months ago
Philippe Antoine 40aede627e nfs: bound namemap
Add to the hashmap only if there is not too many items in in

Ticket: 8418

(cherry picked from commit aea7ee21b8)
2 months ago
Philippe Antoine cc59c567f7 nfs: bound requestmap
Add to the hashmap only if there is not too many items in in

Ticket: 8418

(cherry picked from commit a50f494ef6)
2 months ago
Philippe Antoine 6c63fec9cb nfs: bound file_additional_procs to 1
Ticket: 8418

As we only need to know we saw at least one NFSPROC3_COMMIT

(cherry picked from commit 10bde66586)
2 months ago
Jason Ish a1de91bf92 dnp3: bound response reassembly
Ticket: 8460
(cherry picked from commit 078c08d84b)
2 months ago
Philippe Antoine 71210ab1a8 dnp3: fix off-by-one in array sizes
So that we can write a final zero without overflowing the array
and relying on padding to avoid further problems

Ticket: 8448
(cherry picked from commit 38d41e6fa6)
2 months ago
Philippe Antoine 8c807a86c9 dnp3: bounds reassembly
Ticket: 8460
(cherry picked from commit 658684a252)
2 months ago
Victor Julien 61c4df2821 http2: check for HTTP1 protocol during upgrade path
Ticket: 8492
(cherry picked from commit 6ebd0c3cc2)
2 months ago
Philippe Antoine b8ae15e2a0 defrag: check tracker/packet family in compare
Ticket: 8510

Without this check, in case of a hash collision, and the other
fields are equal, we could end up consider adding an IPv6 packet
to a IPv4 tracker (or vice versa).

Doing so, we end up interpreting an IPv6 packet as an IPv4 one,
and we do not benefit from the bounds checks from ipv4/ipv6 decoder.

(cherry picked from commit 24527d662a)
2 months ago
Philippe Antoine df3336bf4f frames: make sure we use a lowercase buffer name
Ticket: 8526

As some C protocols accepted case-insensitive frame names,
a rule using the same frame twice with different cases,
ended up using 2 different buffers,
which ended up in triggering a buffer overflow

(cherry picked from commit c977b2f31b)
2 months ago
Philippe Antoine 97251495e6 ikev2: remove unused field
Ticket: 8415
(cherry picked from commit 614c48d3c3)
2 months ago
Philippe Antoine 20fa5d773f tls/lua: add null checks
Ticket: 6286

This was fixed in main by Ticket 7887
2 months ago
Jason Ish 477120e340 datasets: fix path setup when load and save used with different paths
If load and save were used in the same rule with different paths, proper path
setup was skipped.

Ticket: #8546
(cherry picked from commit 74eb82a8a5)
2 months ago
Victor Julien 57cde5b0ae github-ci: disable libmagic on macos
5.47 is currently breaking CI, so disable during investigation.

Related to ticket #8342.

(cherry picked from commit 3068089762)
2 months ago
Philippe Antoine c0a5d1beb3 rust: allow clippy collapsible_match
To pass on clippy 1.95
3 months ago
Philippe Antoine 566717070d detect/http2: fix progress for headers
Ticket: 8451

Do not wait to see a data frame to run detection on http2 headers

(cherry picked from commit 40c8620184)
3 months ago
Eric Leblond e41d71ff84 etc/schema: add http_request_body
Ticket: 8161
(cherry picked from commit e4e5413478)
3 months ago
Philippe Antoine 3f99f07342 http2: set response_frame_size
Ticket: 8410

Do not set only request_frame_size whatever the direction

(cherry picked from commit 7b0528d85f)
3 months ago
Juliana Fajardini 10f617b3ff workflows: add qa-simulation mode
As build flag to (some of the) checks that run suricata-verify:
- CentOS Stream 9
- Fedora 41 (Suricata Verify codecov)
- Fedora 41 (clang, debug, asan, wshadow, rust-strict, systemd)
- Fedora 42 (gcc, debug, flto, asan, wshadow, rust-strict)
- Fedora (non-root, debug, clang, asan, wshadow, rust-strict)
- Ubuntu 24.04 (cocci)
- Ubuntu 22.04 (Debug Validation)
- Debian 12 (xdp)
- Debian 13 (xdp)
- Debian 12 MSRV

Related to
Ticket #7908
3 months ago
Juliana Fajardini f997e8fff9 exceptions: s/DEBUG/QA_SIMULATION build flag
Task #7885

(cherry picked from commit dc4d805908)
(cherry picked from commit f6093b6729)
3 months ago
Juliana Fajardini 226ef6c01a build-scopes: add QA_SIMULATION mode
For qa-simulation scenarios, especially for testing purposes.

Task #7885

(cherry picked from commit 5edb5a5d1a)
(cherry picked from commit f7cb04bfff)
3 months ago