Commit Graph

15753 Commits (e56afc6d522fbc8e124bf91bb77748b16fa43ae1)
 

Author SHA1 Message Date
Juliana Fajardini e56afc6d52 release: 7.0.15; update changelog 1 month ago
Philippe Antoine 5610ea4c95 detect/http2: use ThreadCtx for all headers keywords
Instead of custom inefficient "escaped" Vec

Ticket: 8291
(cherry picked from commit 062f56ddde)
1 month ago
Philippe Antoine cc6951da8d detect/http2: use ThreadCtx for http.request_header
And also for http.response_header

Instead of custom inefficient "escaped" Vec

Ticket: 8291
(cherry picked from commit 4e538dfa3b)
1 month ago
Philippe Antoine 7f8695c3bb detect/http2: use ThreadCtx for http.header.raw
Instead of custom inefficient "escaped" Vec

Ticket: 8291
(cherry picked from commit 0933e944df)
1 month ago
Philippe Antoine f9d2616f4b detect/http2: use ThreadCtx for http.header
Instead of custom inefficient "escaped" Vec

Ticket: 8291
(cherry picked from commit 711de8a5ea)
1 month ago
Philippe Antoine 9a030720ee detect/http2: use ThreadCtx for http.header_names
Instead of custom inefficient "escaped" Vec

Ticket: 8291
(cherry picked from commit 52a2f2dd19)
1 month ago
Philippe Antoine e922a324a0 app-layer: fix uint overflow in debug assertion
Krb5 can request it needs a 0xFFFFFFFF record

(cherry picked from commit 61b5461782)
1 month ago
Philippe Antoine 4c51a74e2e krb5: use app-layer incomplete support
Ticket: 3540
Ticket: 8305
(cherry picked from commit 8e886a8ecd)
1 month ago
Victor Julien fecaa08f59 stream/reassembly: improve progress tracking for GAP cases
When during raw reassembly it is detected that last ack is moved beyond
the progress and also beyond the data retrieved, update progress to the
last ack value.

Bug: #8272.
(cherry picked from commit ac1a514c7b)
1 month ago
Philippe Antoine 82b7c9c35a http2: bound number of http2 frames per tx
Ticket: 8289

If stream.reassembly.depth is unlimited,
an attacker controlling the 2 sides of a communication going through Suricata
can send a transition with an infinite number of headers, until suricata OOMs

Solution is to offer a configuration option to bound the number
of HTTP2 frames we store in a HTTP2 transaction, and produce an
anomaly if this bound is crossed

(cherry picked from commit 784e173278)
1 month ago
Philippe Antoine 281f419c04 dcerpc: use take instead of split_off(0)
Ticket: 8304

Avoids quadratic complexity.
With split_off(0), the whole vec is copied, so if wa have other
calls supplying one byte at a time, we keep on copying increasing
data
1 month ago
Victor Julien 162ea8f759 doc: fix dcerpc.opnum documentation
Docs were claiming greater than, less than, etc. support even though this was never supported.

Fixes: 51be8f0238 ("doc/dcerpc: add proto keywords")

Ticket: #8330.
(cherry picked from commit 2480f8c038)
2 months ago
Sven Cuyt 3ebe6cd21b doc/userguide: add link to differences-from-snort
Ticket: #8031.
(cherry picked from commit 1246f1cf8c)
2 months ago
Sven Cuyt 77e3876f53 doc/userguide: fix table showing example payload
Ticket: #8031.
(cherry picked from commit a0cc534471)
2 months ago
Sven Cuyt ce533d095b doc/userguide: add example with non-zero offset for relative isdataat
Ticket: #8031.
(cherry picked from commit 2d662538e5)
2 months ago
Victor Julien ab7e871d53 doc/userguide: explain isdataat absolute vs relative difference
Ticket: #8031.
(cherry picked from commit 7c5285e5e6)
2 months ago
Victor Julien 813e66d691 krb5: fix TCP record parsing
A logic error in multi-record parsing meant only the first record was parsed.

