]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
2 years agodcerpc: store consumed_bytes as i32 8419/head
Philippe Antoine [Sat, 2 Apr 2022 19:16:53 +0000 (21:16 +0200)] 
dcerpc: store consumed_bytes as i32

As it can grow bigger than u16

(cherry picked from commit 704bc878ea3f2fcb911d38b6a21aa5a7ee4d2a79)

2 years agorust: fix for loop over option 8376/head
Jason Ish [Fri, 13 Jan 2023 20:04:52 +0000 (14:04 -0600)] 
rust: fix for loop over option

As of Rust 1.66 with strict mode enabled, a for loop over an option is
now an error. Replace the last occurrence of this pattern with an "if
let" statement.

2 years agotls: fix off by one in supported versions extension 8374/head
Philippe Antoine [Fri, 11 Nov 2022 10:52:27 +0000 (11:52 +0100)] 
tls: fix off by one in supported versions extension

Ticket: #5663
(cherry picked from commit b5147189aecd1d49520e6dc9b40b1baca5a4f503)

2 years agossl: add debug validation checks for recent changes
Victor Julien [Tue, 1 Nov 2022 15:48:13 +0000 (16:48 +0100)] 
ssl: add debug validation checks for recent changes

Make sure the assumptions are correct.

(cherry picked from commit 8f0d820218585ea450fd87b86e8754f03805cb38)

2 years agotls: fix buffer overread
Philippe Antoine [Wed, 5 Oct 2022 19:21:41 +0000 (21:21 +0200)] 
tls: fix buffer overread

Recently introduced by commit 4bab6e24e5e2cef29c9a5a6bee3263e4a3d47e76

Ticket: #5564
(cherry picked from commit 3fbcba8ab7c042fd6f802cdeae02cb0c67771c7a)

2 years agossl: fix compiler warning
Philippe Antoine [Tue, 27 Sep 2022 13:47:06 +0000 (15:47 +0200)] 
ssl: fix compiler warning

implicit conversion loses integer precision: 'int' to 'uint16_t'
because C shifts << translates automatically to signed integers

(cherry picked from commit ae6abd8ca3eb0e3157eb8709d97c9432beb9e373)

2 years agotls: handle incomplete header sooner
Victor Julien [Wed, 21 Sep 2022 17:56:45 +0000 (19:56 +0200)] 
tls: handle incomplete header sooner

Make sure to exit the parser early on incomplete header data.

Additionally, make sure to not create duplicated tls frames in this
case.

Add a debug validation check for the header parser parsing too much
data, which should never happen.

(cherry picked from commit 1701a6b14c0fef6a374368a31c8a0d753b574b9c)

2 years agossl: add debug validation check for incomplete api
Victor Julien [Wed, 7 Sep 2022 18:51:18 +0000 (20:51 +0200)] 
ssl: add debug validation check for incomplete api

(cherry picked from commit 9053c49178ac9746e9f36534c1ffce05dad205c8)

2 years agotls: improve record checks
Victor Julien [Wed, 7 Sep 2022 06:32:05 +0000 (08:32 +0200)] 
tls: improve record checks

Improve unknown record handling. Inspired by Wireshark 'unknown record'
handling, we take a best effort approach for records with unknown content
types in TLS versions 1.0, 1.1 and 1.2.

Improve record length check and set 'invalid_record_length' event instead
of 'invalid_tls_header'.

(cherry picked from commit 69be41b241bc7fd1a5b7f3988b51f5859ab27d57)

2 years agotls: improve versions extension logic
Victor Julien [Wed, 7 Sep 2022 05:31:38 +0000 (07:31 +0200)] 
tls: improve versions extension logic

Skip over unusable versions like GREASE.

(cherry picked from commit c028800ae151415ca524ede755f9b880a19771ab)

2 years agotls: make version and size checks stricter
Victor Julien [Tue, 6 Sep 2022 12:03:46 +0000 (14:03 +0200)] 
tls: make version and size checks stricter

This way bad records won't buffer lots of stream data.

(cherry picked from commit 599791fa33cf5a3be51d7cdd857350f53bb68fc2)

2 years agotls: store cert data in heap buffer
Victor Julien [Mon, 29 Aug 2022 07:25:26 +0000 (09:25 +0200)] 
tls: store cert data in heap buffer

Cert chain is a list of pointers into this buffer, so can't use a
stream slice approach.

(cherry picked from commit c73d8120261c2470e49c25f7249c2ad8599e8fa1)

