]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
3 years agohttp2: document HTTP1 keywords enabling 6344/head
Philippe Antoine [Mon, 5 Jul 2021 07:40:23 +0000 (09:40 +0200)] 
http2: document HTTP1 keywords enabling

For HTTP signatures to match on HTTP2 traffic if configure
option app-layer.protocols.http2.http1-rules is enabled

3 years agoipv6: decoder event on invalid length
Philippe Antoine [Mon, 19 Jul 2021 15:31:32 +0000 (17:31 +0200)] 
ipv6: decoder event on invalid length

From RFC 2460, section 4.5,
each fragment, except the last one, must have a length
which is a multiple of 8

(cherry picked from commit ca760e305cd74933b685b1bd5be795b24a7d94a7)

3 years agorust: bump bitflags dependency version
Philippe Antoine [Sun, 28 Mar 2021 15:53:50 +0000 (17:53 +0200)] 
rust: bump bitflags dependency version

So that lexical-core, needed by nom, and using bitflags
is used with version 0.7.5 instead of version 0.7.0
which fixed the fact that BITS is now a reserved keyword
in nightly version

(cherry picked from commit 0105d4f017127f9696646e7d0176caec47a7c169)

3 years agoci: dummy git configuration for rebase
Philippe Antoine [Fri, 27 Aug 2021 15:36:50 +0000 (17:36 +0200)] 
ci: dummy git configuration for rebase

(cherry picked from commit 7fa3e8df615215a1628fc1e37f4913d93ced3a92)

3 years agoci: rebase specified s-v pr
Philippe Antoine [Mon, 5 Jul 2021 14:37:03 +0000 (16:37 +0200)] 
ci: rebase specified s-v pr

So that CI does not fail, if suricata PR got upgraded in a new
version, but S-V PR did not get upgraded, and S-V changed
in master

(cherry picked from commit 3e81d20a71deb2a061d3f86430b88b8bdd4b7d6d)

3 years agogithub-ci: enable hiredis on fedora 33 build
Jason Ish [Tue, 4 May 2021 21:47:53 +0000 (15:47 -0600)] 
github-ci: enable hiredis on fedora 33 build

(cherry picked from commit def636383ec2f917e3bdb20ee6619de226afca52)

3 years agoci: update known rust version
Simon Dugas [Mon, 1 Feb 2021 01:58:26 +0000 (20:58 -0500)] 
ci: update known rust version

Update RUST_VERSION_KNOWN to the latest stable known to succeed. Also
updates the documentation to avoid confusion around the use of this
variable.

(cherry picked from commit f629321de06043214e69a56d8259a1e781535293)

3 years agotravis: remove ci file as we switched to github-ci
Victor Julien [Tue, 4 May 2021 08:40:09 +0000 (10:40 +0200)] 
travis: remove ci file as we switched to github-ci

(cherry picked from commit 28548b072b8ebd3e40ec8e0c6b96ebb794522a96)

3 years agothreading: don't pass locked flow between threads
Victor Julien [Wed, 18 Aug 2021 18:14:48 +0000 (20:14 +0200)] 
threading: don't pass locked flow between threads

Previously the flow manager would share evicted flows with the workers
while keeping the flows mutex locked. This reduced the number of unlock/
lock cycles while there was guaranteed to be no contention.

This turns out to be undefined behavior. A lock is supposed to be locked
and unlocked from the same thread. It appears that FreeBSD is stricter on
this than Linux.

This patch addresses the issue by unlocking before handing a flow off
to another thread, and locking again from the new thread.

Issue was reported and largely analyzed by Bill Meeks.

Bug: #4478
(cherry picked from commit 9551cd05357925e8bec8e0030d5f98fd07f17839)

3 years agocounters: only print alerts if stats are enabled
Shivani Bhardwaj [Mon, 21 Jun 2021 18:35:06 +0000 (00:05 +0530)] 
counters: only print alerts if stats are enabled

(cherry picked from commit a17da8374a905ad31a4fa66f85ee1cc73b857389)

3 years agomacset: adjust test to pass after fix
Victor Julien [Mon, 30 Aug 2021 19:56:24 +0000 (21:56 +0200)] 
macset: adjust test to pass after fix

(cherry picked from commit cd40fcdea710349bb998fbc4323c94394bf69c98)

3 years agomacset: fix memory size check
Eric Leblond [Fri, 20 Aug 2021 12:41:20 +0000 (14:41 +0200)] 
macset: fix memory size check

(cherry picked from commit 328bdf2c61a2b04ce1b3cde3063a07f170134717)

3 years agoflow: be sure to check hash till the end
Eric Leblond [Fri, 20 Aug 2021 08:42:13 +0000 (10:42 +0200)] 
flow: be sure to check hash till the end

