]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
2 years agouserguide/install: add info on ubuntu ppa installs 9345/head
Juliana Fajardini [Tue, 1 Aug 2023 21:42:08 +0000 (18:42 -0300)] 
userguide/install: add info on ubuntu ppa installs

Bringing info that was only in our Redmine wiki to our documentation,
and update package to Suricata-6.0, now that the stable points to
Suricata 7.

Task #6231

(cherry picked from commit 4fd3205bf06a00ccda8affe6631985defec9f56c)

2 years agouserguide/eve: format and reorganize alert section 9318/head 9323/head
Juliana Fajardini [Thu, 22 Dec 2022 23:47:24 +0000 (20:47 -0300)] 
userguide/eve: format and reorganize alert section

The `field action` portion seemed to be comprised of a more generic
section that followed it. Also formatted the section for lines to be
within the character limit.

(cherry picked from commit 9900bdc162cc876151e680ea088f89b54edb038f)

2 years agooutput/drop: add verdict field
Juliana Fajardini [Fri, 28 Jul 2023 18:42:35 +0000 (15:42 -0300)] 
output/drop: add verdict field

Related to
Bug #5464

(cherry picked from commit 0437173848d98812f74a28f283c327178bf500dd)

2 years agooutput/alert: add verdict field
Juliana Fajardini [Wed, 5 Jul 2023 15:52:53 +0000 (12:52 -0300)] 
output/alert: add verdict field

Related to
Bug #5464

(cherry picked from commit 53b8defd793f0f8fe2ca5459822d0e11f3d69929)

2 years agodcerpc: accept ALTER_CONTEXT as a valid request 9304/head
Shivani Bhardwaj [Wed, 26 Jul 2023 09:41:59 +0000 (15:11 +0530)] 
dcerpc: accept ALTER_CONTEXT as a valid request

So far, if only the starting request was a DCERPC request, it would be
considered DCERPC traffic. Since ALTER_CONTEXT is a valid request type,
it should be accepted too.

Reported and patch proposed in the following Redmine ticket by
InterNALXz.

Bug 6191

(cherry picked from commit 8770431986598f195d57e570287c40ee3dec0cfa)

2 years agoexception: fix use of master switch with default
Juliana Fajardini [Wed, 21 Jun 2023 20:54:41 +0000 (17:54 -0300)] 
exception: fix use of master switch with default

If an exception policy wasn't set up individually, use the GetDefault
function to pick one. This will check for the master switch option and
handle 'auto' cases.

Instead of deciding what the auto value should be when we are parsing
the master switch, leave that for when some of the other policies is to
be set via the master switch, when since this can change for specific
exception policies - like for midstream, for instance.

Update exceptions policies documentation to clarify that the default
configuration in IPS when midstream is enabled is `ignore`, not
`drop-flow`.

Bug #6169

(cherry picked from commit e306bc6ecc9f526d02d178c5715e40e493fa8cb6)

2 years agoexception: fix 'auto' for master switch in IDS
Juliana Fajardini [Wed, 14 Jun 2023 23:58:44 +0000 (20:58 -0300)] 
exception: fix 'auto' for master switch in IDS

If the master exception policy was set to 'auto' in IDS mode, instead of
just setting the master switch to the default in this case, which is
'ignore', the engine would switch a warning saying that auto wasn't a
valid config and then set the policy to ignore.

This makes 'auto' work for the master switch in IDS, removes function
for setting IPS option and handles the valid IDS options directly from
the function that parses the master policy, as this was the only place
where the function was still called.

Bug #6149

(cherry picked from commit feb47f9a896b049694f7b5ab40365fab8bbe9d51)

2 years agoexception/policy: minor code cleanup
Victor Julien [Tue, 13 Jun 2023 07:51:48 +0000 (09:51 +0200)] 
exception/policy: minor code cleanup

(cherry picked from commit 479fa609fa03719936d147342551d97797c92623)

2 years agostream/tcp: re-enable midstream-policy usage
Juliana Fajardini [Tue, 30 May 2023 13:41:49 +0000 (10:41 -0300)] 
stream/tcp: re-enable midstream-policy usage

We were always setting it to ignore, due to bug 5825.

The engine will now issue an initialization error if an invalid value
is passed in the configuration file for midstream exception policy.

'pass-packet' or 'drop-packet' are never valid, as the midstream policy
concerns the whole flow, not making sense for just a packet.

If midstream is enabled, only two actual config values are allowed:
'ignore' and 'pass-flow', both in IDS and in IPS mode. In default mode
('auto' or if no policy is defined), midstream-policy is set to
'ignore'. All other values will lead to initialization error.

In IDS mode, 'drop-flow' will also lead to initialization error.

Part of
Bug #5825

(cherry picked from commit 69d3750aaf29940c87797eb49ceef7c385e06f43)

2 years agoexception: extract 'auto' check to function
Juliana Fajardini [Thu, 1 Jun 2023 01:52:48 +0000 (22:52 -0300)] 
exception: extract 'auto' check to function

Part of
Bug #5825