2 years agotls: prepare for client cert parsing
Victor Julien [Tue, 23 Aug 2022 09:31:08 +0000 (11:31 +0200)] 
tls: prepare for client cert parsing

(cherry picked from commit 10f5e6cb66a3fd8faa735eeddd307ef3b3f2bba4)

2 years agotls: make cert handling more generic
Victor Julien [Tue, 23 Aug 2022 05:19:38 +0000 (07:19 +0200)] 
tls: make cert handling more generic

In preparation for client cert handling.

(cherry picked from commit 14b2e04b58dbebf274290b0cbe9e40571c8941ef)

2 years agotls: avoid tls.invalid_handshake_message FP
Victor Julien [Mon, 22 Aug 2022 08:49:34 +0000 (10:49 +0200)] 
tls: avoid tls.invalid_handshake_message FP

Don't set TLS_DECODER_EVENT_INVALID_HANDSHAKE_MESSAGE event on encrypted
handshake messages.

(cherry picked from commit cf4c201acbf6e9558e450a8dc76d12b48bf49b8d)

2 years agotls: don't set 2 events for a single exception
Victor Julien [Thu, 11 Aug 2022 10:18:28 +0000 (12:18 +0200)] 
tls: don't set 2 events for a single exception

Keep the more specific ones.

(cherry picked from commit e9d63f335542b45123796f42801de730a63e6432)

2 years agotls: remove incomplete tests
Victor Julien [Thu, 11 Aug 2022 13:25:11 +0000 (15:25 +0200)] 
tls: remove incomplete tests

These tests are incompatible with the incomplete API usage and should
have been pcap based tests in the first place.

(cherry picked from commit 214e466b29b941e8805ac1531089607f9dae06b5)

2 years agotls: set event if record size exceeds limit
Victor Julien [Mon, 8 Aug 2022 10:02:22 +0000 (12:02 +0200)] 
tls: set event if record size exceeds limit

(cherry picked from commit 82e03bd8fc721cf47964460f261500b10433ea14)

2 years agotls: support server hello done message
Victor Julien [Wed, 10 Aug 2022 15:44:44 +0000 (17:44 +0200)] 
tls: support server hello done message

(cherry picked from commit e857c864ca1cb0af6a01f2b14c172bf83c78f0d3)

2 years agotls: support handshake fragmentation
Victor Julien [Fri, 5 Aug 2022 20:27:22 +0000 (22:27 +0200)] 
tls: support handshake fragmentation

Implement TLS record defrag for handshake messages.

Ticket: #5183.
(cherry picked from commit 4bab6e24e5e2cef29c9a5a6bee3263e4a3d47e76)

2 years agotls: remove certificate buffering code
Victor Julien [Fri, 5 Aug 2022 12:39:57 +0000 (14:39 +0200)] 
tls: remove certificate buffering code

TCP Buffering is now done in the app-layer using the incomplete API, on
the SSL/TLS record level. TLS level fragmentation will be implemented
separately.

(cherry picked from commit bcaf0f6f7db83aa5941346b0eaf81fa5765e0576)

2 years agotls: parse handshake protocol records in single pass
Victor Julien [Mon, 8 Aug 2022 10:23:37 +0000 (12:23 +0200)] 
tls: parse handshake protocol records in single pass

(cherry picked from commit 0839317ea7ebfcd28e7cac2ef516696ba42693c9)

2 years agosslv2: use version from client hello
Victor Julien [Wed, 7 Sep 2022 05:37:46 +0000 (07:37 +0200)] 
sslv2: use version from client hello

Remove streaming code that is now unused.

Incomplete handling makes this record parsing work on full data.

(cherry picked from commit 9f0ea5e70c3e557d25118e59aa5fc1b32aeca976)

2 years agossl: implement 'incomplete' handling for SSLv2
Victor Julien [Thu, 18 Aug 2022 08:51:35 +0000 (10:51 +0200)] 
ssl: implement 'incomplete' handling for SSLv2

(cherry picked from commit c8d79fb81fef91fef27d28ad06ee4136e8e282b6)

2 years agotls: streaming mode for application records
Victor Julien [Wed, 7 Sep 2022 07:43:19 +0000 (09:43 +0200)] 
tls: streaming mode for application records

To avoid overhead of stream buffering for records we don't do
much with anyway, pass through application records instead of
buffering the entire record in the stream engine.

(cherry picked from commit 6076a5151127f039932cb99d771259c18762c59a)

