]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
2 years agostream: set event on bad timestamp on syn_sent state 8531/head 8634/head
Victor Julien [Thu, 9 Feb 2023 08:36:56 +0000 (09:36 +0100)] 
stream: set event on bad timestamp on syn_sent state

(cherry picked from commit fc376f81455ebfd487a0de2f8a14884be073b8ac)

2 years agostream/tcp: allow tcp session reuse on null sessions 8525/head
Victor Julien [Thu, 2 Feb 2023 13:45:30 +0000 (14:45 +0100)] 
stream/tcp: allow tcp session reuse on null sessions

When a "stream starter" packet finds an existing TCP flow, the flow will be
evaluated for reuse.

The following scenario wasn't handled well:

1. Suricata starts after a tool has just stopped using lots of connections
   (e.g. ab stress testing a webserver)
2. even though the client is closed already, the server is still doing
   connection cleanup sending many FINs and later RSTs
3. Suricata creates flows for these packets, but no TCP sessions
4. client resumes testing, creating flows that have the same 5 tuple as the
   flows created for the FIN/RST packets
5. Suricata refuses to "reuse" the flows as the condition "tcp flow w/o session"
   is not considered valid for session reuse
6. new TCP connection is not properly tracked and evaluated in parsing and
   detection

There may be other vectors into this, like a flow w/o session because of
memcap issues.

Bug: #5843.
(cherry picked from commit 93c9594dd8158a9d8fa76fdbc7c02e82da2b0ed2)

2 years agoflowworker: don't keep unnecessary flow reference
Victor Julien [Fri, 27 Jan 2023 19:30:20 +0000 (20:30 +0100)] 
flowworker: don't keep unnecessary flow reference

Flow stream/detect/log flush packets, don't hold on to the flow
beyond the flow worker module.

(cherry picked from commit a2dc9a40e76ded08e084f1c11eff2140380e73ec)

2 years agoversion: start development towards 6.0.11
Victor Julien [Tue, 31 Jan 2023 18:43:17 +0000 (19:43 +0100)] 
version: start development towards 6.0.11

2 years agorelease: 6.0.10; update changelog suricata-6.0.10
Shivani Bhardwaj [Tue, 31 Jan 2023 06:18:36 +0000 (11:48 +0530)] 
release: 6.0.10; update changelog

2 years agorequirements: suricata-update 1.2.7 8500/head
Jason Ish [Mon, 30 Jan 2023 18:02:47 +0000 (12:02 -0600)] 
requirements: suricata-update 1.2.7

2 years agothreshold: suppress debug notice message 8499/head
Victor Julien [Mon, 30 Jan 2023 15:08:24 +0000 (16:08 +0100)] 
threshold: suppress debug notice message

2 years agodecode/events: add strict mode for udp.hlen_invalid; remove rule
Victor Julien [Mon, 30 Jan 2023 12:55:52 +0000 (13:55 +0100)] 
decode/events: add strict mode for udp.hlen_invalid; remove rule

2 years agorules/decoder: add udp.len_invalid rule
Shivani Bhardwaj [Wed, 18 Jan 2023 01:35:08 +0000 (07:05 +0530)] 
rules/decoder: add udp.len_invalid rule

(cherry picked from commit b5b05b8fce68ac18e7ea6330508afc3ad0c35866)

2 years agodecode/udp: fix payload_len calculation
Shivani Bhardwaj [Wed, 4 Jan 2023 06:30:13 +0000 (12:00 +0530)] 
decode/udp: fix payload_len calculation

Fix payload_len calculation post removal of the condition that returned
error code if the length to the decode fn did not match the length of
header from the UDP packet.

Bug 5379

(cherry picked from commit f941ceae2be883596a3571ec9046ea884d3f3f85)

2 years agodecode/events: add event type UDP_LEN_INVALID
Shivani Bhardwaj [Wed, 18 Jan 2023 00:53:13 +0000 (06:23 +0530)] 
decode/events: add event type UDP_LEN_INVALID

(cherry picked from commit eebdfe9a3e46be0508ff636db0fc514a4f922656)

2 years agodecode-udp: Allow shorter UDP packets than the remaining payload length
Lukas Sismis [Fri, 27 Jan 2023 11:34:37 +0000 (12:34 +0100)] 
decode-udp: Allow shorter UDP packets than the remaining payload length

If the packet is shorter than IP payload length we no longer flag it as an
invalid UDP packet. UDP packet can be therefore shorter than IP payload.
Keyword "udp.hlen_invalid" became outdated as we no longer flag short UDP
packets as invalid. The keyword's evaluation remains the same.