(cherry picked from commit e849afbda14aae690ab7b2b8c0734aaeba490ec9)

2 years agoexception: use mix of logconfig/info/warning
Juliana Fajardini [Thu, 1 Jun 2023 23:33:18 +0000 (20:33 -0300)] 
exception: use mix of logconfig/info/warning

Use a mix of SCLogConfig, Warning and Info.
This mix works as follows: when something unnexpected for the user
happens - for instance, the engine ignoring an invalid config value, we
use warning. For indicating the value for the master switch, which
happens only once, we use Info. For all the other cases, we use
SCLogConfig.

It is possible that SCLogConfig isn't showing at the moment, this is a
possible bug to investigate further.

Related to
Bug #5825

(cherry picked from commit 69311ab02f33c8396babfe810ac5a066c900d31e)

2 years agoexception: parse config values, don't post process
Juliana Fajardini [Wed, 31 May 2023 14:56:43 +0000 (11:56 -0300)] 
exception: parse config values, don't post process

Get the enum values from the config file. Update the new extracted
functions. Post-process the config values based on runmode and policy.
Also handle 'auto' enum value in these.

Related to
Bug #5825

(cherry picked from commit 7f8536b81c59205032676efda62a0b18ff0de224)

2 years agoexception/midstream: parse midstream policy alone
Juliana Fajardini [Mon, 29 May 2023 19:55:00 +0000 (16:55 -0300)] 
exception/midstream: parse midstream policy alone

As the midstream exception policy has its own specific scenarios, have a
dedicated function to parse and process its config values, and check for
midstream enabled when needed.

Related to
Bug #5825

(cherry picked from commit f97af0c0b1916ada6cf860b429e2ccfb5b4a3da2)

2 years agoexception: refactor exception policy parse fn
Juliana Fajardini [Mon, 29 May 2023 18:26:22 +0000 (15:26 -0300)] 
exception: refactor exception policy parse fn

Split up ExceptionPolicyParse to try to improve readability.

Related to
Bug #5825

(cherry picked from commit bf22129a0fc133b3f4f18997fc0d384c4f9d3751)

2 years agouserguide: update exception policy behaviors table
Juliana Fajardini [Mon, 24 Apr 2023 19:42:34 +0000 (16:42 -0300)] 
userguide: update exception policy behaviors table

Some exception policies can only be applied to the triggering packet or
only make sense considering the whole flow. Highlight such cases in the
table showing each exception policy.

Related to
Bug #5825

(cherry picked from commit c0db25d055e095a099d8a23fd2c2023e4af761c4)

2 years agodoc: add midstream scenarios for exception policy
Juliana Fajardini [Tue, 18 Apr 2023 23:09:16 +0000 (20:09 -0300)] 
doc: add midstream scenarios for exception policy

The different interactions between midstream pick-up sessions and the
exception policy can be quite difficult to visualize. Add a section for
that in the userguide.

Related to
Bug #5825

(cherry picked from commit 0c2922f02efe3e785d6ede01581891683007a6f2)

2 years agomisc: fix typos, doc, update copyright years
Juliana Fajardini [Fri, 17 Feb 2023 20:34:09 +0000 (17:34 -0300)] 
misc: fix typos, doc, update copyright years

Updated FlowGetNew documentation, where it said NULL was only returned
in case of error.

(cherry picked from commit f511a4ae3f954a3c55b57a0fdffc0ae22a965dd5)

2 years agodefrag: clean up existing stats counters
Juliana Fajardini [Thu, 30 Mar 2023 13:40:46 +0000 (10:40 -0300)] 
defrag: clean up existing stats counters

7a044a99ee14101fbc removed the lines that incremented these defrag
counters, but kept the entities themselves. This commit removes counters
that we judge too complex to maintain, given the current state of the
code, and re-adds incrementing max_hit (memcap related).

Related to
Task #5816

(cherry picked from commit a37a88dcd5950344fc0b4529f1731c3dab9f0888)

2 years agoexception: in ids mode, only REJECT the packet
Juliana Fajardini [Mon, 5 Jun 2023 16:02:26 +0000 (13:02 -0300)] 
exception: in ids mode, only REJECT the packet

In case of 'EXCEPTION_POLICY_REJECT', we were applying the same behavior
regardless of being in IDS or IPS mode.
This meant that (at least) the 'flow.action' was changed to drop when we
hit an exception policy in IDS mode.

Bug #6109

(cherry picked from commit 8f324e3b3d4137b1092b877e8f0dab42e7c824fd)

2 years agoexceptions: add master switch config option
Juliana Fajardini [Tue, 6 Dec 2022 21:29:34 +0000 (18:29 -0300)] 
exceptions: add master switch config option

This allows all traffic Exception Policies to be set from one
configuration point. All exception policy options are available in IPS
mode. Bypass, pass and auto (disabled) are also available in iDS mode

Exception Policies set up individually will overwrite this setup for the
given traffic exception.

Task #5219

(cherry picked from commit 0d9289014bd8f65c7100e7173f24f5c5ff9de0ac)