(cherry picked from commit d7468c55ca4a8375ca6ca12396a4c61af6465041)

3 years agoflow: add comment on flow handling
Eric Leblond [Thu, 19 Aug 2021 14:30:50 +0000 (16:30 +0200)] 
flow: add comment on flow handling

(cherry picked from commit e531530a67789f895360200fa9d5874d3dcd7511)

3 years agostream: increase memcap on memory errors
Eric Leblond [Thu, 19 Aug 2021 09:22:06 +0000 (11:22 +0200)] 
stream: increase memcap on memory errors

(cherry picked from commit c1bffa9545b8aa9d0fc64ac6511edd34919135d7)

3 years agoflow: fix a debug assert
Eric Leblond [Sun, 15 Aug 2021 10:17:23 +0000 (12:17 +0200)] 
flow: fix a debug assert

As the FlowBypassedTimeout function is interacting with the capture
method it is possible that the return changes between the call that
did trigger the timeout and the actual state (ie if packets arrive
in between the two calls). So we should not use the call to
FlowBypassedTimeout in the assert.

(cherry picked from commit cce7e4f4cb28485f2e43630b4baf7a77449af707)

3 years agoflow: more accurate flow counters
Eric Leblond [Sat, 14 Aug 2021 21:05:03 +0000 (23:05 +0200)] 
flow: more accurate flow counters

Don't increment the flow timeout counter for flows that are not
really timeout (as use_cnt is non zero). And also don't take into
account bypassed flows in the counter for flow timeout in use.

(cherry picked from commit 9a4ef6b8fc290a83ad0d17c036d8a93b5c02689c)

3 years agoflow/worker: handle timeout edge case
Victor Julien [Mon, 30 Aug 2021 08:53:49 +0000 (10:53 +0200)] 
flow/worker: handle timeout edge case

In the flow worker timeout path it is assumed that we can hand off
flows to the recycler after processing, implying that `Flow::use_cnt` is 0.
However, there was a case where this assumption was incorrect.

When during flow timeout handling the last processed data would trigger a
protocol upgrade, two additional pseudo packets would be created that were
then pushed all the way through the engine packet paths. This would mean
they both took a flow reference and would hold that until after the flow
was handed off to the recycler. Thread safety implementation would make
sure this didn't lead to crashes.

This patch handles this case returning these packets to the pool from
the timeout handling.

(cherry picked from commit c51042e0934fd328010d41d9405fd643855aba89)

3 years agoflow/worker: set proper end flag
Victor Julien [Fri, 30 Jul 2021 19:15:28 +0000 (21:15 +0200)] 
flow/worker: set proper end flag

(cherry picked from commit c5556b5dd9b9430bddd7a79917db6bc14642b090)

3 years agoflow/manager: set proper end flag
Victor Julien [Fri, 30 Jul 2021 18:12:05 +0000 (20:12 +0200)] 
flow/manager: set proper end flag

(cherry picked from commit 61f6fe037df2b1cabd1a763f099ca62714c6c3da)

4 years agodetect/analyzer: suggest modern keywords
Victor Julien [Fri, 5 Feb 2021 21:01:26 +0000 (22:01 +0100)] 
detect/analyzer: suggest modern keywords

(cherry picked from commit b55b327db1590ae7e8ccb1a9ada9ddaa29a900bb)

4 years agodetect/analyzer: fix json output for warnings/notes
Victor Julien [Fri, 5 Feb 2021 20:33:35 +0000 (21:33 +0100)] 
detect/analyzer: fix json output for warnings/notes

(cherry picked from commit 57f7612ffd6de650943607f2fb168015e45a39e1)

4 years agorelease: 6.0.3; update changelog; require htp 0.5.38 suricata-6.0.3
Jason Ish [Wed, 30 Jun 2021 14:44:39 +0000 (08:44 -0600)] 
release: 6.0.3; update changelog; require htp 0.5.38

4 years agorust/ike: suppress some compile warnings when not debug
Jason Ish [Wed, 30 Jun 2021 16:03:35 +0000 (10:03 -0600)] 
rust/ike: suppress some compile warnings when not debug

Due to ef5755338fa6404b60e7f90bfbaca039b2bfda1e, the variables
that are only used for debug output now emit unused variable
warnings when Suricata is not built with debug. Prefix these
variables with _ to suppress these warnings.

4 years agoikev2: remove transforms fields
Shivani Bhardwaj [Fri, 25 Jun 2021 10:29:31 +0000 (15:59 +0530)] 
ikev2: remove transforms fields

4 years agoswf: right input length for decompression
Philippe Antoine [Thu, 29 Apr 2021 09:57:15 +0000 (11:57 +0200)] 
swf: right input length for decompression

(cherry picked from commit 4d2f9cc8a0409bb03f5d285bb83d64afec08ba2a)