Inspired by commit: d18e52ed93e996bc0335d4a100b2ac7f12b3848d

Redmine ticket: #5793

2 years agofuzz: checks pcap timestamp consistency
Philippe Antoine [Mon, 30 Jan 2023 09:49:29 +0000 (10:49 +0100)] 
fuzz: checks pcap timestamp consistency

Inspired by commit e22b59b8c17c2fb8ae30b2612086a7975cd94a6c

Master7 is now diverging with use of SCTime_t

2 years agoapp-layer: explicitly enable sip, rdp and mqtt
Victor Julien [Mon, 30 Jan 2023 12:42:31 +0000 (13:42 +0100)] 
app-layer: explicitly enable sip, rdp and mqtt

In the default config these were enabled implicitly, as their `enabled`
field was commented out. This lead to warnings in the default config.

Ticket: #5299.

2 years agodetect: config keyword transaction logic fix 8458/head
Philippe Antoine [Mon, 25 Jul 2022 08:33:42 +0000 (10:33 +0200)] 
detect: config keyword transaction logic fix

When the keyword config:logging disable,type tx is used,
OutputTxLog checks a flag to skip the transaction without logging
it, but AppLayerParserTransactionsCleanup waits for the
transaction to be marked as logged to clean it.

So, OutputTxLog now marks the tx as logged, so that it can
get cleaned away.

Ticket: #5456
(cherry picked from commit 0c0fcc94111b183ae2953f659d14ab2f671fc019)

2 years agosmb: set defaults for file transfer limits
Victor Julien [Tue, 24 Jan 2023 11:38:21 +0000 (12:38 +0100)] 
smb: set defaults for file transfer limits

Ticket: #5782.
(cherry picked from commit 37f13a4fc7356432cfec80852eb1f58da7cc8850)

2 years agostream/tcp: fix typos, update copyright year 8454/head
Juliana Fajardini [Thu, 19 Jan 2023 14:21:10 +0000 (11:21 -0300)] 
stream/tcp: fix typos, update copyright year

Bug #5765

2 years agoexceptions: ignore policy if stream.midstream=true
Juliana Fajardini [Thu, 19 Jan 2023 14:18:16 +0000 (11:18 -0300)] 
exceptions: ignore policy if stream.midstream=true

Set the engine to ignore the stream.midstream-policy if stream.midstream
is enabled.

If we had both stream.midstream AND stream.midstream_policy enabled,
this could lead to midstream flows being dropped (or bypassed, or...)
instead of being accepted by the engine, as it was probably meant when
the user enabled midstream flows.

Bug #5765

(cherry picked from commit 8e9905e0d833858a5053285c8ffe6ed4ed30fc12)

2 years agonfs2: improve READ parsing
Philippe Antoine [Wed, 25 Jan 2023 15:20:00 +0000 (16:20 +0100)] 
nfs2: improve READ parsing

Inspired by commit ddf14e51dcf5dabdb4bc07414a118530e2a1b819

But keeping old nom version

2 years agofuzz: specify protocol with fuzz target name
Philippe Antoine [Mon, 29 Mar 2021 18:27:34 +0000 (20:27 +0200)] 
fuzz: specify protocol with fuzz target name

cf https://redmine.openinfosecfoundation.org/issues/4125

This allows fuzz_applayerparser_parse to fuzz one specific
app-layer protocol based on the binary name, as is done
with the environment variable FUZZ_APPLAYER
That is if we rename/copy to fuzz_applayerparser_parse_smb,
it will fuzz only SMB protocol
This way, we can easily produce different fuzz targets for
each protocol in oss-fuzz

(cherry picked from commit e9b76a0e663ce5c2f8900f90a4f4fd7ed3436335)

2 years agonetmap: Fixup issues with v14+ backport
Jeff Lucovsky [Fri, 20 Jan 2023 14:16:05 +0000 (09:16 -0500)] 
netmap: Fixup issues with v14+ backport

This commit reduces the changes associated with adding the v14 api to
6.0.x

During the preparation of this commit, issues in the original backport
were corrected
- Failure to release a lock under error conditions
- Typo in an CPP ifdef
- Incorrect target for goto statement in an error handling case.

Issue: 5744

2 years agotest: do not output non ascii character
Philippe Antoine [Thu, 15 Sep 2022 13:26:46 +0000 (15:26 +0200)] 
test: do not output non ascii character

