]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
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)

2 years agodecode/tcp: allow 4 byte TFO with 2 byte cookie
Victor Julien [Mon, 5 Sep 2022 17:28:27 +0000 (19:28 +0200)] 
decode/tcp: allow 4 byte TFO with 2 byte cookie

(cherry picked from commit f5bd55dac863c4c54d6a21942a7ef821f2b4fa4f)

2 years agoipfw: use PF_DIVERT on modern FreeBSD
Gleb Smirnoff [Wed, 31 Aug 2022 03:15:31 +0000 (20:15 -0700)] 
ipfw: use PF_DIVERT on modern FreeBSD

(cherry picked from commit 5dbbc52b066b2047c4bc30be7fd29dbb3febaf96)

2 years agounittests: optimize RunmodeIsUnittests() 7834/head
Victor Julien [Wed, 9 Jun 2021 07:23:07 +0000 (09:23 +0200)] 
unittests: optimize RunmodeIsUnittests()

(cherry picked from commit 86e600dab8dd3e3787bab247f2884c839079743a)

2 years agohttp2: remove to_vec for comparisons
Philippe Antoine [Sun, 24 Jul 2022 19:54:24 +0000 (21:54 +0200)] 
http2: remove to_vec for comparisons

Ticket: #5454
(cherry picked from commit 9b4a133777e8d25eda0f9f44095bc4a10d8cce21)

Conflict fixed by Philippe Antoine

2 years agohttp2: fix clippy warning about &Vec<u8>
Philippe Antoine [Wed, 3 Aug 2022 06:29:40 +0000 (08:29 +0200)] 
http2: fix clippy warning about &Vec<u8>

Using &[u8] instead in function prototype

(cherry picked from commit d011b468da237c2d2e8b704dce9041ba40be5e01)

Conflict fixed by Philippe Antoine

2 years agogithub-ci: add cherry-pick line check 7828/head
Victor Julien [Mon, 5 Sep 2022 07:08:39 +0000 (09:08 +0200)] 
github-ci: add cherry-pick line check

2 years agoflow/recycler: bring back pthread_cond_t sleep
Victor Julien [Thu, 11 Nov 2021 07:34:43 +0000 (08:34 +0100)] 
flow/recycler: bring back pthread_cond_t sleep

Bug #4379.

(cherry picked from commit f271fb457522d77a1befeb1d097c125afcbdeeb9)

2 years agoflow/manager: sleep handled by pthread_cond_t again
Victor Julien [Tue, 9 Nov 2021 16:53:18 +0000 (17:53 +0100)] 
flow/manager: sleep handled by pthread_cond_t again

Use only in live mode to allow FM to respond quickly to time
increases in offline mode.

Bug #4379.

(cherry picked from commit e6ac2e4e8a697a4c98b637a0d6c58dce8fb918aa)

2 years agotime: add timeradd implementation
Victor Julien [Wed, 10 Nov 2021 14:40:26 +0000 (15:40 +0100)] 
time: add timeradd implementation

timeradd isn't available on MinGW.

(cherry picked from commit 39141a8836c99cf65e533e8c6dd312bfb579643b)

2 years agofuzz: restrict flags passed to AppLayerProtoDetectGetProto
Philippe Antoine [Thu, 1 Sep 2022 19:32:35 +0000 (21:32 +0200)] 
fuzz: restrict flags passed to AppLayerProtoDetectGetProto

Manual adaptation of 05f9b3f and f4449d3

2 years agohttp2: check overflow before it happens
Philippe Antoine [Sun, 23 Jan 2022 20:22:32 +0000 (21:22 +0100)] 
http2: check overflow before it happens

instead of checking afterwards if value got smaller

(cherry picked from commit b86beb9b68807e371f7af1ad6a1f789fdd5f7209)

Manually adapted to make it work with MSRV

2 years agouserguide: briefly introduce exception policy opts
Juliana Fajardini [Fri, 26 Aug 2022 16:13:09 +0000 (13:13 -0300)] 
userguide: briefly introduce exception policy opts

Added them in the configuration section so folks can be more aware of
them, while a more complete documentation isn't around.

Related to
Task #5475

(cherry picked from commit ef54f36e3480c8dfc5a160849e7b9d0fe1351ad6)

2 years agouserguide: update defrag settings options
Juliana Fajardini [Fri, 26 Aug 2022 20:52:46 +0000 (17:52 -0300)] 
userguide: update defrag settings options

We were still mentioning that there were only three options.