4 years agodetect: set event if max inspect buffers exceeded
Victor Julien [Thu, 13 May 2021 06:06:11 +0000 (08:06 +0200)] 
detect: set event if max inspect buffers exceeded

If a parser exceeds 1024 buffers we stop processing them and
set a detect event instead. This is to avoid parser bugs as well as
crafted bad traffic leading to resources starvation due to excessive
loops.

(cherry picked from commit e611adf3dc5b531a9d0ef9b861b4dbe0e150eae6)

4 years agodetect: fix multi inspect buffer issue; clean up
Victor Julien [Thu, 13 May 2021 05:50:12 +0000 (07:50 +0200)] 
detect: fix multi inspect buffer issue; clean up

Fix multi inspect buffer API causing cleanup logic in the single
inspect buffer paths. This could lead to a buffer overrun in the
"to clear" logic.

Multi buffers now use InspectionBufferSetupMulti instead of
InspectionBuffer. This is enforced by a check in debug validation.

Simplify the multi inspect buffer setup code and update the callers.

(cherry picked from commit 3dc50322db0efb92683b9578c7dccd1fae4b5cb2)

4 years agorust: SCLogDebug is real nop when built as release
Philippe Antoine [Thu, 6 May 2021 11:30:49 +0000 (13:30 +0200)] 
rust: SCLogDebug is real nop when built as release

Before, even if there were no outputs, all the arguments
were evaluated, which could turn expensive

All variables which are used only in certain build configurations
are now prefixed by underscore to avoid warnings

(cherry picked from commit ef5755338fa6404b60e7f90bfbaca039b2bfda1e)

4 years agomqtt: move sub/unsub limits into app-layer config
Victor Julien [Mon, 21 Jun 2021 19:10:55 +0000 (21:10 +0200)] 
mqtt: move sub/unsub limits into app-layer config

(cherry picked from commit 3c1cc1e345bc9f78988411efa8461351d24efe98)

4 years agodetect/mqtt: add topic inspection limit
Sascha Steinbiss [Mon, 10 May 2021 12:54:47 +0000 (14:54 +0200)] 
detect/mqtt: add topic inspection limit

We add a new 'mqtt.(un)subscribe-topic-match-limit' option
to allow a user to specify the maximum number of topics in
a MQTT SUBSCRIBE or UNSUBSCRIBE message to be evaluated
in detection.

(cherry picked from commit 4c0ef73bf21f5b07c5c34fd2dc5f6d9c166bc6da)

4 years agodetect: use u32 for InspectionBufferMultipleForList
Philippe Antoine [Thu, 6 May 2021 07:25:49 +0000 (09:25 +0200)] 
detect: use u32 for InspectionBufferMultipleForList

So that we do not have an endless loop casting index to
u16 and having more than 65536 buffers in one transaction

Changes for all protocols, even ones where it is impossible
to have such a pattern, so as to avoid bad pattern copy/paste
in the future

(cherry picked from commit 7d0a39412bb451443a4e19e6571ab86a0583214c)

4 years agodcerpc: handles bigger inputs than 2^16
Philippe Antoine [Mon, 12 Apr 2021 14:56:33 +0000 (16:56 +0200)] 
dcerpc: handles bigger inputs than 2^16

By comparing integers with the largest size

(cherry picked from commit 6f03ee2e47d331aa29524d81777c970415b817f1)

4 years agosmtp: null terminate before calling strtoul
Philippe Antoine [Thu, 22 Apr 2021 08:28:15 +0000 (10:28 +0200)] 
smtp: null terminate before calling strtoul

by copying in a temporary buffer
as is done in ByteExtractString

(cherry picked from commit 33fa7ab5969d3fc5ca088c003bd4dbfe76d77b6b)

4 years agostream/tcp: avoid evasion linked to ACK handling
Eric Leblond [Fri, 28 May 2021 09:38:18 +0000 (11:38 +0200)] 
stream/tcp: avoid evasion linked to ACK handling

Actual code will completely discard TCP analysis of a packet that
don't have the ACK bit set but have a ACK value set. This will be
for example the case of all SYN packets that have a ACK value.

Problem is that these type of packets are legit for the operating
systems and for the RFC. The consequence is that an attacker
sending a SYN packet with a non null ACK value will open succesfully
a TCP session to its target and this session will have no protocol
discovery, no TCP streaming and no application layer analysis.
Result is  a quasi full evasion of the TCP stream that will only
appear in the flow log if this log is enable or alert on tcp-pkt
signature that are uncommon.

The patch is updating the code to only discard packets that do not
have the SYN flag set. This prevents the evasion and complies with the
RFC that states that the ACK bit should always be set once the
TCP session is established.

This addresses CVE-2021-35063.

