Commit Graph

15587 Commits (suricata-7.0.11)
 

Author SHA1 Message Date
Victor Julien 5e501e2591 eve/alert: init membuffer size on missing config
Don't init buffer to 0 size but use the desired default of 4k.

(cherry picked from commit 462a6d7913)
10 months ago
Victor Julien 410ff80c34 eve/alert: log payload directly from stream buffer
This avoids looping over partly duplicate segments that cause
output data corruption by logging parts of the stream data multiple
times.

For data with GAPs now add a indicator '[4 bytes missing]' similar
to how Wireshark does it.

Bug: #6553.
(cherry picked from commit 43858f70ad)
10 months ago
Victor Julien 8bab8f9027 eve/frame: implement payload-buffer-size option
Modeled after the same option in eve/alert. Defaults to 4k.

(cherry picked from commit 829bab295b)
10 months ago
Victor Julien a7dc1aa733 stream: const args for StreamReassembleLog
Needed a workaround cast for RBTREE use.

(cherry picked from commit a5a6527d26)
10 months ago
Philippe Antoine 6a8d29c69e ci: mov from cifuzz to clusterfuzzlite
To better support main7 CI fuzzing

Ticket: 7253
(cherry picked from commit b3bd57246f)
10 months ago
Philippe Antoine 50ee5e09c7 frames: do not only rely on FRAME_STREAM_ID
As stream frame is not always created,
hence the first frame is not always a stream frame :
If stream frame is not enabled, it does not get created,
and other enabled frames may be created first.
See use of FrameConfigTypeIsEnabled

This resulted that this other frame got its length updated
on stream end, which led to false positives.

Also checking FRAME_STREAM_TYPE is more consistent.

Not a clean cherry-pick as AppLayerFrameGetLastOpenByType
does not exist in main7

Ticket: 7213
10 months ago
Philippe Antoine 9571df8936 rust/detect: fix too_long_first_doc_paragraph clippy warning
warning: first doc comment paragraph is too long
  --> src/detect/iprep.rs:57:1
   |
57 | / /// value matching is done use `DetectUintData` logic.
58 | | /// isset matching is done using special `DetectUintData` value ">= 0"
59 | | /// isnotset matching bypasses `DetectUintData` and is handled directly
60 | | /// in the match function (in C).
   | |_
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
   = note: `#[warn(clippy::too_long_first_doc_paragraph)]` on by default
help: add an empty line

(cherry picked from commit dc3c048b49)
10 months ago
Philippe Antoine d3927afb70 rust/dcerpc: fix single_match clippy warning
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> src/dcerpc/log.rs:36:33
   |