(cherry picked from commit 3c74e443bdd6e666692b1c1da1d0389268b0eec7)

2 years agouserguide: add section about HTTP2 settings
Juliana Fajardini [Thu, 1 Sep 2022 18:35:01 +0000 (15:35 -0300)] 
userguide: add section about HTTP2 settings

This was in master but not in 60x yet.

2 years agouserguide: merge sections about AppLayer Parsers
Juliana Fajardini [Fri, 26 Aug 2022 20:19:33 +0000 (17:19 -0300)] 
userguide: merge sections about AppLayer Parsers

We had two sections under the suricata.yaml configuration section
describing settings for application layer parsers. This merges them into
one and also fixes a few subsection title levels.

Task #5364

(cherry picked from commit 0cc040cf6128fadedf9ad9a6a23ecccdd4856878)

2 years agosuricata.yaml: add exception policy config options
Juliana Fajardini [Mon, 22 Aug 2022 23:05:50 +0000 (20:05 -0300)] 
suricata.yaml: add exception policy config options

Related to
Task #5468

(cherry picked from commit fc81c80c0412e11c382a122aa8fa6af441c24499)

2 years agostream: add exception policy for midstream flows
Juliana Fajardini [Wed, 17 Aug 2022 14:39:33 +0000 (11:39 -0300)] 
stream: add exception policy for midstream flows

This allows to set a midstream-policy that can:
- fail closed (stream.midstream-policy=drop-flow)
- fail open (stream.midstream-policy=pass-flow)
- bypass stream (stream.midstream-policy=bypass)
- do nothing (default behavior)

Usage and behavior:

If stream.midstream-policy is set then if Suricata identifies a midstream flow
it will apply the corresponding action associated with the policy.

No setting means Suricata will not apply such policies, either inspecting the
flow (if stream.midstream=true) or ignoring it stream.midstream=false.

Task #5468

(cherry picked from commit aa5bb2c329aff59b7811b43258ffd4d95fe7364f)

2 years agoexceptions: add callbacks for drop-flow policy
Juliana Fajardini [Mon, 29 Aug 2022 23:32:31 +0000 (20:32 -0300)] 
exceptions: add callbacks for drop-flow policy

Make sure that when the policy is to drop the flow, we set no inspection
for payload and packet and disable applayer inspection as well.

Task #5468

(cherry picked from commit 242b8f7d65498f7b7b33cf852a79206484c269b1)

2 years agogithub-ci: add AlmaLinux 9 build 7820/head
Jason Ish [Mon, 8 Aug 2022 19:17:01 +0000 (13:17 -0600)] 
github-ci: add AlmaLinux 9 build

(cherry picked from commit 2b83cc799d7574db5a2220c8b8cbdf1bd474a5f7)

2 years agogithub-ci: test execution of suricatasc and suricata-update
Jason Ish [Sun, 7 Aug 2022 16:24:56 +0000 (10:24 -0600)] 
github-ci: test execution of suricatasc and suricata-update

(cherry picked from commit d9b6e1d96748b6e49d0cccd0c45cc956ba1e2d74)

2 years agopython: install without distutils
Jason Ish [Tue, 3 May 2022 18:34:57 +0000 (12:34 -0600)] 
python: install without distutils

Instead of using distutils/setuptools for installing the Python code,
just install it into our own Python directory.

Distutils is being removed from Python, and setuptools doesn't work well
when trying to install into your own location. For our usage its just
simpler to install with make.

In addition to removing the configure check for distutils, also remove
the check for pyyaml. This lets the user install pyyaml after Suricata
is installed, and Suricata-Update does handle this case gracefully.

Issue: #5313

(cherry picked from commit 9a1d6af8582be4b817e9f0ffb9d5f591dfc31fb9)

2 years agodoc/conf: fix sphinx language setting 7806/head
Shivani Bhardwaj [Fri, 12 Aug 2022 09:46:14 +0000 (15:16 +0530)] 
doc/conf: fix sphinx language setting

sphinx-build 5.1.1 and above throws a warning which is treated as an
error while building.

Invalid configuration value found: 'language = None'. Update your configuration to a valid language code. Falling back to 'en' (English).

(cherry picked from commit 2c4d6b33aec856e7836136a0f97d05de794f0ec0)

2 years agoexceptions: error out when invalid policy is used
Juliana Fajardini [Wed, 24 Aug 2022 20:36:47 +0000 (17:36 -0300)] 
exceptions: error out when invalid policy is used