Fixes: fa692df37 ("stream: reject broken ACK packets")
Bug: #4512.

4 years agodnp3: fixes use after realloc/free in output
Philippe Antoine [Tue, 9 Mar 2021 14:22:47 +0000 (15:22 +0100)] 
dnp3: fixes use after realloc/free in output

OutputJsonBuilderBuffer can realloc the buffer
So, we need to give it the right reference

4 years agodoc: update sphinx api to use add_css_file 6224/head
Philippe Antoine [Mon, 17 May 2021 14:27:49 +0000 (16:27 +0200)] 
doc: update sphinx api to use add_css_file

instead of deprecated add_stylesheet

(cherry picked from commit 95f225e8fbd5d352a8ca86cd317f908034966ed4)

4 years agorust/template: suppress unread variable warning 6222/head
Jason Ish [Mon, 21 Jun 2021 20:00:45 +0000 (14:00 -0600)] 
rust/template: suppress unread variable warning

Suppress the warning about an unused variable in the template
parser. As this is just a template I think this is OK, however
master should make sure this variable is used, if only to be
more self documenting.

4 years agorust: fix warnings with nightly
Sascha Steinbiss [Tue, 22 Jun 2021 07:33:24 +0000 (09:33 +0200)] 
rust: fix warnings with nightly

4 years agomodbus: fix memory leak in signature parsing
Philippe Antoine [Tue, 22 Jun 2021 06:16:40 +0000 (08:16 +0200)] 
modbus: fix memory leak in signature parsing

Bug: #4538.

4 years agoconfig: fix null dereference in MacSetRegisterFlowStorage 6212/head
Philippe Antoine [Fri, 11 Jun 2021 12:13:44 +0000 (14:13 +0200)] 
config: fix null dereference in MacSetRegisterFlowStorage

Crash happens with
--set outputs.eve-json.types.files.force-magic=yes

(cherry picked from commit 8bf653054025e6297f05ec211a0baa44cf795704)

4 years agohttp2: make http1 rules work on http2 traffic optional
Philippe Antoine [Wed, 26 May 2021 08:16:54 +0000 (10:16 +0200)] 
http2: make http1 rules work on http2 traffic optional

4 years agoproto: introduce signature protocol, as extension to flow protocol
Philippe Antoine [Mon, 7 Dec 2020 13:41:00 +0000 (14:41 +0100)] 
proto: introduce signature protocol, as extension to flow protocol

AppProtoEquals function allows to check if a flow protocol
matches a signature protocol

This allows HTTP1 keywords on HTTP2 traffic

4 years agoftp: ftp-data recognized by StringToAppProto
Philippe Antoine [Thu, 21 Jan 2021 13:44:33 +0000 (14:44 +0100)] 
ftp: ftp-data recognized by StringToAppProto

(cherry picked from commit 43f25f127f069292e5e92377b82d40df2c3cb2d4)

4 years agohttp2: http.stat_code keyword now works for HTTP2
Philippe Antoine [Mon, 26 Apr 2021 12:39:24 +0000 (14:39 +0200)] 
http2: http.stat_code keyword now works for HTTP2

(cherry picked from commit 1e96272576cc6cd734f973e16594dbc1a1e383f6)

4 years agohttp2: http.cookie keyword now works for HTTP2
Philippe Antoine [Mon, 26 Apr 2021 13:50:44 +0000 (15:50 +0200)] 
http2: http.cookie keyword now works for HTTP2

(cherry picked from commit 999327ba1f02904f219c4ffe6ff1d952facddc92)

4 years agohttp2: makes all HTTP1 header keywords work
Philippe Antoine [Mon, 26 Apr 2021 13:01:53 +0000 (15:01 +0200)] 
http2: makes all HTTP1 header keywords work

(cherry picked from commit 017e39d8fd59028d07efa281c8fb9250b33a056f)

4 years agohttp2: http.host.raw keyword now works for HTTP2
Philippe Antoine [Mon, 26 Apr 2021 13:37:57 +0000 (15:37 +0200)] 
http2: http.host.raw keyword now works for HTTP2

(cherry picked from commit df039555bce1ca52f93a34cd1dc8f8ef43e6d05d)

4 years agohttp2: http.method keyword now works for HTTP2
Philippe Antoine [Mon, 26 Apr 2021 13:17:09 +0000 (15:17 +0200)] 
http2: http.method keyword now works for HTTP2

(cherry picked from commit 1e82d0b3c88309461252680fe87bd4bdeaf2b26b)

4 years agohttp2: http.user_agent keyword now works for HTTP2
Philippe Antoine [Thu, 17 Dec 2020 12:26:35 +0000 (13:26 +0100)] 
http2: http.user_agent keyword now works for HTTP2

(cherry picked from commit 47928babfc4adcd897aaa8c485f031683caf8f78)