The unit test for content |aa bz| transforms in place the string
str to replace the 2 characters aa by one character 0xaa
Then, when z is not recognized as a valid hexadeicmal character,
the whole modified string is printed out, inclusing the non-ascii
0xaa

Ticket: #5558
(cherry picked from commit b281199e9aa1d2d66ac35d1f53358afca8c44a13)

2 years agosmb/ntlmssp: parse fields independently of order
Philippe Antoine [Tue, 6 Dec 2022 13:34:37 +0000 (14:34 +0100)] 
smb/ntlmssp: parse fields independently of order

Instead of relying on the usual ordering...

Ticket: #5258
(cherry picked from commit 1db86858482ddfed446f2f124c546a133e01b17c)

Manual conflict fixes to use nom instead of nom7

2 years agodoc/userguide: ubuntu: install software-properties-common 8428/head
Jason Ish [Tue, 29 Nov 2022 20:32:03 +0000 (14:32 -0600)] 
doc/userguide: ubuntu: install software-properties-common

This package likely needs to be installed when starting with an Ubuntu
container or other minimal Ubuntu install.

Ticket: #5616
(cherry picked from commit 0a4e3d0f82a5bf9d6090b3663b143a689bd52d9e)

2 years agosmb: fix post-trunc chunk behavior
Victor Julien [Wed, 11 Jan 2023 20:07:16 +0000 (21:07 +0100)] 
smb: fix post-trunc chunk behavior

After a gap in a file transaction, the file tracker is truncated. However
this did not clear any stored out of order chunks from memory or stop more
chunks to be stored, leading to accumulation of a large number of chunks.

This patches fixes this be clearing the stored chunks on trunc. It also
makes sure no more chunks are stored in the tracker after the trunc.

Bug: #5781.
(cherry picked from commit a24d7dc45c818054f97448ce42ca9ba270b3b8e4)

2 years agostreaming/sbb: fix debug message
Victor Julien [Thu, 5 Jan 2023 06:25:26 +0000 (07:25 +0100)] 
streaming/sbb: fix debug message

(cherry picked from commit 989e5c7ba23534a488794592193deea8c3a293e8)

2 years agostream: remove bug on from packet path
Victor Julien [Wed, 4 Jan 2023 19:39:24 +0000 (20:39 +0100)] 
stream: remove bug on from packet path

(cherry picked from commit a00db15bd41ad08bec19ad3c252d1aab92c5c525)

2 years agosrc: fix deprecated-non-prototype compile warnings
Victor Julien [Tue, 17 Jan 2023 10:10:54 +0000 (11:10 +0100)] 
src: fix deprecated-non-prototype compile warnings

Tested on Fedora 37 with clang 15.

util-strlcatu.c:45:8: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
size_t strlcat(dst, src, siz)
           ^
1 error generated.

(cherry picked from commit 41ca206fdfa1a071d5bf18ae2a18e1e4cea583bd)

2 years agosrc: fix unused-but-set-variable compile warnings
Victor Julien [Mon, 16 Jan 2023 21:09:02 +0000 (22:09 +0100)] 
src: fix unused-but-set-variable compile warnings

Tested on Fedora 37 with clang 15.

datasets.c:852:9: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
    int n = 0;
        ^
1 error generated.

(cherry picked from commit 1bc6976a061a78f953f6b9c796cd4135c1494beb)

2 years agosrc: fix strict-prototype warnings
Victor Julien [Mon, 16 Jan 2023 18:14:28 +0000 (19:14 +0100)] 
src: fix strict-prototype warnings

Tested on Fedora 37 with clang 15.

app-layer.c:1055:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerSetupCounters()
                          ^
                           void
app-layer.c:1176:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerDeSetupCounters()
                            ^
                             void
2 errors generated.

(cherry picked from commit ebd87282196e4757db44e9d40823477b34484238)

2 years agouserguide: update http2 config header syntax
jason taylor [Wed, 11 Jan 2023 18:38:53 +0000 (18:38 +0000)] 
userguide: update http2 config header syntax

Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years agoftp: completely resets port_line
Philippe Antoine [Wed, 28 Dec 2022 14:57:12 +0000 (15:57 +0100)] 
ftp: completely resets port_line

In the case port_line is first allocated and port_line_len is set,
Then a second request reaches memcap and frees port_line,
port_line_len should also be reset, because both will get used
by the response parsing.

Ticket: #5701
(cherry picked from commit 1660172a8b5af48b156096c4ad8bebcd9dbfafd9)

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