Bug: #8278.
(cherry picked from commit 336a9d05ca)
2 months ago
Andreas Dolp d2142181c3 doc/userguide: fix within-distance pointer graphics in payload-keywords doc
Redmine ticket: #8261

According to [1], the within pointer (if combined with distance)
includes the distance pointer, which is not clearly visible in the
graphic.

Fixed this in a new graphic by some GIMP arts.

PS: Special thanks to one of our team members Annika C. for initially
spotting this!

[1] https://forum.suricata.io/t/is-within-affected-by-distance/1688

(cherry picked from commit 69eb567dea)
2 months ago
Sergey Zhidkih 8cbb0cc6bf util-spm-hs: add missing deallocator
Add missing deallocator for expr when hs_compile fails.

Bug: #8146
(cherry picked from commit 799f01f78f)
2 months ago
Philippe Antoine 8a472c5b9e util-spm-hs: add missing deallocator
Add missing deallocator when hs_alloc_scratch fails.

Bug: #8146
(cherry picked from commit 251d10fa42)
2 months ago
Philippe Antoine a9c4dbaf90 fuzz: use lower pcre limits
to avoid timeouts

instead of forbidding pcre signatures on stream

Ticket: 4858
(cherry picked from commit 7750226e43)
2 months ago
Lukas Sismis 38840c578e dpdk: collect port stats before device stop
Some drivers (e.g. BNXT) fail to report stats after the device is
stopped. Move stats collection (DPDKDumpCounters and PrintDPDKPortXstats)
to run before rte_eth_dev_stop() in HandleShutdown.

Also change PrintDPDKPortXstats error handling from FatalError to
graceful return since stats collection failures during shutdown
should not crash the application.

The commit removes ThreadExitPrintStats callback as the function had no
useful features after the stats were moved.

Ticket: 8253
(cherry picked from commit 27f398b5f2)
2 months ago
Philippe Antoine 613f28df05 rust: fix unnecessary_unwrap warnings
warning: called `unwrap` on `rd.pipe` after checking its variant with `is_some`
   --> src/smb/smb1.rs:858:28
    |
857 |             if rd.pipe.is_some() {
    |             -------------------- help: try: `if let Some(<item>) = rd.pipe`
858 |                 let pipe = rd.pipe.unwrap();
    |                            ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_unwrap
    = note: `#[warn(clippy::unnecessary_unwrap)]` on by default

(cherry picked from commit 02cb0f2ac2)
3 months ago
Philippe Antoine 6c63400d65 http1: marks tx as updated when setting an event
Ticket: 8224

We sometimes set events to the last tx, so we do not have access
to the HtpTxUserData in the caller HTPHandleError

(cherry picked from commit c333b28719)
3 months ago
Victor Julien 96f7549a18 detect/base64_data: reset buffer offset
When in a `base64_decode`-`base64_data` pair the decode was depending
on another match through the relative option, the `buffer_offset` would
be updated to the relative position of the previous match. During the
`base64_data` phase, a relative match would use that offset even though
the match happened in a new buffer.

Example::

        http.request_body; content:"|27|";                              \
                base64_decode:relative;                                 \
                base64_data; content:"|ff ff ff ff|"; within:16;

This use of the `buffer_offset` is incorrect as that value is relative
to a buffer and the `base64_data` points to a new buffer.

This patch addresses this by resetting DetectEngineThreadCtx::buffer_offset
before inspecting `base64_data`.

Bug: #7842.
(cherry picked from commit 5f92a6cac3)
3 months ago
Victor Julien 7759e529de doc/userguide: endswith can be mixed with offset/distance/within
Bug: #5030.
(cherry picked from commit 73a873ecfe)
3 months ago
Victor Julien eedf7c3964 datasets: fix compile warnings
datasets-string.c:53:20: error: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Werror,-Wshorten-64-to-32]
        return len + 2;
        ~~~~~~ ~~~~^~~
1 error generated.