2 years agotls: use incomplete API to get full TLS records
Victor Julien [Fri, 5 Aug 2022 10:03:37 +0000 (12:03 +0200)] 
tls: use incomplete API to get full TLS records

The TLS record header is parsed in streaming mode still, but once the
record size is known we tell the app-layer API to give us the full
record.

Ticket: #5481

(cherry picked from commit 129fcb5c7232fd9c8245958f7fb7d2d9ebe9d8ce)

2 years agodetect/tls: Improve tls.fingerprint rule handling
Jeff Lucovsky [Sun, 11 Sep 2022 14:00:53 +0000 (10:00 -0400)] 
detect/tls: Improve tls.fingerprint rule handling

Issue: 4581

This commit improves the runtime performance of rules with
tls.fingerprint by using the inspection logic from tls.cert_fingerprint.

(cherry picked from commit 63745a78790936c80f7042b1dfcb3e869e0acaea)

2 years agodetect/uri: Remove unnecessary include
Jeff Lucovsky [Sun, 11 Sep 2022 13:50:20 +0000 (09:50 -0400)] 
detect/uri: Remove unnecessary include

This commit removes an unnecessary #include for detect-uricontent.h

(cherry picked from commit 6bccd5aa30c03debc92c1e910d5f0dd1c6a9cc58)

2 years agodetect/pcre: don't use JIT if disabled 8296/head
Victor Julien [Fri, 16 Dec 2022 14:51:05 +0000 (15:51 +0100)] 
detect/pcre: don't use JIT if disabled

If we determined not to use JIT at start up, really don't use
JIT.

Bug: #5762.

2 years agoebpf: update deprecated API calls 8289/head
Sascha Steinbiss [Thu, 15 Sep 2022 13:57:13 +0000 (13:57 +0000)] 
ebpf: update deprecated API calls

This fixes build errors when libbpf 1.0 is used. It removes previously
deprecated API functions that were still in use in Suricata's eBPF
code.

2 years agonfs4: fix write record handling
Philippe Antoine [Fri, 17 Jun 2022 09:32:17 +0000 (11:32 +0200)] 
nfs4: fix write record handling

Ticket: #5280
(cherry picked from commit 95f042442304ba8498c6409968f24b7b3c53ffc2)

2 years agoradix: fix ipv6 address parsing warning 8268/head
Victor Julien [Thu, 8 Dec 2022 19:14:43 +0000 (20:14 +0100)] 
radix: fix ipv6 address parsing warning

The check meant to see if the ip address part of the ip/cidr combo
was more specific than needed wasn't fully implemented, leading to
warnings being issued on completely valid and correct input.

This patch implements the same logic as in IPv4. If the ip address
as specified is different from the ip after the mask has been applied,
a warning is displayed.

Bug: #5747.
(cherry picked from commit 991f9fde3292d45eefcfe9e01ef8480e5864977b)

2 years agomime: do not skip empty lines for quoted-printable 8238/head
Philippe Antoine [Fri, 2 Dec 2022 13:43:10 +0000 (14:43 +0100)] 
mime: do not skip empty lines for quoted-printable

As these lines are in the file...

Ticket: #5725
(cherry picked from commit 0e054af1acda120a011d5d8136bc9a15cdac2f51)

2 years agomime/base64: unify space handling
Victor Julien [Sat, 3 Dec 2022 06:37:43 +0000 (07:37 +0100)] 
mime/base64: unify space handling

(cherry picked from commit 7bfb63210e3a128c999343a4805b1d972ae64b73)

2 years agoeve: add common options to loggers missing it
Philippe Antoine [Fri, 4 Nov 2022 08:52:07 +0000 (09:52 +0100)] 
eve: add common options to loggers missing it

So that we get community id for RFB for instance

Ticket: #5723

2 years agosmb: fix file reopening issue
Victor Julien [Wed, 30 Nov 2022 05:44:40 +0000 (06:44 +0100)] 
smb: fix file reopening issue

Fuzzing highlighted an issue where a command sequence on the same file
id triggered a logging issue:

file data for id N
close id N
file data for id N

If this happened in a single blob of data passed to the parser, the
existing file tx would be reused, the file "reopened", confusing the
file logging logic. This would trigger a debug assert.

This patch makes sure a new file tx is created for the file data
coming in after the first file tx is closed.

Bug: #5567.
(cherry picked from commit 45eb038e63604766de2828f6f25d145fea040424)

2 years agochangelog: minor formatting fixup
Victor Julien [Tue, 29 Nov 2022 09:22:36 +0000 (10:22 +0100)] 
changelog: minor formatting fixup