2 years agoworkflows: use debug-failed for s-v run 9292/head 9299/head
Shivani Bhardwaj [Wed, 26 Jul 2023 10:02:29 +0000 (15:32 +0530)] 
workflows: use debug-failed for s-v run

2 years agoutil/mime: skip over any invalid char 9289/head
Shivani Bhardwaj [Tue, 11 Jul 2023 09:12:05 +0000 (14:42 +0530)] 
util/mime: skip over any invalid char

For certain edge case handling for spaces, spaces were handled
particularly in the remainder processing functions. Make sure that now
that as per RFC 2045, util-base64 would skip over any invalid char, the
edge cases in MIME processor also be handled the same way.

This completes the work done in e46b033.

Ticket 6135
Ticket 6207

(cherry picked from commit 789353bc1e1aa23d075f16af25df84df00c68682)

2 years agoutil/base64: fix tests for RFC2045
Shivani Bhardwaj [Thu, 30 Mar 2023 08:11:08 +0000 (13:41 +0530)] 
util/base64: fix tests for RFC2045

(cherry picked from commit 49ad38329a3a96ba22e73da38b4594ebf8759ec9)

2 years agoutil/base64: update test macro to use user data
Shivani Bhardwaj [Thu, 30 Mar 2023 07:49:31 +0000 (13:19 +0530)] 
util/base64: update test macro to use user data

(cherry picked from commit c2ae87eecfafe6d46180c207c35c038035fe9c16)

2 years agoutil/base64: check dest buf size to hold 3Bytes
Shivani Bhardwaj [Thu, 30 Mar 2023 07:43:08 +0000 (13:13 +0530)] 
util/base64: check dest buf size to hold 3Bytes

The destination buffer should be able to hold at least 3 Bytes during
the processing of the last block of data. If it cannot hold at least 3
Bytes, then that may lead to dynamic buffer overflow while decoding.

(cherry picked from commit 62d782156caddec0b4ca795d7236c6483d02efff)

2 years agoutil/base64: check for dest buf size in last block
Shivani Bhardwaj [Thu, 30 Mar 2023 07:41:12 +0000 (13:11 +0530)] 
util/base64: check for dest buf size in last block

Just like the check for destination buffer size done previously for
complete data, it should also be done for the trailing data to avoid
goind out of bounds.

(cherry picked from commit 0e8b451699218b3f3430d7614f76cffed7ba991c)

2 years agoutil/base64: fix padding bytes for trailing data
Shivani Bhardwaj [Thu, 30 Mar 2023 07:24:29 +0000 (12:54 +0530)] 
util/base64: fix padding bytes for trailing data

Padding bytes for the last remainder data should be as follows:

Case   |    Remainder bytes     |    Padding
----------------------------------------------
  I    |              1         |      3
  II   |              2         |      2
  III  |              3         |      1

However, we calculate the decoded_bytes with the formula:
decoded_bytes = ASCII_BLOCK - padding

this means for Case I when padding is 3 bytes, the decoded_bytes would
be 0. This is incorrect for any trailing data. In any of the above
cases, if the parsing was successful, there should at least be 1 decoded
byte.

(cherry picked from commit 095c335c72befec2cfcd43390f86d116926bcd17)

2 years agoutil/base64: skip any invalid char for RFC2045
Shivani Bhardwaj [Fri, 17 Mar 2023 12:18:35 +0000 (17:48 +0530)] 
util/base64: skip any invalid char for RFC2045

RFC 2045 states that any invalid character should be skipped over, this
is the RFC used by mime handler in Suricata code to deal with base64
encoded data.
So far, only spaces were skipped as a part of implementation of this
RFC, extend it to also skip over any other invalid character. Add
corresponding test.

(cherry picked from commit e46b0337e50897424d05371aa26d5f20e172f749)

2 years agoutil/base64: add test for long string w RFC4648
Shivani Bhardwaj [Fri, 17 Mar 2023 12:15:32 +0000 (17:45 +0530)] 
util/base64: add test for long string w RFC4648

(cherry picked from commit 85ae1d25e4998d19cb1f7fd714027b3da1c8aa4e)

2 years agodecode: fix offset for DCE layer 9278/head
Philippe Antoine [Fri, 30 Jun 2023 08:45:37 +0000 (10:45 +0200)] 
decode: fix offset for DCE layer

Fixes: 136d351e403b ("decode: single network layer entrypoint")
Ticket: #3637
(cherry picked from commit fdf9cdf40068f00147bb07dd3f41a7556b8de823)

2 years agorust: fix compiler warnings 9277/head
Shivani Bhardwaj [Fri, 21 Jul 2023 12:23:49 +0000 (17:53 +0530)] 
rust: fix compiler warnings

2 years agodetect/multi-tenant: Make tenant_id 32 bits everywhere
Jeff Lucovsky [Wed, 21 Jun 2023 13:09:45 +0000 (09:09 -0400)] 
detect/multi-tenant: Make tenant_id 32 bits everywhere

Issue: 6047