36 |               DCERPC_TYPE_BIND => match &state.bind {
   |  _________________________________^
37 | |                 Some(bind) => {
38 | |                     jsb.open_array("interfaces")?;
39 | |                     for uuid in &bind.uuid_list {
...  |
51 | |                 None => {}
52 | |             },
   | |_____________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `#[warn(clippy::single_match)]` on by default

(cherry picked from commit 2a984e3b13)
10 months ago
Victor Julien c6aeec10b5 detect/app-layer-proto: fix prefilter check
Prefilter wasn't yet using `AppProtoEquals` which might lead to
mismatches with HTTP and DCERPC related signatures.
11 months ago
Victor Julien 9d922af7c1 detect/app-layer-proto: don't run detection on ALPROTO_UNKNOWN
Don't return true for negated protocol check if no protocol has been
evaluated due to ALPROTO_UNKNOWN in the packet direction.

This leads to false positives for negated matching, as an expression
like "!tls" will match if checked against ALPROTO_UNKNOWN.

This patch readds missing check. The keyword returns no match as
long as the alproto is ALPROTO_UNKNOWN.

Fixes: bf9bbdd612 ("detect: fix app-layer-protocol keyword for HTTP")

Ticket: #7242.
11 months ago
Philippe Antoine 98fd40a4b3 tls/ja3: do not append to ja3 str once ja3 hash is computed
Ticket: 6634

That means take only the first client hello into account.
This way, we do not end with ja3 string with 9 commas...

(cherry picked from commit 84735251b5)
11 months ago
Philippe Antoine ded2082416 rust/ike: fix collapsible_match clippy warning
warning: this `match` can be collapsed into the outer `match`
help: the outer pattern can be modified to include the inner pattern
(cherry picked from commit 42e5e556e5)
11 months ago
Philippe Antoine bc1b906a7b rust: fix byte_char_slices clippy warnings
warning: can be more succinctly written as a byte str
   --> src/mime/smtp.rs:762:37
    |
762 |     mime_smtp_find_url_strings(ctx, &[b'\n']);
    |                                     ^^^^^^^^ help: try: `b"\n"`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices
    = note: `#[warn(clippy::byte_char_slices)]` on by default

(cherry picked from commit 564f685eea)
11 months ago
Sascha Steinbiss dc8cda6887 userguide: fix spelling of `security_result` EVE field
This ensures that the correct spelling of the `security_result` EVE
field for RFB (as opposed to `security-result`) is also reflected in the
documentation.

Ticket: #7210
(cherry picked from commit cb14e44780)
11 months ago
Sascha Steinbiss 8c8abbf7fa rust/rfb: use consistent key name for security_result
A typo caused a slightly different key (`security-result`) to be used
for the case in which the result was `FAIL`. This commit addresses this
by ensuring the same string is used for all cases.

Ticket: #7198
11 months ago
Eric Leblond 0f3a37acaa datasets: fix parsing of ip4 in ip6
The lookup function was not taking into account that we can have
an IPv4 or an IPv6 address as parameters and that this addresses
need to be converted to Suricata internal storage.
By using the already defined dedicated parsing function, we are
fixing the issue.

Issue: #6969
(cherry picked from commit 4668c95513)
11 months ago
Juliana Fajardini 37ec6251e9 pgsql: check for eol when parsing response
It was brought to my attention by GLongo that Pgsql parser handled eof
diffrently for requests and responses, and apparently there isn't a good
reason for such a difference therefore, apply same logic used for
rs_pgsql_parse_request for checking for eof when parsing a response.

(cherry picked from commit ce1556cefd)
11 months ago
Juliana Fajardini 1c483c9d65 output/json: add pgsql metadata logging to alerts
Bug #6092

Related to
Bug #6983
11 months ago
Juliana Fajardini f5cc23464b pgsql/logger: open json object from logger function
Before, the JsonBuilder object for the pgsql event was being created
from the C-side function that actually called the Rust logger.

This resulted that if another module - such as the Json Alert called the
PGSQL logger, we wouldn't have the `pgsql` key present in the log output
- only its inner fields.

Bug #6983

(cherry picked from commit 69e26de197)
11 months ago
Victor Julien 32c8a7614d doc/userguide: update guidance on 5 to 6 upgrading
TCP memory use can be higher than expected in certain configs.

Ticket: #6552.
(cherry picked from commit 3456dea276)
11 months ago
Victor Julien 107cd77ecb tcp: fix 'broken ack' on flow timeout
Don't set an ACK value if ACK flag is no longer set. This avoids a bogus
`pkt_broken_ack` event set.

Fixes: ebf465a11b ("tcp: do not assign TCP flags to pseudopackets")

Ticket: #7158.
(cherry picked from commit a404fd26af)
11 months ago
Philippe Antoine 7b547c7cd6 detect/nfs: do not free a null pointer
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69840
(cherry picked from commit b34d4b1314)
11 months ago
Jason Ish 03844b4291 eve/dns: make version required
The "eve.version" field is not always logged. Update the schema to
enforce that it is, and fix it for records that don't log it.

Ticket: #7167
(cherry picked from commit fcc1b1067b)
11 months ago
Victor Julien 304fe41762 profiling: allow absolute paths
Ticket #6490.

(cherry picked from commit 855cc89636)
11 months ago
Philippe Antoine d72ec89c37 rust: compatibility with cbindgen 0.27
Ticket: 7206

Cbindgen 0.27 now handles extern blocks as extern "C" blocks.
The way to differentiate them is to use a special comment
before the block.

(cherry picked from commit 304271e63a)
12 months ago
Jason Ish 926a7dae48 configure: require cbindgen version of 0.16.0 or newer 12 months ago
Jason Ish 1e0c64187f rust/dcerpc: fix rustdoc indentation
Fixes clippy lint:

error: doc list item missing indentation
   --> src/dcerpc/dcerpc.rs:511:9
    |
511 |     ///  description: direction of the flow
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
12 months ago
Jason Ish 5ce35f581a rust/conf: collapse match pattern into if
Fixes clippy lint for collapsible_match.

error: this `match` can be collapsed into the outer `if let`
  --> src/conf.rs:85:9
   |
85 | /         match val {
86 | |             "1" | "yes" | "true" | "on" => {
87 | |                 return true;
88 | |             },
89 | |             _ => {},
90 | |         }
   | |_________^
   |
help: the outer pattern can be modified to include the inner pattern
  --> src/conf.rs:84:17
   |
84 |     if let Some(val) = conf_get(key) {
   |                 ^^^ replace this binding
85 |         match val {
86 |             "1" | "yes" | "true" | "on" => {
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ with this pattern
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
12 months ago
Jason Ish 2c92b12e19 rust/http2: remove redundant pattern match
Fix clippy lint for if_let_redundant_pattern_matching by using
.is_some().
12 months ago
Jason Ish 8e93ae0a22 rust/dcerpc: clippy fix for match
error: this `match` can be collapsed into the outer `match`
   --> src/dcerpc/detect.rs:215:20
    |
215 |           Some(x) => match x {
    |  ____________________^
216 | |             DCERPC_TYPE_REQUEST | DCERPC_TYPE_RESPONSE => {}
217 | |             _ => {
218 | |                 return 0;
219 | |             }
220 | |         },
    | |_________^
    |
help: the outer pattern can be modified to include the inner pattern
   --> src/dcerpc/detect.rs:215:14
    |
215 |         Some(x) => match x {
    |              ^ replace this binding
216 |             DCERPC_TYPE_REQUEST | DCERPC_TYPE_RESPONSE => {}
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with this pattern
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
12 months ago
Jason Ish fcc1da0144 rust/ssh: fix clippy warning, reference can be used
Fix done by clippy --fix.
12 months ago
Jason Ish f3f7bcc091 rust: fix clippy warnings for match as if statements
Fix done by clippy --fix.
12 months ago
Philippe Antoine 33783269ae fuzz: make confyaml.c an explicit source
Ticket: 7181

Allows confyaml.c to be in the release archive

(cherry picked from commit 3f8251bd47)
12 months ago
Jeff Lucovsky a3af0e98a1 output/json: Close jb object on error
Issue: 7194

Ensure that the jb object is closed on errors.
12 months ago
Philippe Antoine 67311e3d47 detect/integers: harmonize parser return handling
Ticket: 7172

When parsing an integer for a rule keyword fails, we return error
straight away, without bothering to try to free the NULL pointer.

On the way, remove some one-line wrapper around DetectUxParse

(cherry picked from commit daad7f2d41)
12 months ago
Lukas Sismis ee9aad22f7 dpdk: replace TSC clock with GetTime (gettimeofday) function
Getting clock through Time Stamp Counter (TSC) can be precise and fast,
however only for a short duration of time.
The implementation across CPUs seems to vary. The original idea is to
increment the counter with every tick. Then dividing the delta of CPU ticks
by the CPU frequency can return the time that passed.
However, the CPU clock/frequency can change over time, resulting in uneven
incrementation of TSC. On some CPUs this is handled by extra logic.
As a result, obtaining time through this method might drift from the real
time.

This commit therefore substitues TSC time retrieval by the standard system
call wrapped in GetTime function - on Linux it is gettimeofday.

Ticket: 7116

(cherry picked from commit 35dffc6b32)
1 year ago
Juliana Fajardini f74fa898cf dns: allow triggering raw stream reassembly
For TCP streams, app proto stream reassembly can start earlier, instead
of waiting and queueing up data before doing so.

Task #7018
Related to
Bug #7004

(cherry picked from commit bb45ac71ef)
1 year ago
Victor Julien ff8d9ca1a1 smb/ntlmssp: improve version check
Don't assume the ntlmssp version field is always present if the flag is
set. Instead keep track of the offsets of the data of the various blobs
and see if there is space for the version.

Inspired by how Wireshark does the parsing.

Bug: #7121.
(cherry picked from commit f59c43b1c7)
1 year ago
Philippe Antoine c9dbc565d9 util/thash: decrease memuse if array was allocated
THashInitConfig may not allocate array and increase memuse.
Such a failure leads to THashShutdown which should not decrease
the memuse.

Ticket: 7135
(cherry picked from commit eeec609ac8)
1 year ago
Victor Julien 6824a4bc5f doc/userguide: document iprep isset/isnotset
(cherry picked from commit 8b42182fee)
1 year ago
Victor Julien b014b1e8e6 doc/userguide: add more operators to iprep
(cherry picked from commit 2f74d435d3)
1 year ago
Victor Julien d2ee5a1e9e detect/iprep: implement isset and isnotset
Implement special "isset" and "isnotset" modes.

"isset" matches if an IP address is part of an iprep category with any
value.

It is internally implemented as ">=,0", which should always be true if
there is a value to evaluate, as valid reputation values are 0-127.

"isnotset" matches if an IP address is not part of an iprep category.

Internally it is implemented outside the uint support.

Ticket: #6857.
(cherry picked from commit 83976a4cd4)
1 year ago
Victor Julien 524ee70cfa reputation: minor cleanup
No need to init ptrs to NULL after SCCalloc.

(cherry picked from commit 3e46c51651)
1 year ago
Victor Julien b4acd71b8b detect/iprep: update keyword parser for extendibility
(cherry picked from commit 539ab3a404)
1 year ago
Philippe Antoine f653a4ee3f bypass: really bypass udp flow from first packet
Ticket: 7053

As flow state would be overwritten by established...

(cherry picked from commit df5dcfef5f)
1 year ago
Philippe Antoine ea215902d5 filestore: do not try to store a file set to nostore
Ticket: 6390

This can happen with keyword filestore:both,flow
If one direction does not have a signature group with a filestore,
the file is set to nostore on opening, until a signature in
the other direction tries to set it to store.
Subsequent files will be stored in both directions as flow flags
are now set.

(cherry picked from commit 5f35035928)
1 year ago
Philippe Antoine 4f91c629f4 detect/snmp: do not bother to free a null pointer
Ticket: 7134
1 year ago
Victor Julien 27deff0790 github-actions: remove build for EOL centos:7 1 year ago
Victor Julien 104ec011c0 detect/noalert: point noalert/alert to new doc
(cherry picked from commit d02054fa31)
1 year ago
Victor Julien e04d8f3045 doc/userguide: add noalert/alert keyword docs
(cherry picked from commit 50ef646d45)
1 year ago