Before, if an invalid value was passed as exception policy, Suricata
would log a warning and set the exception policy to "ignore". This is a
very different result, than, say, dropping or bypassing a midstream flow.

Task #5504

(cherry picked from commit 58ef3cde7a01166a1ae56b814156e2cad02e1251)

2 years agogithub: bump ubuntu-18.04 runners to 22.04
Victor Julien [Thu, 18 Aug 2022 12:27:54 +0000 (14:27 +0200)] 
github: bump ubuntu-18.04 runners to 22.04

(cherry picked from commit 3dea69ec8303e8bc2b90ee154423c9bd7aef85e0)

2 years agodetect/parse: test sig parsing for more actions
Juliana Fajardini [Mon, 15 Aug 2022 18:57:58 +0000 (15:57 -0300)] 
detect/parse: test sig parsing for more actions

Our unittests were only covering sig parsing for alert actions. As in
environments without LibNet the reject action will not work, we must
ensure that our parser properly fails in such cases, instead of silently
accepting an unsupported action.

Added tests for the reject and drop action.

Task #5496

(cherry picked from commit c81b78fd1c9a6e86d6be14b7567c5b8d8c89d6af)

2 years agodetect/engine: fix typos in assorted files
Juliana Fajardini [Tue, 10 May 2022 20:01:20 +0000 (17:01 -0300)] 
detect/engine: fix typos in assorted files

(cherry picked from commit 5f4bcfe313c879fb411ef9a6e2c4561764e45c26)

2 years agocommandline: add alert-queue expand failure option
Juliana Fajardini [Mon, 9 May 2022 14:57:31 +0000 (11:57 -0300)] 
commandline: add alert-queue expand failure option

For testing purposes. Meant to simulate a reallocation failure when
dynamically growing the alert queue in DetectEngineThreadCtx, so we can
check that Suri's behavior doesn't break under such circumstances.

Task #5319

(cherry picked from commit 58928b249d3b5b9740bc7d35cd392c265097648c)

2 years agofuzz: disable enip detection based on source port
Philippe Antoine [Wed, 24 Aug 2022 07:51:52 +0000 (09:51 +0200)] 
fuzz: disable enip detection based on source port

So as to avoid fuzzing detecting protocol polyglots with enip

(cherry picked from commit d1ebf320f713af6ca102d71d9201a629334d162b)

2 years agodecode: remove unused macros 7803/head
Juliana Fajardini [Tue, 23 Aug 2022 13:35:18 +0000 (10:35 -0300)] 
decode: remove unused macros

With the recent changes, these macros weren't being used anymore.

Related to
Bug #5458

(cherry picked from commit e7727c3744bf1ec44d8cd74df6d8dd8bbd725ab8)

2 years agostream/tcp: remove repeated header declaration
Juliana Fajardini [Mon, 8 Aug 2022 14:12:33 +0000 (11:12 -0300)] 
stream/tcp: remove repeated header declaration

StreamTcpRegisterTests was being declared twice.

(cherry picked from commit d07a6c6174cadc2ea29070fc1963c74d20dc56c7)

2 years agodetect/alert: add unittests to check packet action
Juliana Fajardini [Mon, 1 Aug 2022 23:04:22 +0000 (20:04 -0300)] 
detect/alert: add unittests to check packet action

Add unittests to check that packet flags are correctly updated after
detection finds drop or reject rules that match.

Related to
Bug #5458

(cherry picked from commit f897761ecbc0e78d45110f35b53820d74fd2e1d3)

2 years agodecode: validate if dropped packet has drop reason
Juliana Fajardini [Mon, 8 Aug 2022 14:04:59 +0000 (11:04 -0300)] 
decode: validate if dropped packet has drop reason

Related to
Bug #5458

(cherry picked from commit abd595d695ce477cccd80ec22ebcc156a544f65e)

2 years agodetect/alert: ensure reject action is applied
Juliana Fajardini [Thu, 28 Jul 2022 23:05:47 +0000 (20:05 -0300)] 
detect/alert: ensure reject action is applied

Bug 5458 states that the reject action is no longer working. While SV
tests that use the reject action still pass, it indeed seems that a
regression has happened with commit aa93984, because while the
function that applies rule actions to the flow (RuleActionToFlow) does
check for the reject action, the newly added function PacketApply
SignatureActions only checks for ACTION_DROP or ACTION_PASS when
deciding to call RuleActionToFlow.

Bug #5458

(cherry picked from commit 1f54e8611ab39ce3509280574d137df23c325658)