This commit ensures that the tenant id is contained in a unsigned 32 bit
container.

(cherry picked from commit 9fd77c737f4f2d14f0e79df8958c21a3ccb3ed85)

2 years agodecode-ipv6: Set L4 proto on ipv6 incase of GRE decode error
Cole Dishington [Mon, 10 Jul 2023 02:02:18 +0000 (14:02 +1200)] 
decode-ipv6: Set L4 proto on ipv6 incase of GRE decode error

Set the L4 proto before decoding GRE in ipv6 decoding in case there is a
GRE header decoding error.

Bug: #6222
(cherry picked from commit 1b08c561f6f8f5ae3a1f29b68638f9884673fe58)

2 years agorust: lock proc-macro2 to maintain MSRV 9250/head
Victor Julien [Wed, 19 Jul 2023 05:15:46 +0000 (07:15 +0200)] 
rust: lock proc-macro2 to maintain MSRV

2 years agorfb: also set unimplemented auth types 9235/head 9249/head
Sascha Steinbiss [Fri, 30 Jun 2023 08:16:45 +0000 (10:16 +0200)] 
rfb: also set unimplemented auth types

(cherry picked from commit 1521b77edd04921a9b5f9419f84c62a812315e7a)

2 years agorfb: ensure logging of incompletely parsed txs
Sascha Steinbiss [Thu, 29 Jun 2023 22:20:12 +0000 (00:20 +0200)] 
rfb: ensure logging of incompletely parsed txs

(cherry picked from commit 1606aca881c5ba1c2cccbbe0de78530d47a4d8a1)

2 years agorfb: never return error on unknown traffic
Sascha Steinbiss [Fri, 9 Jun 2023 09:13:35 +0000 (11:13 +0200)] 
rfb: never return error on unknown traffic

We only try to parse a small subset of what is possible in
RFB. Currently we only understand some standard auth schemes
and stop parsing when the server-client handshake is complete.
Since in IPS mode returning an error from the parser causes
drops that are likely uncalled for, we do not want to return
errors when we simply do not understand what happens in the
traffic. This addresses Redmine #5912.

Bug: #5915.
(cherry picked from commit 1f8a5874fbc6816a7aeb59ba668ebd2bf7c206ed)

2 years agorfb: add myself as contributor
Sascha Steinbiss [Fri, 9 Jun 2023 09:12:24 +0000 (11:12 +0200)] 
rfb: add myself as contributor

(cherry picked from commit 836fff3679e6ea3b2ed75f87931ff3c7ec0ebd33)

2 years agorfb: be more strict parsing the version
Sascha Steinbiss [Fri, 9 Jun 2023 09:12:02 +0000 (11:12 +0200)] 
rfb: be more strict parsing the version

(cherry picked from commit bd1fbf392e04e0bfc4b8f7e680636ddee0a47c60)

2 years agorequirements: use libhtp 0.5.45
Victor Julien [Wed, 12 Jul 2023 17:31:00 +0000 (19:31 +0200)] 
requirements: use libhtp 0.5.45

(cherry picked from commit ce055111fe98d57d7e1c07e42abdd04a2f7d5319)

2 years agorequirements: suricata-update 1.2.8 9204/head
Jason Ish [Fri, 7 Jul 2023 18:05:43 +0000 (12:05 -0600)] 
requirements: suricata-update 1.2.8

2 years agodoc/devguide: language fix for sphinx
Jason Ish [Fri, 7 Jul 2023 18:34:48 +0000 (12:34 -0600)] 
doc/devguide: language fix for sphinx

Newer Sphinx does not allow a language of none, set to "en" like we do
for the user guide.

2 years agooutput/file: http2 metdata is logged in http object
Philippe Antoine [Fri, 16 Jun 2023 14:22:29 +0000 (16:22 +0200)] 
output/file: http2 metdata is logged in http object

as is done for http2 events and alerts.
The http.version integer can help to determine if this is HTTP2

Ticket: #6165
(cherry picked from commit 4f4651e360edf2916a648356db2e16ef1d560f7c)

2 years agoci: fix macos build with libhtp libiconv
Philippe Antoine [Thu, 6 Jul 2023 08:30:01 +0000 (10:30 +0200)] 
ci: fix macos build with libhtp libiconv

2 years agoci: update to macos latest
Philippe Antoine [Mon, 3 Jul 2023 13:23:19 +0000 (15:23 +0200)] 
ci: update to macos latest

(cherry picked from commit e1e03c25c9c4289e10bbcadd0fd86ab41a3e4003)

2 years agotls: update x509 crate to v0.8
Philippe Antoine [Fri, 30 Jun 2023 07:00:49 +0000 (09:00 +0200)] 
tls: update x509 crate to v0.8

Ticket: #5439

Fixes cetificate parsing without issuer, and do not require an
update to MSRV.

2 years agosmb: fix wrong data offset when wct = 12 9173/head
Lancer Cheng [Mon, 22 May 2023 09:16:34 +0000 (09:16 +0000)] 
smb: fix wrong data offset when wct = 12