2 years agoversion: require libhtp 0.5.42
Victor Julien [Tue, 29 Nov 2022 09:22:02 +0000 (10:22 +0100)] 
version: require libhtp 0.5.42

2 years agoversion: start development towards 6.0.10
Victor Julien [Tue, 29 Nov 2022 09:21:24 +0000 (10:21 +0100)] 
version: start development towards 6.0.10

2 years agorelease: 6.0.9; update changelog suricata-6.0.9
Victor Julien [Mon, 28 Nov 2022 06:17:53 +0000 (07:17 +0100)] 
release: 6.0.9; update changelog

2 years agoflow: cleanup and clarify ancient debug messages
Victor Julien [Thu, 20 Oct 2022 13:24:52 +0000 (15:24 +0200)] 
flow: cleanup and clarify ancient debug messages

2 years agodecode: enforce layer limit through tunnel layers
Victor Julien [Thu, 20 Oct 2022 13:14:26 +0000 (15:14 +0200)] 
decode: enforce layer limit through tunnel layers

Bug: #5686.
Bug: #5688.

2 years agodcerpc: fix integer underflow
Philippe Antoine [Fri, 23 Sep 2022 09:01:03 +0000 (11:01 +0200)] 
dcerpc: fix integer underflow

as input.len() can be 65536, it cannot be directly cast to u16

Ticket: #5557
Ticket: #5602

2 years agoutil/base64: fix heap buffer overflow
Shivani Bhardwaj [Mon, 31 Oct 2022 11:04:47 +0000 (16:34 +0530)] 
util/base64: fix heap buffer overflow

While updating the destination pointer, we were also adding the padded
bytes which are not a part of the decoded bytes. This led to running out
of space on the destination buffer.
Fix it by only incrementing destination buffer ptr by the number of
actual bytes that were decoded.

Ticket 5623
Ticket 5694

2 years agorequirements: suricata-update 1.2.6 8215/head
Jason Ish [Fri, 25 Nov 2022 17:56:27 +0000 (11:56 -0600)] 
requirements: suricata-update 1.2.6

2 years agoutil/base64: use padding var for calculations 8214/head
Shivani Bhardwaj [Mon, 31 Oct 2022 13:23:06 +0000 (18:53 +0530)] 
util/base64: use padding var for calculations

(cherry picked from commit 58e5033a44efcb163619dc95c67021e42a2c1e66)

2 years agodoc: update base64_decode notes
Shivani Bhardwaj [Mon, 10 Oct 2022 11:11:09 +0000 (16:41 +0530)] 
doc: update base64_decode notes

(cherry picked from commit 2a0cb1f3daa2c58021b10ff88f2e6519a2c91d8a)

2 years agobase64: add and clean tests
Shivani Bhardwaj [Fri, 7 Oct 2022 06:31:45 +0000 (12:01 +0530)] 
base64: add and clean tests

(cherry picked from commit 7005443b8bbe521399a98dbafb7ea07e7db952bb)

2 years agobase64: add new mode as per RFC 4648
Shivani Bhardwaj [Wed, 5 Oct 2022 11:10:07 +0000 (16:40 +0530)] 
base64: add new mode as per RFC 4648

As per RFC 4648,
Implementations MUST reject the encoded data if it contains characters
outside the base alphabet when interpreting base-encoded data, unless
the specification referring to this document explicitly states
otherwise.

Add a new mode BASE64_MODE_RFC4648, and handle input strictly as per the
specification.

Bug 5223

(cherry picked from commit dad52f133d871690b29e1415b40827cac4fa418c)

2 years agococci: remove action check as we no longer use macros 8212/head
Victor Julien [Sat, 15 Oct 2022 08:35:39 +0000 (10:35 +0200)] 
cocci: remove action check as we no longer use macros

(cherry picked from commit 34ee53e5ec1cdefe574bdfee55ef674217997ea9)

2 years agococci: fix python issues
Victor Julien [Wed, 21 Sep 2022 08:17:38 +0000 (10:17 +0200)] 
cocci: fix python issues

(cherry picked from commit 353eb9086daad9b8e00eca8fe4cc420ab79496bd)

2 years agosmb: do not use tree id to match request and response
Philippe Antoine [Tue, 22 Nov 2022 20:47:37 +0000 (21:47 +0100)] 
smb: do not use tree id to match request and response

Completes commit e94920b49f43bea4220a1bdf32297ec004e58059

This must be true for access to state ssn2vecoffset_map

Ticket: #5161