(cherry picked from commit 844f6011b1)
3 months ago
Shivani Bhardwaj 308e0b6881 version: start development towards 7.0.15 3 months ago
Shivani Bhardwaj 163bd652df release: 7.0.14; update changelog 3 months ago
Jason Ish a6d950315d dnp3: bound the maximum number of objects per tx
Default to 2048, but provide a user configuration value.

Ticket: #8181
(cherry picked from commit 2c95f1ff44)
3 months ago
Jason Ish fdd79bdb14 dnp3: set a bound on the number of points per message
16384 is used as the max, but a configuration parameter has been
provided. The reason for setting an upper bound is that bit flags can
create a memory amplification as we parse them into individual data
structures.

Ticket: #8181
(cherry picked from commit 3a32bb5743)
3 months ago
Jason Ish 635af8dc8b dnp3: reduce flood threshold to 32 and make configurable
Lower the number of unreplied requests from 500 to 32 to consider a
flood. At the very least this is an anomaly given the DNP3 spec mentions
that DNP3 should only have one outstanding request at a time, with an
exception for unsolicited responses, so in practice no more than 2
should be seen.

Additionally make this value configurable by introducing the max-tx
parameter.

Ticket: #8181
(cherry picked from commit a16f087b93)
3 months ago
Jason Ish 63225d5f8e dnp3: check done state, not complete state for progress
Complete is a flag used to tell if the message was completely parsed,
as not all messages may be completely parsed if we don't know all
their objects. However, they are still "done".

In the alstate-progress callback, check the done flag, not the
complete flag.

Ticket: #8181
(cherry picked from commit d61eef9a8a)
3 months ago
Philippe Antoine c9b80e5aff dcerpc: use saturating_add to count fragments
And do not overflow if we have traffic with more than 65K fragments

(cherry picked from commit a48200b9e5)
3 months ago
Shivani Bhardwaj df389f8a43 doc: add dcerpc.max-stub-size config param
(cherry picked from commit 6702791a9c)
3 months ago
Shivani Bhardwaj f82a388d02 dcerpc: add upper limit on stub data
DCERPC parsers had no upper bounds when it came to extending the stub
data buffer. Traffic can be crafted to bypass some internal parser
conditions to create an indefinite buffering in the stub_data array that
can make Suricata crash.

Add a default limit of 1MiB and make it configurable for the user.

Security 8182

Co-authored-by: Philippe Antoine <pantoine@oisf.net>
(cherry picked from commit e412215af9)
3 months ago
Shivani Bhardwaj 5789a3d376 detect/alert: check alert queue capacity before expanding
So far, the alert queue was expanded by doubling in size w/o any
boundary checks in place. This led to situations where doubling
the alert_queue_capacity meant overflow of the very same value
stored in det_ctx.
This led to heap-use-after-free in some conditions where
det_ctx->alert_queue_capacity overflowed.

Fix this by capping the max of alert_queue_capacity by checking if its
expansion could result in an overflow.

Security 8190

(cherry picked from commit ac1eb39418)
3 months ago
Philippe Antoine 7e704a3f50 output: use tx iterator for finding alert http xff
Ticket: 8156

Allows better performance.

(cherry picked from commit ab2e128176)
3 months ago
Philippe Antoine 44d0c81f53 output: optimize loop for finding alert http xff
Ticket: 8156

In case of non-tx alerts, we try to loop over all the txs to find
the xff header. Do not start from tx_id 0, but from min_id
as AppLayerParserTransactionsCleanup to skip txs that were freed

(cherry picked from commit 3b1a6c1711)
3 months ago
Philippe Antoine 27a2180bce datasets: allocates on the heap if string base64 is long
Ticket: 8110
(cherry picked from commit d6bc718e30)
3 months ago
Philippe Antoine 32609e6896 datasets: explicitly errors on too long string
Also avoids stack allocation