Bug: #6008
(cherry picked from commit 000eb91078d5ca88ee93006340d7e68f97ade4bc)

2 years agodoc: fix typo encryption-handling 9139/head
Shivani Bhardwaj [Mon, 26 Jun 2023 11:42:18 +0000 (17:12 +0530)] 
doc: fix typo encryption-handling

(cherry picked from commit aeb408dd9dbf7d3f7b4af0f77c3a16fd45c56d39)

2 years agosuricatasc: Don't process empty cmds
Shivani Bhardwaj [Fri, 23 Jun 2023 06:38:25 +0000 (12:08 +0530)] 
suricatasc: Don't process empty cmds

(cherry picked from commit 6b3dbaa2f257a82171e14cd9a64bc3aaac006501)

2 years agosuricatasc: exit successfully on keyboardinterrupt
Shivani Bhardwaj [Fri, 23 Jun 2023 06:28:05 +0000 (11:58 +0530)] 
suricatasc: exit successfully on keyboardinterrupt

(cherry picked from commit 84ffe928730b283879edc1711dfbbaaed6d1dc29)

2 years agosuricatasc: add line numbers in error messages
Shivani Bhardwaj [Fri, 23 Jun 2023 06:27:21 +0000 (11:57 +0530)] 
suricatasc: add line numbers in error messages

(cherry picked from commit a512338afdbec725a8182225c30867d707401a98)

2 years agosuricatasc: handle exceptions in caller
Shivani Bhardwaj [Thu, 22 Jun 2023 12:21:05 +0000 (17:51 +0530)] 
suricatasc: handle exceptions in caller

(cherry picked from commit 46ce371d9c550ea840cb946b06c5614569ca98fa)

2 years agosuricatasc: handle exceptions interactive mode
Shivani Bhardwaj [Thu, 22 Jun 2023 08:17:37 +0000 (13:47 +0530)] 
suricatasc: handle exceptions interactive mode

(cherry picked from commit b42a584f4dccd5c96a829d07b8a35185542f384c)

2 years agodetect: Fix FTP bounce detection IP address comparison
Cole Dishington [Sun, 14 May 2023 20:03:23 +0000 (08:03 +1200)] 
detect: Fix FTP bounce detection IP address comparison

Fix the FTP bounce IP address comparison by only converting the IP
parsed from the FTP payload to network order.

Bug: #6087
(cherry picked from commit 746fb50d58c5adc5668f15537469d6dda9e7ba4d)

2 years agogithub-ci: allow pull request URL in SV_BRANCH 9124/head 9129/head
Jason Ish [Wed, 28 Jun 2023 18:32:35 +0000 (12:32 -0600)] 
github-ci: allow pull request URL in SV_BRANCH

Allow the SV_BRANCH variable to contain the full link to an
OISF/suricata-verify pull request. This will cause GitHub to create a
cross-link for us.

(cherry picked from commit f870dcd4cc1c72cdf5faf790a1582347ed87ab9f)

2 years agopcap-log: close pcap_dead_handle on close
Jason Ish [Wed, 28 Jun 2023 17:06:24 +0000 (11:06 -0600)] 
pcap-log: close pcap_dead_handle on close

Fixes leaked handle on exit.

(cherry picked from commit 8511ef5e2db4484424bc7cde058d57b8401e5005)

2 years agolog-pcap: one time errors on file open
Jason Ish [Tue, 27 Jun 2023 16:52:39 +0000 (10:52 -0600)] 
log-pcap: one time errors on file open

If compression was not enabled, the open error was actually suppressed
by default by only being logged at info level, however with
compression it was logged as an error. As opening is retried as long
as it fails to open, make both log as error but wrap in a flag so the
error is logged once until success.

(cherry picked from commit d2a5a55e0a99dee21a2a148647397bc02831ed78)

2 years agolog-pcap: only open dumper after successful file open (lz4)
Jason Ish [Tue, 27 Jun 2023 16:25:24 +0000 (10:25 -0600)] 
log-pcap: only open dumper after successful file open (lz4)

When LZ4 compression is enabled, open the dumper after successful open
of the file. The dump handle is what forms the check if opening the
file needs to be retried.

Ticket: #5022

(cherry picked from commit bf589f081287b71849658c6325fc50d209c60d20)

2 years agomime: compute full body md5 9120/head
Philippe Antoine [Fri, 16 Jun 2023 13:28:38 +0000 (15:28 +0200)] 
mime: compute full body md5

Previously, the problem was that nested headers/boundaries were not
used to compute the hash

Solution is to move up the call to the hash computation from
ProcessMimeBody to its caller ProcessMimeEntity, and add a set of
conditions to ensure that we are not in the principal headers.

Ticket: #6185
(cherry picked from commit a3168fda787d4f4eee45f5c84bcc1709f207ae0a)

2 years agosmtp: avoid counting last eol in file
Philippe Antoine [Thu, 22 Jun 2023 13:21:18 +0000 (15:21 +0200)] 
smtp: avoid counting last eol in file

As it is part of the boundary

Ticket: #6023