2 years agosmb: do not use tree id to match create request and response
Philippe Antoine [Thu, 2 Sep 2021 09:40:45 +0000 (11:40 +0200)] 
smb: do not use tree id to match create request and response

As an SMB2 async response does not have a tree id, even if
the request has it.

Per spec, MessageId should be enough to identifiy a message request
and response uniquely across all messages that are sent on the same
SMB2 Protocol transport connection.
So, the tree id is redundant anyways.

Ticket: #5508
(cherry picked from commit e94920b49f43bea4220a1bdf32297ec004e58059)

2 years agosmtp/files: don't modify prev file on open failure
Victor Julien [Wed, 23 Nov 2022 13:42:21 +0000 (14:42 +0100)] 
smtp/files: don't modify prev file on open failure

(cherry picked from commit 9f4dd4fc56a8885bdff0714352dffa5b897f5979)

2 years agofiles: always initialize inspect_window and min_inspect_depth
Victor Julien [Wed, 23 Nov 2022 13:29:39 +0000 (14:29 +0100)] 
files: always initialize inspect_window and min_inspect_depth

This is to make sure the files buffers are properly managed even
when there are no rules or when there are no file.data rules.

Bug: #5703.
(cherry picked from commit e601ebdfd8efa9a36e5d0d9a1539945c6498bd7c)

2 years agorust/files: open file without trackid as pointer
Victor Julien [Wed, 23 Nov 2022 10:56:33 +0000 (11:56 +0100)] 
rust/files: open file without trackid as pointer

(cherry picked from commit cade6046c54e38715d73aad0ea21d780a81e626d)

2 years agorust/filecontainer: remove unused declaration
Victor Julien [Wed, 23 Nov 2022 10:55:42 +0000 (11:55 +0100)] 
rust/filecontainer: remove unused declaration

(cherry picked from commit ad869e1c52c31899593dc14a7a3c8ceee7a61b98)

2 years agostreaming/buffer: set hard limit on buffer size
Victor Julien [Thu, 24 Nov 2022 11:01:13 +0000 (12:01 +0100)] 
streaming/buffer: set hard limit on buffer size

Don't allow the buffer to grow beyond 1GiB. Add a once per thread
warning if it does reach it.

Bug: #5703.
(cherry picked from commit df7d8d96c95a79425d8ce75dc95da32a177a700a)

2 years agodetect: fixes to action handling; fix PASS
Victor Julien [Thu, 24 Nov 2022 20:35:30 +0000 (21:35 +0100)] 
detect: fixes to action handling; fix PASS

Fix PASS handling by setting and checking in the correct packet.

There are 3 types of packets:
1. tunnel packets (inner layer of encapsulation)
2. "root" packets (outmost layer of encapsulated packet)
3. normal packets (no encapsulation)

Tunnel packet have a pointer to their "root". The "root" is the packet
that is ultimately used by the capture method to issue a verdict:
DROP or ACCEPT (forward).

For tunnels:
DROP actions are always issued on the root packet.
The PASS action is issued on the packet currently in the detection
engine.

Non-tunnels:
DROP and PASS are both set in the current packet.

Bug: #5697.

2 years agofuzz: fixes a leak in applayerparse target
Philippe Antoine [Mon, 20 Sep 2021 18:45:10 +0000 (20:45 +0200)] 
fuzz: fixes a leak in applayerparse target

If a protocol change was requested, the target did not handle
it as Suricata, as the target is meant to handle only one
app-layer protocol.

(cherry picked from commit ca054f726464fcc55242b7c851d75557c96b3d83)

2 years agohttp2: fix decompression buffering
Philippe Antoine [Mon, 21 Nov 2022 16:06:44 +0000 (17:06 +0100)] 
http2: fix decompression buffering

It was not enough to set Cursor position to 0,
also its inner Vec should be cleared.

This way, a new input gets written at the beginning of the
Cursor and its inner Vec...

Ticket: #5691
(cherry picked from commit 086b28da3d06b269ba23ff0fa3c99419ce2f4d6a)

2 years agohttp2: support padded data frames
Philippe Antoine [Mon, 21 Nov 2022 15:21:19 +0000 (16:21 +0100)] 
http2: support padded data frames

Ticket: #5691
(cherry picked from commit c6349d3cfcab47224b49293688ca18242ccbdb21)

2 years agoafpacket/netmap: warn about mixed ips, ids/tap deprecation
Jason Ish [Wed, 19 Oct 2022 19:07:56 +0000 (13:07 -0600)] 
afpacket/netmap: warn about mixed ips, ids/tap deprecation