Ticket: 8110
(cherry picked from commit 0eff242137)
3 months ago
Giuseppe Longo 01caba469a flow: swap MACs when flow direction is swapped
When FlowSwap() reverses the direction of a flow, the MAC address sets
stored in the flow also need to be swapped to maintain consistency with
the new direction. Previously, MAC addresses were not swapped along with
other flow properties like packet/byte counters.

Ticket #8172

(cherry picked from commit f1b9669ed5)
3 months ago
Giuseppe Longo b2f99ca37b util/macset: fix code style
Code style fixed using clang-format.

Ticket #8172

(cherry picked from commit 8050738fea)
3 months ago
Jason Ish 767ea29a21 rust: update flate2 to 1.0.35
flate2 depends on adler which is no longer maintained and triggers this
cargo audit warning:

Crate:     adler
Version:   1.0.2
Warning:   unmaintained
Title:     adler crate is unmaintained, use adler2 instead
Date:      2025-09-05
ID:        RUSTSEC-2025-0056
URL:       https://rustsec.org/advisories/RUSTSEC-2025-0056
Dependency tree:
adler 1.0.2
└── miniz_oxide 0.7.1
    └── flate2 1.0.28
        └── suricata 7.0.14-dev

Updating flate2 uses a new maintained fork of adler.

Ticket: #5994
4 months ago
Victor Julien 52f042edea affinity: harden config parsing
To fix a null ptr deref:

        Program received signal SIGSEGV, Segmentation fault.
        __strcmp_avx2_rtm () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:115
        115     ../sysdeps/x86_64/multiarch/strcmp-avx2.S: No such file or directory.
        (gdb) bt
        #0  __strcmp_avx2_rtm () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:115
        #1  0x000055555568afec in AffinitySetupLoadFromConfig () at util-affinity.c:183
        #2  0x0000555555748785 in RunModeInitializeThreadSettings () at runmodes.c:1000
        #3  0x0000555555682f51 in SuricataMain (argc=19, argv=<optimized out>) at suricata.c:2979
        #4  0x00007ffff6829d90 in __libc_start_call_main (main=main@entry=0x55555567fa20 <main>, argc=argc@entry=19, argv=argv@entry=0x7fffffffe168) at ../sysdeps/nptl/libc_start_call_main.h:58
        #5  0x00007ffff6829e40 in __libc_start_main_impl (main=0x55555567fa20 <main>, argc=19, argv=0x7fffffffe168, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe158) at ../csu/libc-start.c:392
        #6  0x000055555567f955 in _start ()
        (gdb) f 1
        #1  0x000055555568afec in AffinitySetupLoadFromConfig () at util-affinity.c:183
        183             if (strcmp(affinity->val, "decode-cpu-set") == 0 ||
        (gdb) p affinity->val
        $1 = 0x0
4 months ago
Victor Julien ac1e9592ef doc/af-packet: document disable-hwtimestamp option
Ticket: #1954.
(cherry picked from commit be2c40bde7)
4 months ago
Victor Julien c52203667a af-packet: add disable-hwtimestamp option
HW timestamping is not always reliable, so add an option to disable it.

Bug: #1954.
(cherry picked from commit 18a6a079da)
4 months ago
Victor Julien a5ae543c61 parse/size: support IEEE 1541 size units
Introduce KiB, MiB and GiB. They are case sensitive as a lower case 'b'
means bits in the IEEE 1541 scheme.

KiB = 1024
MiB = 1048576
GiB = 1073741824

Ticket: #1457.
(cherry picked from commit 342aec8f1c)

Left the error messages untouched in the backport. So this is more
quietly supporting the new units.
4 months ago
Victor Julien 24e7cf2f2c parse/size: fix unit test checks
(cherry picked from commit 0e03691fdb)
4 months ago
Jeff Lucovsky 4b103e62d0 output/null: Add the null output device
This commit adds the null output device; to use, set the filetype
to "nullsink" for each output that should discard and never persist
logs/alerts/etc.

This is implemented as an "internal eve output plugin" just like the
syslog eve output type.

(cherry picked from commit ad96382cf2)
4 months ago