On the way, look for urls even on incomplete lines

(cherry picked from commit 2a768dfa9520c15116c11bea1d96c6ce17b8343c)

2 years agoeve/alert: warn on obsolete flags 9087/head
Jason Ish [Mon, 26 Jun 2023 16:57:00 +0000 (10:57 -0600)] 
eve/alert: warn on obsolete flags

Log a warning on obsolete flags. If the flag is to enable, do the
enable. But do not honor disable flags, as these could override the
new settings and cause hard to debug issues.

Ticket: #6175

2 years agodetect/http2: warning that http2.header is removed
Philippe Antoine [Mon, 12 Jun 2023 19:55:25 +0000 (21:55 +0200)] 
detect/http2: warning that http2.header is removed

in Suricata 7

Ticket: #5780

2 years agodcerpc: maximum number of live transactions also for UDP
Philippe Antoine [Thu, 8 Jun 2023 12:25:01 +0000 (14:25 +0200)] 
dcerpc: maximum number of live transactions also for UDP

Ticket: #6129

Avoids that quadratic complexity gets too bad

(cherry picked from commit d40dca5e55286c57e9a83018975022c4f08bf6d1)

2 years agobpf: remove OpenBSD guards
Victor Julien [Fri, 16 Jun 2023 09:41:57 +0000 (11:41 +0200)] 
bpf: remove OpenBSD guards

libpcap bpf functions are supported now.

(cherry picked from commit 643e674cb216b3824fd5a3f4dd2d9f69847fc431)

2 years agopcap: fix reopen logic
Victor Julien [Thu, 18 May 2023 21:18:18 +0000 (23:18 +0200)] 
pcap: fix reopen logic

Bug: #6081.
(cherry picked from commit ab667d4d192a8b78dc436e65dd34ddfb028312f1)

2 years agopcap: free per thread resources
Victor Julien [Thu, 18 May 2023 06:03:31 +0000 (08:03 +0200)] 
pcap: free per thread resources

Bug: #4750.
(cherry picked from commit 3049151bc2ec593b8d028a6aae675019b3bf4032)

2 years agopcap/file: minor code cleanup
Victor Julien [Sat, 13 May 2023 05:58:43 +0000 (07:58 +0200)] 
pcap/file: minor code cleanup

(cherry picked from commit 6c1408c3c2bac7d76300a5a5f91b5c2cee5586df)

2 years agoversion: start development towards 6.0.14
Victor Julien [Tue, 27 Jun 2023 14:21:47 +0000 (16:21 +0200)] 
version: start development towards 6.0.14

2 years agorelease: 6.0.13; update changelog suricata-6.0.13
Shivani Bhardwaj [Thu, 15 Jun 2023 05:47:01 +0000 (11:17 +0530)] 
release: 6.0.13; update changelog

2 years agodoc/userguide: start on a security chapter
Jason Ish [Wed, 14 Jun 2023 14:58:56 +0000 (08:58 -0600)] 
doc/userguide: start on a security chapter

This is the start of a security consideration chapter, starting with
directions on how to run Suricata as a non-root user.

2 years agodoc/userguide: dataset upgrade notes
Jason Ish [Tue, 6 Jun 2023 23:13:57 +0000 (17:13 -0600)] 
doc/userguide: dataset upgrade notes

2 years agoconfig: uncomment datasets configuration
Jason Ish [Tue, 6 Jun 2023 22:23:57 +0000 (16:23 -0600)] 
config: uncomment datasets configuration

Uncomment the datasets configuration for easier editing by users.  The
values are left commented out as their defaults.

2 years agodatasets: flag to disable "write" actions
Jason Ish [Tue, 6 Jun 2023 22:04:56 +0000 (16:04 -0600)] 
datasets: flag to disable "write" actions

Add a new configuration flag, "datasets.rules.allow-write" to control
if rules can contain "save" or "state" rules which allow write access
to the file system.

Ticket: #6123

2 years agoinstall: create runtime data directory
Jason Ish [Tue, 6 Jun 2023 21:32:18 +0000 (15:32 -0600)] 
install: create runtime data directory

On installation, make sure the data directory is created. This will
usually be /var/lib/suricata/data, but otherwise follows the
autoconf/automake instructions.

This directory is for runtime state information, which for now is
datasets but may be expanded in the future.  Suricata already expects
this directory to exist for "state" and "save" datasets, but it has
been up to the user to create it.

2 years agodatasets: don't allow absolute or paths with directory traversal
Jason Ish [Tue, 23 May 2023 21:17:59 +0000 (15:17 -0600)] 
datasets: don't allow absolute or paths with directory traversal

For dataset filenames coming from rules, do not allow filenames that
are absolute or contain a directory traversal with "..". This prevents
datasets from escaping the define data-directory which may allow a bad
rule to overwrite any file that Suricata has permission to write to.

Add a new configuration option,
"datasets.rules.allow-absolute-filenames" to allow absolute filenames
in dataset rules. This will be a way to revert back to the pre 6.0.13
behavior where save/state rules could use any filename.