Suricata already logs if AF_PACKET or Netmap are running in a mixed IPS
and IDS/TAP mode.  As the behavior is undefined when these modes are
mixed, it is best to deprecate and to not allow this behavior. For now
warn that it will be unsupported and fail in Suricata 8.

Ticket: 5587
(cherry picked from commit 0c00f28ebcf168e4712f23d49c27508c27f6e774)

2 years agoreadthedocs: enable all formats 8200/head
Jason Ish [Tue, 8 Nov 2022 10:50:55 +0000 (12:50 +0200)] 
readthedocs: enable all formats

Ticket: #5654

2 years agomime: handles multiple sections for a parameter 8180/head
Philippe Antoine [Fri, 4 Jun 2021 13:06:10 +0000 (15:06 +0200)] 
mime: handles multiple sections for a parameter

Ticket: 4386

as per RFC2231.
For instance filename can be split between filename*0,
filename*1, etc...

(cherry picked from commit 784558df2e27455e0baf79d92253d21887ba3f49)

2 years agomime: move FindMimeHeaderTokenRestrict to rust
Philippe Antoine [Fri, 4 Jun 2021 13:05:14 +0000 (15:05 +0200)] 
mime: move FindMimeHeaderTokenRestrict to rust

Also fixes the case where the token name is present
in a value

(cherry picked from commit 8feb9c35ae24045d80cc4499923d66da589d35cb)

2 years agonetmap: allow specifying a library directory
Jeff Lucovsky [Sat, 11 Dec 2021 13:45:57 +0000 (08:45 -0500)] 
netmap: allow specifying a library directory

Ticket: #4482
(cherry picked from commit 142a57997199a8d7cd90085dd1c2c09a949aa948)

2 years agoconfig/netmap: Permit selection of new/legacy APIs
Jeff Lucovsky [Tue, 7 Dec 2021 14:40:58 +0000 (09:40 -0500)] 
config/netmap: Permit selection of new/legacy APIs

2 years agonetmap: V14 API changes
Jeff Lucovsky [Fri, 20 Aug 2021 13:10:26 +0000 (09:10 -0400)] 
netmap: V14 API changes

This commit modifies the Netmap packet handling to use API version 14.

@bmeeks8 contributed many changes instrumental to this effort.

(cherry picked from commit ca7d097225c2eeb21df28dd17658d74af4999e95)

2 years agoutil: Add sys/ioctl.h to common include
Jeff Lucovsky [Mon, 23 Aug 2021 12:46:10 +0000 (08:46 -0400)] 
util: Add sys/ioctl.h to common include

This commit adds another system include file based on autoconf to the
common Suricata include file for convenience.

(cherry picked from commit 3496e543af98dac2a673974a569d685ee321031a)

2 years agoversion: development is towards 6.0.9
Victor Julien [Thu, 17 Nov 2022 14:45:45 +0000 (15:45 +0100)] 
version: development is towards 6.0.9

2 years agodetect: apply drops to tunnel root 8177/head
Victor Julien [Wed, 16 Nov 2022 09:44:13 +0000 (10:44 +0100)] 
detect: apply drops to tunnel root

`PacketDrop` applied a DROP to the current packet unconditionally,
while in tunnel/encapsulated cases the DROP should have been applied
to the root packet.

Fixes: 6742ecbc9e87 ("decode: make PacketDrop use action as parameter")
Bug: #5600.

2 years agothreshold: fix regex to accept by_both and by_rule
Philippe Antoine [Thu, 28 Apr 2022 14:24:46 +0000 (16:24 +0200)] 
threshold: fix regex to accept by_both and by_rule

As is done in detect-threshold.c or in DETECT_RATE_REGEX
and is expected by switch (rule_type) which makes the same
for THRESHOLD_TYPE_THRESHOLD and THRESHOLD_TYPE_RATE

Ticket: #5327
(cherry picked from commit a2f857ed900fcefdb775203825a262f4f1ed3343)

2 years agodocs: replace Openhub reference 8166/head
Lukas Sismis [Tue, 11 Oct 2022 05:44:25 +0000 (07:44 +0200)] 
docs: replace Openhub reference

2 years agotransversal: backport: replace remaining website references
Lukas Sismis [Tue, 11 Oct 2022 05:36:17 +0000 (07:36 +0200)] 
transversal: backport: replace remaining website references

2 years agotransversal: remove suricata-ids.org references
Lukas Sismis [Mon, 10 Oct 2022 20:00:37 +0000 (22:00 +0200)] 
transversal: remove suricata-ids.org references