4 years agohttp2: http.uri.raw keyword now works for HTTP2
Philippe Antoine [Thu, 17 Dec 2020 13:19:25 +0000 (14:19 +0100)] 
http2: http.uri.raw keyword now works for HTTP2

(cherry picked from commit 5d676c5998aeb33c529e8ee8efcaa2fdf10324ef)

4 years agohttp2: http.uri keyword now works for HTTP2
Philippe Antoine [Tue, 8 Dec 2020 11:46:24 +0000 (12:46 +0100)] 
http2: http.uri keyword now works for HTTP2

cf #4067

(cherry picked from commit a98d0fe6edcd6bd5af460c067caca3021f543587)

4 years agohttp2: allow http1 keywords for http2 traffic
Philippe Antoine [Tue, 12 Jan 2021 15:42:48 +0000 (16:42 +0100)] 
http2: allow http1 keywords for http2 traffic

Adding a special case in DetectSignatureSetAppProto

4 years agohttp2: only mimic http1 request if there is one 6186/head
Philippe Antoine [Thu, 22 Apr 2021 07:41:30 +0000 (09:41 +0200)] 
http2: only mimic http1 request if there is one

That may not be the case in midstream/async configurations

(cherry picked from commit d00b755b647a69eb4d4a10adb57be45fd4d14c7d)

4 years agothresholds: Fix buffer overflow in threshold context
Mats Klepsland [Thu, 27 May 2021 10:02:55 +0000 (12:02 +0200)] 
thresholds: Fix buffer overflow in threshold context

th_entry is resized using ThresholdHashRealloc() every time a rule with
a threshold using by_rule tracking is added. The problem is that this is
done before the rules are reordered, so occasionally a rule with by_rule
tracking gets a higher signature number (after reordering) than the
number of th_entries allocated, causing Suricata to crash.

This commit fixes this by allocating th_entries after all the rules are
loaded and reordered.