Ticket: #6118

2 years agodoc/userguide: notes about Lua rules being disabled by default
Jason Ish [Mon, 12 Jun 2023 17:42:59 +0000 (11:42 -0600)] 
doc/userguide: notes about Lua rules being disabled by default

2 years agolua: disable lua rules by default
Jason Ish [Wed, 7 Jun 2023 22:35:53 +0000 (16:35 -0600)] 
lua: disable lua rules by default

To protect against possible supply chain attacks, disable Lua rules by
default. They can be enabled under the "security" section of
suricata.yaml.

Ticket: #6122

2 years agosmtp: handle long lines per direction
Shivani Bhardwaj [Tue, 23 May 2023 04:41:38 +0000 (10:11 +0530)] 
smtp: handle long lines per direction

Issue:
Currently, while handling of long lines, if the line exceeded the limit,
we'd set a variable state->discard_till_lf which will be reset in the
later stages based on the data that arrives. However, because there was
one variable per state, this meant that a later stage in the other
direction could also modify it which is incorrect.

Fix:
Use separate variables for each direction.

Bug 6053

2 years agosmtp: handle following cmd if LF was found in long line
Shivani Bhardwaj [Sat, 6 May 2023 11:46:30 +0000 (17:16 +0530)] 
smtp: handle following cmd if LF was found in long line

If a long line had LF post the limit, it should be considered complete
and not wait for the next line to complete it. However, currently, any
following lines were skipped which could sometimes also be important
commands for the entire transaction.

Fix this by setting a flag in case we're truncating a long line but
after having found the LF character.

Bug 5989

2 years agosmtp: add function docs
Shivani Bhardwaj [Tue, 30 May 2023 07:20:57 +0000 (12:50 +0530)] 
smtp: add function docs

2 years agosmtp: handle DATA mode in middle of input parsing
Shivani Bhardwaj [Tue, 4 Apr 2023 06:32:03 +0000 (12:02 +0530)] 
smtp: handle DATA mode in middle of input parsing

Before:
If the input was such that we'd enter DATA mode in the middle, the
entire data would be passed through SMTPGetLine fn and be processed with
line limits etc in place.

After:
Since we don't want any limits to be enforced on DATA, we pass it to
SMTPPreProcessCommands fn to take care of it differently from the
commands.

Bug 5981

2 years agogithub-ci: check for suricata-update example configuration files 9024/head
Jason Ish [Thu, 8 Jun 2023 18:26:53 +0000 (12:26 -0600)] 
github-ci: check for suricata-update example configuration files

Check that the Suricata-Update example configuration files are
installed.

(cherry picked from commit 6d7923c80b4ed68b5c25ceeb9615535313cf0b71)

2 years agosuricata-update: install sample configuration files
Jason Ish [Thu, 8 Jun 2023 18:23:05 +0000 (12:23 -0600)] 
suricata-update: install sample configuration files

With the move to installing Suricata-Update files from Suricata
Makefile's, the sample configuration files were forgotten.

Ticket: #6132
(cherry picked from commit b8071a9eb0b1882178f7280936d6df577945232d)

2 years agodecode-ipv6: Set IPv6 proto incase of ext header parsing error 9023/head
Cole Dishington [Wed, 24 May 2023 00:39:33 +0000 (12:39 +1200)] 
decode-ipv6: Set IPv6 proto incase of ext header parsing error

Set the IPv6 packet proto before parsing the ext headers, similar to
decode-ipv4, incase of an ext header parsing error. Otherwise
rule decode-events are not triggered for packets encapsulated in IPv6.

Bug: #6086.
(cherry picked from commit 531d99f4cf3f7929ef5e972641d2f347c966b979)

2 years agodetect/byte-math: Support multiplication operator
Jeff Lucovsky [Thu, 18 May 2023 12:53:59 +0000 (08:53 -0400)] 
detect/byte-math: Support multiplication operator

Issue: 6070

This commit adds support for the multiplication operator to byte-math.
The regex for parsing the keyword options was missing the `*` character.

2 years agodcerpc: convert transaction list to vecdeque for UDP 9007/head
Philippe Antoine [Wed, 24 Aug 2022 08:24:51 +0000 (10:24 +0200)] 
dcerpc: convert transaction list to vecdeque for UDP

As was done for TCP in dfe76bb90 and d745d28d4

Ticket: #5518
(cherry picked from commit bf43011a43a6d542ab2f85aa61986340ed8254c8)

2 years agodcerpc: convert transaction list to vecdeque
Jason Ish [Mon, 2 May 2022 18:19:51 +0000 (12:19 -0600)] 
dcerpc: convert transaction list to vecdeque

Allows for more efficient removal from front of the list.

Ticket: #5271
(cherry picked from commit dfe76bb905409bf91345e972f2ab157bda51f003)

2 years agotemplate(rust): convert transaction list to vecdeque
Jason Ish [Wed, 27 Apr 2022 16:16:02 +0000 (10:16 -0600)] 
template(rust): convert transaction list to vecdeque