(cherry picked from commit e101384e7b5ca919c79f80e108c3e6a90b96960b)

2 years agoflow: fix FlowSwapFileFlags function
Eric Leblond [Sun, 30 Oct 2022 12:08:06 +0000 (13:08 +0100)] 
flow: fix FlowSwapFileFlags function

Ticket: #5625
(cherry picked from commit 4e1ff9a7ff96554e82d159243e6c1eaf68b502d1)

2 years agodetect/tag: improve time handling on windows
Victor Julien [Tue, 18 Oct 2022 12:08:02 +0000 (14:08 +0200)] 
detect/tag: improve time handling on windows

Bug: #5584.
(cherry picked from commit 0977f40d1cf6d5dad75c95f31614678225a77943)

2 years agoeve: log mac addresses in packet direction 8047/head
Victor Julien [Wed, 19 Oct 2022 12:26:53 +0000 (12:26 +0000)] 
eve: log mac addresses in packet direction

(cherry picked from commit 90f3823cadf76378f292c03b389986e12acf1aad)

2 years agorelease: 6.0.8; update changelog suricata-6.0.8
Victor Julien [Tue, 27 Sep 2022 17:25:37 +0000 (19:25 +0200)] 
release: 6.0.8; update changelog

Re-releasing 6.0.7 with the correct libhtp and Suricata-Update versions.

2 years agorelease: 6.0.7; update changelog suricata-6.0.7
Shivani Bhardwaj [Tue, 27 Sep 2022 10:47:01 +0000 (16:17 +0530)] 
release: 6.0.7; update changelog

2 years agostream: fix reachable assertion 7936/head
Victor Julien [Mon, 26 Sep 2022 15:14:39 +0000 (17:14 +0200)] 
stream: fix reachable assertion

Fix `Flow::thread_id` not always getting properly set up, leading to
a reachable assertion.

Bug #4582.

(cherry picked from commit b06c0579f568226721f38f6a964bdffdfd1791fc)

2 years agouserguide: add section about exception policies
Juliana Fajardini [Thu, 15 Sep 2022 23:07:54 +0000 (20:07 -0300)] 
userguide: add section about exception policies

This describes briefly what the exception policies are, what is the
engine's behavior, what options are available and to which parts are
they implemented.

Task #5475
Task #5515

2 years agouserguide: minor rewording and typo fixes
Juliana Fajardini [Fri, 2 Sep 2022 17:27:15 +0000 (14:27 -0300)] 
userguide: minor rewording and typo fixes

Some of these were recently introduced, some were highlited after the
applayer sections got merged. Some paragraphs seem to have been changed
due to trying to respect character limits for lines. Also includes a
typo pointed out by one of our community members via Discord.

2 years agostream/tcp: typo fix
Juliana Fajardini [Fri, 16 Sep 2022 18:12:06 +0000 (15:12 -0300)] 
stream/tcp: typo fix

2 years agosource: pcap timestamp microsecond consistency
Philippe Antoine [Fri, 1 Apr 2022 15:55:33 +0000 (17:55 +0200)] 
source: pcap timestamp microsecond consistency

That is it should be less than 1 000 000.
Have the same for fuzz targets where the bug came from.

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44177
(cherry picked from commit 8ecf7e403ec493118afaa0543166e0c11d907417)

2 years agoflow/icmpv4: fix vlan.use-for-tracking
Philippe Antoine [Thu, 5 May 2022 07:46:01 +0000 (09:46 +0200)] 
flow/icmpv4: fix vlan.use-for-tracking

For ICMPv4 error messages the vlan ids were always considered,
even if the 'vlan.use-for-tracking' option was disabled.

Ticket: #5330
(cherry picked from commit ce2775d331cecc072c99e1c0c3bced954de4900d)

2 years agorequirements: use suricata-update 1.2.5
Jason Ish [Thu, 22 Sep 2022 23:08:09 +0000 (17:08 -0600)] 
requirements: use suricata-update 1.2.5

2 years agodetect: fix user after free in debug log
Jason Ish [Mon, 19 Sep 2022 16:40:14 +0000 (10:40 -0600)] 
detect: fix user after free in debug log

Found by gcc 12.2.1.

2 years agomqtt: remove quadratic time complexity
Philippe Antoine [Thu, 16 Jun 2022 13:14:27 +0000 (15:14 +0200)] 
mqtt: remove quadratic time complexity

When having many transactions in a single parsing call...