2 years agodecode: make PacketDrop use action as parameter
Juliana Fajardini [Thu, 28 Jul 2022 15:04:45 +0000 (12:04 -0300)] 
decode: make PacketDrop use action as parameter

A Packet may be dropped due to several different reasons. This change
adds action as a parameter, so we can update the packet action when we
drop it, instead of setting it to drop.

Related to
Bug #5458

(cherry picked from commit 1774ff18a6ab28233f7b31e0fb6b799d81abf34d)

3 years agosource/pcap: fix infinite loop if interface goes down 7672/head
Juliana Fajardini [Tue, 28 Jun 2022 20:06:50 +0000 (17:06 -0300)] 
source/pcap: fix infinite loop if interface goes down

When in live-pcap mode, if the sniffed interface went down and up again,
Suri would enter an infinite and keep running, while not registering new
events. This fixes that behavior by allowing Suri to retry to open the
pcap in case of a retry on an already activated capture
('PCAP_ERROR_ACTIVATED').

This change is based on Zhiyuan Liao's work.

Bug #3846

(cherry picked from commit 2544be4672215d8c86c68f0d03c8fd88f498f1d2)

3 years agodetect/engine: init alert queue counters on reload 7659/head
Jufajardini Reichow [Mon, 25 Jul 2022 23:47:23 +0000 (20:47 -0300)] 
detect/engine: init alert queue counters on reload

alert_queue_overflow and alerts_suppressed were not being
reinitialized when there was a reload of Suricata rules, leading to
non-valid stats counters if that happened.

Bug #5457

(cherry picked from commit 93c2c9743d4ebe35017317a2668c6f8a54498d34)

3 years agorust/nfs: add a maximum number of operations per compound
Jason Ish [Mon, 18 Jul 2022 21:52:40 +0000 (15:52 -0600)] 
rust/nfs: add a maximum number of operations per compound

This is a backport of ea1d03f8e38aca376adcb80b1851b97a0816a5e9 by Pierre
Chifflier adapted for 6.0.x.

> The `count` combinator preallocates a number of bytes. Since the value
> is untrusted, this can result in an Out Of Memory allocation.
> Use a maximum value, large enough to cover all current implementations.

Ticket: #5448

3 years agoreadthedocs: add configuration file 7634/head
Jason Ish [Wed, 20 Jul 2022 19:07:49 +0000 (13:07 -0600)] 
readthedocs: add configuration file

Readthedocs is attempting to use our /requirements.txt file as a Python
requirements file, which it is not. Add a Readthedocs configuration file
to tell it to not use any requirements file.

3 years ago.gitignore: don't ignore *.yaml, just suricata.yaml
Jason Ish [Wed, 20 Jul 2022 19:07:15 +0000 (13:07 -0600)] 
.gitignore: don't ignore *.yaml, just suricata.yaml

3 years agoversion: start development towards 6.0.7
Jason Ish [Wed, 20 Jul 2022 19:12:47 +0000 (13:12 -0600)] 
version: start development towards 6.0.7

3 years agorelease: 6.0.6; update changelog suricata-6.0.6
Jason Ish [Sat, 9 Jul 2022 22:51:17 +0000 (16:51 -0600)] 
release: 6.0.6; update changelog

3 years agooutput: fix integer warnings
Philippe Antoine [Tue, 18 Jan 2022 09:56:48 +0000 (10:56 +0100)] 
output: fix integer warnings

Ticket: 4516

(cherry picked from commit e3180e3248e38311ad56a080233ad1a8d31a623b)

3 years agoprotocol: forbids concurrent protocol upgrades
Philippe Antoine [Fri, 8 Apr 2022 12:40:02 +0000 (14:40 +0200)] 
protocol: forbids concurrent protocol upgrades

Ticket: 5243

When switching from SMTP to TLS, and getting HTTP1 instead of
expected TLS, and HTTP1 requesting upgrade to HTTP2, we do not
overwrite the alproto_orig value so as not to have type confusion
in AppLayerParserStateProtoCleanup

(cherry picked from commit cedffdf14cf1fdd4d551f16c331e5b3e7f0a6927)

3 years agooutput: skip files logging for ICMP packets 7617/head
Philippe Antoine [Mon, 4 Jul 2022 08:30:20 +0000 (10:30 +0200)] 
output: skip files logging for ICMP packets

Ticket: #5408
(cherry picked from commit f8bf5817752f19565f1b7449710d1e6a2a96d00a)