Allows for more efficient removal from front of the list.

Ticket: #5298
(cherry picked from commit e319d31c148a349e93bed2a68787684e39364d17)

2 years agohttp2: convert transaction list to vecdeque
Jason Ish [Wed, 27 Apr 2022 15:38:51 +0000 (09:38 -0600)] 
http2: convert transaction list to vecdeque

Allows for more efficient removal from front of the list.

Ticket: #5296
(cherry picked from commit 2db84726ad3445a0b55ca145489103483f61c6b0)

2 years agordp: convert transaction list to vecdeque
Jason Ish [Wed, 27 Apr 2022 15:29:30 +0000 (09:29 -0600)] 
rdp: convert transaction list to vecdeque

Allows for more efficient removal from front of the list.

Ticket: #5295
(cherry picked from commit 4e0ad5e0bd4584d625ad122f0c33908abb17e7a4)

2 years agodns: convert transaction list to vecdeque
Jason Ish [Tue, 26 Apr 2022 19:25:40 +0000 (13:25 -0600)] 
dns: convert transaction list to vecdeque

Allows for more efficient removal from front of the list.

Ticket: #5277
(cherry picked from commit 31894147884af3e7151b4d653e5268a0b0477db8)

2 years agosmb: convert transaction list to vecdeque
Philippe Antoine [Tue, 13 Dec 2022 08:09:44 +0000 (09:09 +0100)] 
smb: convert transaction list to vecdeque

Allows for more efficient removal from front of the list.

Ticket: #5753
(cherry picked from commit 1d9183638f930e8e0f22c421ee0ef9fde043106a)

2 years agohttp2: avoid quadratic complexity in headers 9003/head
Philippe Antoine [Wed, 31 May 2023 12:53:28 +0000 (14:53 +0200)] 
http2: avoid quadratic complexity in headers

When adding an element to the dynamic headers table, the oldest
ones may get evicted. When multiple elements get evicted, they
should get evicted all at once with drain, instead of one by one
as there will be a massive move each time.

Ticket: #6103
(cherry picked from commit 635073688289aa9a4928f78cdfd1777ae21f7d40)

2 years agodns: split header and body parsing 8995/head
Jason Ish [Wed, 21 Dec 2022 15:35:19 +0000 (09:35 -0600)] 
dns: split header and body parsing

As part of extra header validation, split out DNS body parsing to
avoid the overhead of parsing the header twice.

(cherry picked from commit d720ead470bcb5dd5a0c0ae7db302ab170205ee6)

2 years agodns: validate header on every incoming message
Jason Ish [Wed, 21 Dec 2022 01:30:29 +0000 (19:30 -0600)] 
dns: validate header on every incoming message

As UDP streams getting probed, a stream that does not appear to be DNS
at first, may have a single packet that does look close enough to DNS
to be picked up as DNS causing every subsequent packet to result in a
parser error.

To mitigate this, probe every incoming DNS message header for validity
before continuing onto the body.  If the header doesn't validate as
DNS, just ignore the packet so no parse error is registered.

(cherry picked from commit 595700ab7e9dc9d12d46cf4d6833a86840decdf9)

2 years agodns: parse and alert on invalid opcodes
Jason Ish [Wed, 21 Dec 2022 01:17:38 +0000 (19:17 -0600)] 
dns: parse and alert on invalid opcodes

Accept DNS messages with an invalid opcode that are otherwise
valid. Such DNS message will create a parser event.

This is a change of behavior, previously an invalid opcode would cause
the DNS message to not be detected or parsed as DNS.

Issue: #5444
(cherry picked from commit c98c49d4bad413dbbe4e21a48ebf37260ee5cc8e)

2 years agodns: mark test buffers with rustfmt::skip
Jason Ish [Wed, 21 Dec 2022 15:01:15 +0000 (09:01 -0600)] 
dns: mark test buffers with rustfmt::skip

(cherry picked from commit 39d2524bf6d57658b532c73ceb4def34ed9e2c8a)

2 years agocounters: make tcp stats independent of flow, ssn
Victor Julien [Tue, 25 Apr 2023 08:09:27 +0000 (10:09 +0200)] 
counters: make tcp stats independent of flow, ssn

Counters depended on availability of flow and tcp session, meaning
that 2 memcaps could affect the counters.

Bug: #5017.
(cherry picked from commit 36f6e0515592812259fb327d529740a030dba98e)

2 years agostream: update no-flow checks
Victor Julien [Tue, 25 Apr 2023 08:22:11 +0000 (10:22 +0200)] 
stream: update no-flow checks

(cherry picked from commit 0360cb654293c333e3be70204705fa7ec328512e)

2 years agowindows: add -lntdll to Windows builds
Jason Ish [Wed, 7 Jun 2023 15:22:32 +0000 (09:22 -0600)] 
windows: add -lntdll to Windows builds

Rust 1.70 has introduced some possible issues between LLVM and gcc
causing link errors that are fixed by explicitly adding -lntdll.

Thanks to https://github.com/extendr/rextendr/pull/285 for the fix.