Fix has overhead of having one more field in the mqtt state.

Completes commit a8079dc9787d77cf705aa47000b499a325be0716

Ticket: #5399
(cherry picked from commit e160917bcfb67b23535b4ce082f506a9e66b7778)

2 years agomqtt: convert transaction list to vecdeque
Jeff Lucovsky [Tue, 16 Aug 2022 12:59:46 +0000 (08:59 -0400)] 
mqtt: convert transaction list to vecdeque

Ticket: 5430

2 years agomqtt: make max transactions configurable
Philippe Antoine [Wed, 12 Jan 2022 20:58:47 +0000 (21:58 +0100)] 
mqtt: make max transactions configurable

Allows users to find balance between completeness of decoding
and increases resource consumption, which can DOS suricata.

(cherry picked from commit e42094f238aa388d05970993fd0de8194471fa60)

2 years agomqtt: limits the number of active transactions per flow
Philippe Antoine [Thu, 2 Dec 2021 09:03:05 +0000 (10:03 +0100)] 
mqtt: limits the number of active transactions per flow

Ticket: 4530

So, that we do not get DOS by quadratic complexity, while
looking for a new pkt_id over the ever growing list
of active transactions

(cherry picked from commit a8079dc9787d77cf705aa47000b499a325be0716)

2 years agodetect/flowbits: more permissive parsing by default
Victor Julien [Fri, 23 Sep 2022 15:13:55 +0000 (17:13 +0200)] 
detect/flowbits: more permissive parsing by default

To get strict parsing, `--strict-rule-keywords=flowbits` command line
option can be used.

Bug: #5547.

2 years agocontent: don't error out on incomplete hex 7887/head
Jason Ish [Mon, 19 Sep 2022 21:12:46 +0000 (15:12 -0600)] 
content: don't error out on incomplete hex

Before 6.0.6 if hex content was incomplete, Suricata didn't error out.
With 6.0.6 incomplete hex was detected and errored on which is a
breaking change in a release branch.  Instead, only emit a warning
unless strict content checking has been requested.

To enable strict behaviour on incomplete content hex in a rule,
"--strict-rule-keywords=content" can be used on the command line.

Issue: #5546

2 years agodetect: allow rule errors to display error, but not be fatal
Jason Ish [Tue, 20 Sep 2022 17:48:59 +0000 (11:48 -0600)] 
detect: allow rule errors to display error, but not be fatal

Add a new setup return code, -4 which will print the error, but not
error out in test mode. This is to support allowing incomplete hex, as
there is no context as to which rule had the issue.

For context:
- -3: error ok, no message
- -2: error not ok, no message
- -4: error ok, message

2 years agodetect: fix duplicate detect state issue 7878/head
Victor Julien [Sat, 27 Aug 2022 05:50:45 +0000 (07:50 +0200)] 
detect: fix duplicate detect state issue

For protocols with multi buffer inspection there could be multiple times
the same sid would be queued into the candidates queue. This triggered
a debug validation check.

W/o debug validation this would lead to duplicate work and possibly multiple
alerts where a single one would be appropriate.

Bug: 5419.
(cherry picked from commit 1bff888947345505c773ab07337546aa72e95d16)

2 years agodetect: transforms check for 0-sized buffer
Philippe Antoine [Thu, 25 Aug 2022 15:05:41 +0000 (17:05 +0200)] 
detect: transforms check for 0-sized buffer

So as to avoid undefined behavior with a 0-sized variable length
array

Ticket: #5521
(cherry picked from commit 61b73416e27a07cab50743d69c1cf5cd7f07b45d)

2 years agoexceptions: add reject support to exception policy 7852/head
Juliana Fajardini [Tue, 6 Sep 2022 19:16:45 +0000 (16:16 -0300)] 
exceptions: add reject support to exception policy

This enables the usage of 'reject' as an exception policy. As for both
IPS and IDS modes the intended result of sending a reject packet is to
reject the related flow, this will effectively mean setting the reject
action to the packet that triggered the exception condition, and then
dropping the associated flow.

Task #5503

(cherry picked from commit bbd968c738230b4f77de3278994c4fd5aa859dcd)

2 years agostream/ids: make sure we don't slide past last_ack 7849/head
Victor Julien [Tue, 16 Aug 2022 09:35:01 +0000 (11:35 +0200)] 
stream/ids: make sure we don't slide past last_ack

Bug: #5401.
(cherry picked from commit f04b7a1827845d72b4d0c12f76eadfcc77d726cf)