Backtrace from core dump:

  Program terminated with signal SIGSEGV, Segmentation fault.

  #0  0x000000000051b381 in ThresholdHandlePacket (p=p@entry=0x7fb0080f3960, lookup_tsh=0x51, new_tsh=new_tsh@entry=0x7fb016c316e0, td=td@entry=0x14adedf0, sid=9800979, gid=1, pa=0x7fb0080f3b18)
      at detect-engine-threshold.c:415
  415>----                if (TIMEVAL_DIFF_SEC(p->ts, lookup_tsh->tv1) < td->seconds) {

Bug #4503.

(cherry picked from commit 2a326421aa29154ebfaada3888974a634feb5f56)

4 years agothresholds: syntax fixes
Mats Klepsland [Thu, 27 May 2021 09:04:15 +0000 (11:04 +0200)] 
thresholds: syntax fixes

Fix syntax of if statement in SigGetThresholdTypeIter()

(cherry picked from commit f47e4375b3310554c13561efb2f382f04bd24340)

4 years agothresholds: remove unneeded function argument
Mats Klepsland [Thu, 27 May 2021 08:59:36 +0000 (10:59 +0200)] 
thresholds: remove unneeded function argument

Remove packet pointer from SigGetThresholdTypeIter() as it is
unused.

(cherry picked from commit b0b4fab7949dddeaf4c1b844c403dcc2c2470595)

4 years agorust: fix app-layer parser flags
Philippe Antoine [Fri, 4 Jun 2021 08:28:10 +0000 (10:28 +0200)] 
rust: fix app-layer parser flags

This especially allows for SSH bypass to work

(cherry picked from commit fdab22d924702168e3b7d07d061009ebdcfa9aa9)

4 years agoftp: completely parses pasv and epsv responses
Philippe Antoine [Tue, 27 Apr 2021 07:03:45 +0000 (09:03 +0200)] 
ftp: completely parses pasv and epsv responses

(cherry picked from commit ca6e434e0b84dc8478763dc0a8716c5e3686a99a)

4 years agounix-socket: reset to ready state on startup
Jason Ish [Thu, 25 Feb 2021 17:16:28 +0000 (11:16 -0600)] 
unix-socket: reset to ready state on startup

As part of commit ea15282f47c6ff781533e3a063f9c903dd6f1afb,
some initialization was moved to happen even in unix socket mode,
however, this initialization does setup some loggers that can only have
one instance enabled (anomaly, drop, file-store).

This will cause these loggers to error out on the first pcap, but work
on subsequent runs of the pcap as some deinitialization is done after
each pcap.

This fix just runs the post pcap-file deinitialization routine to
reset some of the initialization done on startup, like is done after
running each pcap in unix socket mode.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4225

Additionally this prevents alerts from being logged two times
on the first run of a pcap through the unix socket:

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4434

(cherry picked from commit 488d5fb34284f7e5be760edeca7607209cfa4b5e)

4 years agohttp2: make decompression a configure-time option 6184/head
Philippe Antoine [Mon, 31 May 2021 15:14:48 +0000 (17:14 +0200)] 
http2: make decompression a configure-time option

4 years agohttp2: have filecontainer for both directions
Philippe Antoine [Fri, 23 Apr 2021 19:55:20 +0000 (21:55 +0200)] 
http2: have filecontainer for both directions

(cherry picked from commit 6fe8bce3b0c653df8e72bdb81bc235672386b8b1)

4 years agohttp2: adds check about dynamic headers table size
Philippe Antoine [Tue, 16 Mar 2021 12:07:30 +0000 (13:07 +0100)] 
http2: adds check about dynamic headers table size

(cherry picked from commit 3de0123ffbf355e3d3de318080f18bd639ec9beb)

4 years agohttp2: remove dead code
Victor Julien [Tue, 18 May 2021 13:07:02 +0000 (15:07 +0200)] 
http2: remove dead code

(cherry picked from commit de280c47d9776c3c16743bb01f8cceb6e97ad94a)

4 years agohttp2: remove assertion which can be wrong
Philippe Antoine [Tue, 18 May 2021 07:52:53 +0000 (09:52 +0200)] 
http2: remove assertion which can be wrong

Brotli decoder stops consuming input it it reaches the
end of its input

(cherry picked from commit b3c502d572693368aba277d28aefc9c9cfe685af)

4 years agohttp2: pass data through when decompression fails
Philippe Antoine [Mon, 5 Apr 2021 13:53:09 +0000 (15:53 +0200)] 
http2: pass data through when decompression fails

as is done for HTTP1

(cherry picked from commit 1ca4f041bb452742f326985479fca9a02473649f)

4 years agohttp2: decompression for files
Philippe Antoine [Thu, 12 Nov 2020 08:24:36 +0000 (09:24 +0100)] 
http2: decompression for files

gzip and brotli decompression for files

(cherry picked from commit d8612282149df27be47f7aaba906ea08dcc3952e)

4 years agorust: BIT_U16 macro utility
Philippe Antoine [Tue, 8 Dec 2020 13:53:01 +0000 (14:53 +0100)] 
rust: BIT_U16 macro utility

(cherry picked from commit 2e46b5d1001d61da2131c42554eff10b7400ad81)

4 years agorust: better panic message for missing file config
Philippe Antoine [Sun, 6 Dec 2020 19:36:45 +0000 (20:36 +0100)] 
rust: better panic message for missing file config

(cherry picked from commit aee8e601491c60aac9ee158918a4110df87bcc1e)

4 years agodecode/vntag: By default, disable vntag decoding 6173/head
Jeff Lucovsky [Fri, 4 Jun 2021 12:26:09 +0000 (08:26 -0400)] 
decode/vntag: By default, disable vntag decoding

This commit makes the VNTag decoder off by default.

4 years agodecode/vntag: Add VNTag decoder logic
Jeff Lucovsky [Sun, 25 Apr 2021 13:20:54 +0000 (09:20 -0400)] 
decode/vntag: Add VNTag decoder logic

(cherry picked from commit 0f0cb5169f378614c753328e2d0396f5b9211a38)

4 years agotests/vntag: VNTAG decoder unittests
Jeff Lucovsky [Sat, 24 Apr 2021 19:44:17 +0000 (15:44 -0400)] 
tests/vntag: VNTAG decoder unittests

(cherry picked from commit 596d7608333290d22ea6cee26a79eb4f9ca8605d)

4 years agodecode/vntag: VNTAG 802.1Qbh decoder
Jeff Lucovsky [Sat, 24 Apr 2021 19:43:50 +0000 (15:43 -0400)] 
decode/vntag: VNTAG 802.1Qbh decoder

(cherry picked from commit 713bace44f05c4b900c35ad2da537ef5e0ad18ec)

4 years agodecode/stats: VNTAG stats
Jeff Lucovsky [Sat, 24 Apr 2021 19:42:48 +0000 (15:42 -0400)] 
decode/stats: VNTAG stats

(cherry picked from commit b944e636a8dfa34971d0375baa1cb3fa764bb2e0)

4 years agodecode/events: VNTAG decoder events
Jeff Lucovsky [Sat, 24 Apr 2021 19:38:16 +0000 (15:38 -0400)] 
decode/events: VNTAG decoder events

(cherry picked from commit 1ddad0a0d610265baea902387eb40d7012c8c841)

4 years agodecode: Add ethertype for VNTAG
Jeff Lucovsky [Sat, 24 Apr 2021 19:36:57 +0000 (15:36 -0400)] 
decode: Add ethertype for VNTAG

(cherry picked from commit 049afde3a275ab748f4ef1f4777b9cfd5dd400ce)

4 years agogithub: Update codeowner handle 6148/head
Shivani Bhardwaj [Fri, 30 Apr 2021 06:55:58 +0000 (12:25 +0530)] 
github: Update codeowner handle

(cherry picked from commit 0c5a8fb35d3f60b3828c5e7b91f4bb9e6c37990c)

4 years agorust: pin memchr to ~2.3 6143/head
Jason Ish [Tue, 25 May 2021 16:18:56 +0000 (10:18 -0600)] 
rust: pin memchr to ~2.3

2.4+ requires a newer version of Rust.

4 years agomakefile: don't include the whole test/ directory
Jason Ish [Tue, 25 May 2021 17:39:31 +0000 (11:39 -0600)] 
makefile: don't include the whole test/ directory

Including the whole directory results in .deps files ending up
in the distribution archive which shouldn't be there. Instead
we have to list all the test sources individually.

Backport of 70b21df75633253ac8318f229de2f521c14a6630.

4 years agordp: correctly returns incomplete in parse_tc 6099/head
Philippe Antoine [Thu, 11 Mar 2021 21:17:13 +0000 (22:17 +0100)] 
rdp: correctly returns incomplete in parse_tc

Adding the already consumed bytes
In case an incomplete tls handshake is handled with/after
a refular rdp t123_tpkt

(cherry picked from commit 6da9a37285a50b513077e5c88094f8112740ffcb)

4 years agoftp: fixes leak with duplicate expectation
Philippe Antoine [Thu, 8 Apr 2021 15:44:01 +0000 (17:44 +0200)] 
ftp: fixes leak with duplicate expectation

(cherry picked from commit 68d6922e3cc47c2608e1ac3614c6bd3a48185a12)

4 years agooutput/log: Ensure files closed in threaded mode
Jeff Lucovsky [Sun, 11 Apr 2021 16:20:15 +0000 (12:20 -0400)] 
output/log: Ensure files closed in threaded mode

This commit ensures that file objects are closed in threaded mode.

(cherry picked from commit 38ae21a19691466b078a6201494df893bc91308c)

4 years agooutput/log: Removed pcie (Tilera) log vestiges
Jeff Lucovsky [Mon, 12 Apr 2021 13:12:23 +0000 (09:12 -0400)] 
output/log: Removed pcie (Tilera) log vestiges

This commit removes the last remnants of the Tilera log output mechanism
(unsupported since 5.0.x).

(cherry picked from commit aa9ad56a5b0faeb9528558f6197ff967c6714e94)

4 years agoflow/bypass: Properly set the ICMP emergency-bypassed value
Luke Coughlan [Mon, 26 Apr 2021 12:05:15 +0000 (13:05 +0100)] 
flow/bypass: Properly set the ICMP emergency-bypassed value

Currently the ICMP emergency-bypassed value defined in suricata.conf is
overwriting the UDP value rather than correctly setting it for ICMP.
This commit corrects this bug so that the ICMP value can be set as
expected.

(cherry picked from commit 7fb56a9075a97cd9781d08efd0f949b0bfca2719)

4 years agokerberos: fix probing parser tag condition
Philippe Antoine [Thu, 11 Mar 2021 15:12:36 +0000 (16:12 +0100)] 
kerberos: fix probing parser tag condition

according to the comment

(cherry picked from commit cb150e97d09baea09a738388426eafad3cccff2a)

4 years agodetect/alert: apply pd only actions to flow
Victor Julien [Wed, 10 Mar 2021 12:25:55 +0000 (13:25 +0100)] 
detect/alert: apply pd only actions to flow

Ticket #4394

(cherry picked from commit 6cf44fc839e8f1da820095928b5b25e7fc0a8521)

4 years agodetect/alert: minor code refactor
Victor Julien [Tue, 9 Mar 2021 19:56:14 +0000 (20:56 +0100)] 
detect/alert: minor code refactor

Use a simpler reject check and move logic into util func.

(cherry picked from commit 6c594d29db55bb0d6f28f0a5fa758c3e00a86ca1)

4 years agodetect/iponly: don't check & set flow flags twice
Victor Julien [Tue, 9 Mar 2021 15:25:14 +0000 (16:25 +0100)] 
detect/iponly: don't check & set flow flags twice

Per flow IP-only flags are checked and set by IP-only engine, so
no need to set/check them per alert.

(cherry picked from commit fbcdd2ec267d49040ca178f8562767d8fb00aa73)

4 years agothreshold-config: Improve support for big IP lists
Jeff Lucovsky [Sat, 5 Dec 2020 14:28:38 +0000 (09:28 -0500)] 
threshold-config: Improve support for big IP lists

(cherry picked from commit ef62761e8c64d1644f2628ca7fc99e815bd96b88)

4 years agodetect/threshold: Improve threshold.config perf
Jeff Lucovsky [Mon, 29 Mar 2021 12:30:59 +0000 (08:30 -0400)] 
detect/threshold: Improve threshold.config perf

This commit improves performance when parsing threshold.config by
removing a loop-invariant to create a one-time object with the parsed
address(es).

Then, as needed, copies of this object are made as the suppression
rule(s) are processed.

(cherry picked from commit 02ceac8b8d4473de5f373a4785a1c143778b06e1)

4 years agodetect/threshold: Function to deep-copy thresh obj
Jeff Lucovsky [Mon, 29 Mar 2021 12:28:50 +0000 (08:28 -0400)] 
detect/threshold: Function to deep-copy thresh obj

This commit adds a function to make a deep copy of a DetectThresholdData
object.

The function is used when parsing threshold.config items to make a
one-time object and then add copies as needed.

(cherry picked from commit e873632a2811be4cd370336d43fcc5619bcd28e2)

4 years agodetect/address: Expose DetectAddressCopy function
Jeff Lucovsky [Mon, 29 Mar 2021 12:26:40 +0000 (08:26 -0400)] 
detect/address: Expose DetectAddressCopy function

(cherry picked from commit 11f9cc6524958d11b6d9ab1f0785bfe16237096f)

4 years agogeneral: Typo cleanup
Jeff Lucovsky [Mon, 29 Mar 2021 12:33:02 +0000 (08:33 -0400)] 
general: Typo cleanup

(cherry picked from commit 2893b04ab014c4dcc0bfc4c6f9dbf83fd44717a1)

4 years agoeve/drop: use highest priority drop
Victor Julien [Fri, 12 Mar 2021 09:22:01 +0000 (10:22 +0100)] 
eve/drop: use highest priority drop

When adding the alert to a drop record make sure the add the highest
priority.

It would until now add all drops from high to low prio, effectively
overwriting the record each time.

Ticket #4397

(cherry picked from commit 398ebf934509a8d27a1c8b858eae061b89d5c44a)

4 years agomisc: include queue.h before other headers 6079/head
Jason Ish [Thu, 22 Apr 2021 14:52:08 +0000 (08:52 -0600)] 
misc: include queue.h before other headers

At least on FreeBSD, some other include is including "sys/queue.h"
which results in FreeBSDs /usr/include/sys/queue.h being picked
up and setting __SYS_QUEUE_H__ so our queue.h is not picked up.

But the FreeBSD queue.h does not have the CIRCLEQ definitions. To
fix just include our queue.h first, which also sets __SYS_QUEUE_H__
preventing the system one from being picked up.

(cherry picked from commit d4554ec6bb6e4e52fb2e36cf0412c981a4d1d2e9)

4 years agotx: fix unidir tx cleanup
Jason Ish [Thu, 22 Apr 2021 15:38:24 +0000 (09:38 -0600)] 
tx: fix unidir tx cleanup

A unidirection protocol parser should only have its transactions
marked as "skipped" if it is skipped in both the TS and TC
directions, otherwise unidir transactions are always considered
skipped and the cleanup will never updates its minimum id.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4437

(cherry picked from commit afaa18c5ad183d068795cf15d21d3642814ceb23)

4 years agoeve/mqtt: fix mqtt logging with threaded eve 6016/head
Jason Ish [Thu, 25 Mar 2021 18:11:01 +0000 (12:11 -0600)] 
eve/mqtt: fix mqtt logging with threaded eve

Mqtt was not setting up a per-thread file context for logging
in threaded mode, leading a crash when used in threaded mode.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4404

(cherry picked from commit 64330498f842386cc1f1cdec0409959b5565496f)

4 years agoci: make format check use 6.0.x branch
Victor Julien [Wed, 31 Mar 2021 13:20:14 +0000 (15:20 +0200)] 
ci: make format check use 6.0.x branch

4 years agodetect/icmp: reject invalid rules for icode/itype
Victor Julien [Wed, 3 Mar 2021 13:01:55 +0000 (14:01 +0100)] 
detect/icmp: reject invalid rules for icode/itype

(cherry picked from commit 68f8b2f40f24a8656b09b3a9b1245ab3cf62a11d)

4 years agodetect/prefilter: fix null ptr deref on invalid rule
Victor Julien [Wed, 3 Mar 2021 12:41:26 +0000 (13:41 +0100)] 
detect/prefilter: fix null ptr deref on invalid rule

A bad rule 'icode:<0; prefilter;' would trigger a null ptr deref
in ApplyToU8Hash.

Bug #4375.

(cherry picked from commit 7d6835958bbb6ddf2931c9e20f409eadfc8ca068)