]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
3 years agorust/ntp: upgrade dependency on ntp-parser 6974/head
Pierre Chifflier [Wed, 12 Jan 2022 09:50:42 +0000 (10:50 +0100)] 
rust/ntp: upgrade dependency on ntp-parser

3 years agogithub: bump MSRV and minimum known version 6971/head
Victor Julien [Thu, 10 Feb 2022 11:46:31 +0000 (12:46 +0100)] 
github: bump MSRV and minimum known version

3 years agogithub: remove xenial build
Victor Julien [Thu, 10 Feb 2022 11:41:55 +0000 (12:41 +0100)] 
github: remove xenial build

3 years agorust/ike: convert parser to nom7 functions and upgrade dependency
Pierre Chifflier [Wed, 12 Jan 2022 13:12:26 +0000 (14:12 +0100)] 
rust/ike: convert parser to nom7 functions and upgrade dependency

3 years agorust/rfb: convert parser to nom7 functions
Pierre Chifflier [Wed, 19 Jan 2022 10:16:40 +0000 (11:16 +0100)] 
rust/rfb: convert parser to nom7 functions

3 years agocodecov: fix informational; disable github annotations 6962/head
Victor Julien [Wed, 9 Feb 2022 14:33:48 +0000 (15:33 +0100)] 
codecov: fix informational; disable github annotations

3 years agoapp-layer: fix counter setup logic 6958/head
Victor Julien [Wed, 9 Feb 2022 07:31:01 +0000 (08:31 +0100)] 
app-layer: fix counter setup logic

Completes 0ccf5b914766335425d262de7f69b959c527329c

3 years agoframes: address coverity issue
Victor Julien [Wed, 9 Feb 2022 07:23:19 +0000 (08:23 +0100)] 
frames: address coverity issue

Minor cleanups to assist coverity.

Bug: #5065.

3 years agodetect-bytetest: remove unittests 6956/head
Modupe Falodun [Mon, 7 Feb 2022 21:50:37 +0000 (22:50 +0100)] 
detect-bytetest: remove unittests

These tests are reimplemented as Suricata-Verify

Task: 4911

3 years agocodecov: set to informational 6947/head
Victor Julien [Mon, 7 Feb 2022 19:10:31 +0000 (20:10 +0100)] 
codecov: set to informational

3 years agoci: formatting errors are now fatal
Victor Julien [Tue, 1 Feb 2022 16:19:38 +0000 (17:19 +0100)] 
ci: formatting errors are now fatal

3 years agosip: enable for 5061/udp
Victor Julien [Sun, 23 Jan 2022 07:07:24 +0000 (08:07 +0100)] 
sip: enable for 5061/udp

3 years agosip: add frames support
Victor Julien [Tue, 8 Feb 2022 08:52:35 +0000 (09:52 +0100)] 
sip: add frames support

Frames:
- sip.pdu
- sip.request_line
- sip.response_line
- sip.request_headers
- sip.response_headers
- sip.request_body
- sip.response_body

The `sip.pdu` frame is always created, the rest only if the record
parser succeeded.

Ticket: #5036.

3 years agoframes: support UDP frames
Victor Julien [Fri, 21 Jan 2022 14:20:51 +0000 (15:20 +0100)] 
frames: support UDP frames

UDP frames point to the UDP packet payloads.

The frames are removed after each packet.

Ticket: #4983.

3 years agooutput/file: remove 'waldo' code 6935/head
Victor Julien [Sat, 5 Feb 2022 16:32:15 +0000 (17:32 +0100)] 
output/file: remove 'waldo' code

It was no longer used after "file-store v1" was removed.

3 years agofile/store: warning grammer fixup
Victor Julien [Sat, 5 Feb 2022 16:24:21 +0000 (17:24 +0100)] 
file/store: warning grammer fixup

3 years agohtp: rearrange tx user data for more efficiency
Victor Julien [Tue, 30 Mar 2021 14:08:36 +0000 (16:08 +0200)] 
htp: rearrange tx user data for more efficiency

3 years agooutput/lua: minor cleanups
Victor Julien [Sun, 6 Feb 2022 12:56:35 +0000 (13:56 +0100)] 
output/lua: minor cleanups

3 years agooutput/streaming: use unique thread data name
Victor Julien [Sun, 6 Feb 2022 12:54:09 +0000 (13:54 +0100)] 
output/streaming: use unique thread data name

3 years agooutput/stats: use unique thread data name
Victor Julien [Sun, 6 Feb 2022 12:53:05 +0000 (13:53 +0100)] 
output/stats: use unique thread data name

3 years agooutput/packet: use unique thread data name
Victor Julien [Sun, 6 Feb 2022 12:51:57 +0000 (13:51 +0100)] 
output/packet: use unique thread data name

3 years agooutput/filedata: use unique thread data name
Victor Julien [Sun, 6 Feb 2022 12:50:07 +0000 (13:50 +0100)] 
output/filedata: use unique thread data name

3 years agooutput/file: use unique thread data name
Victor Julien [Sun, 6 Feb 2022 12:45:58 +0000 (13:45 +0100)] 
output/file: use unique thread data name

3 years agooutput/tx: use unique thread data name
Victor Julien [Sun, 6 Feb 2022 12:42:36 +0000 (13:42 +0100)] 
output/tx: use unique thread data name

3 years agooutput: minor header cleanups
Victor Julien [Sun, 6 Feb 2022 12:32:25 +0000 (13:32 +0100)] 
output: minor header cleanups

3 years agooutput: declare OutputLoggerThreadStore once
Victor Julien [Sun, 6 Feb 2022 07:06:39 +0000 (08:06 +0100)] 
output: declare OutputLoggerThreadStore once

3 years agoapp-layer: fix error counter logic
Victor Julien [Fri, 4 Feb 2022 09:29:03 +0000 (10:29 +0100)] 
app-layer: fix error counter logic

3 years agogithub: enable dependabot for Rust/cargo 6925/head
Victor Julien [Thu, 3 Feb 2022 22:02:38 +0000 (23:02 +0100)] 
github: enable dependabot for Rust/cargo

3 years agodetect-uricontent: convert unittests to FAIL/PASS APIs 6924/head
Modupe Falodun [Wed, 2 Feb 2022 19:21:24 +0000 (20:21 +0100)] 
detect-uricontent: convert unittests to FAIL/PASS APIs

3 years agodetect-uricontent: remove unittests
Modupe Falodun [Wed, 2 Feb 2022 18:52:49 +0000 (19:52 +0100)] 
detect-uricontent: remove unittests

These tests are reimplemented as Suricata-verify

Task: 4911

3 years agodetect-engine-enip: remove unittests
Modupe Falodun [Tue, 1 Feb 2022 22:24:05 +0000 (23:24 +0100)] 
detect-engine-enip: remove unittests

These test is reimplemented in Suricata-Verify

Task: 4911

3 years agoapp-layer: error counters
Victor Julien [Tue, 9 Nov 2021 12:45:54 +0000 (13:45 +0100)] 
app-layer: error counters

Per app-layer error counters for:
gap, parser, internal (AppLayerResult issues), alloc

3 years agoflow/manager: remove dead code
Victor Julien [Thu, 11 Nov 2021 12:28:44 +0000 (13:28 +0100)] 
flow/manager: remove dead code

3 years agostream: remove unused defines
Victor Julien [Thu, 25 Nov 2021 07:23:24 +0000 (08:23 +0100)] 
stream: remove unused defines

3 years agodoc: refresh main README; more accurate CI description 6911/head
Victor Julien [Tue, 1 Feb 2022 06:44:24 +0000 (07:44 +0100)] 
doc: refresh main README; more accurate CI description

3 years agodetect-dce-opnum: remove unittests
Modupe Falodun [Mon, 31 Jan 2022 21:53:27 +0000 (22:53 +0100)] 
detect-dce-opnum: remove unittests

These tests are reimplemented in Suricata-Verify

Task: 4911

3 years agodevguide: move image generation into sphinx setup
Jason Ish [Mon, 31 Jan 2022 18:06:55 +0000 (12:06 -0600)] 
devguide: move image generation into sphinx setup

While ReadTheDocs can't execute arbitrary scripts, we can install
mscgen in the container that builds the docs (see .readthedocs.yaml).

Then instead of calling generate-images.sh from the Makefile, move this
into the setup function defined on conf.yaml, which will generate the
scripts as part of a normal Sphinx workflow.

This should give us an image generation solution that works on
ReadTheDocs, and locally within anyones build system provided they have
mscgen installed.

3 years agosmtp: check if we have a current transaction
Philippe Antoine [Tue, 25 Jan 2022 20:10:37 +0000 (21:10 +0100)] 
smtp: check if we have a current transaction

Ticket: 4948

This is not the perfect solution, but it prevents to trigger
the assert, and keep the assert.
A better solution would need to create transaction from
the reponse parsing, in case a later command was buffered and
not answered. But this would not be enough as NoNewTx prevents
the creation of a new transaction for RSET...

3 years agodoc: suricata.yaml fields about maximum transactions
Philippe Antoine [Thu, 13 Jan 2022 15:05:46 +0000 (16:05 +0100)] 
doc: suricata.yaml fields about maximum transactions

For HTTP2, MQTT and FTP.

3 years agoftp: limits the number of active transactions per flow
Philippe Antoine [Thu, 13 Jan 2022 14:51:04 +0000 (15:51 +0100)] 
ftp: limits the number of active transactions per flow

Ticket: 4530

As for HTTP2 and MQTT.
In FTP case, transactions are pipelined, not identified by an id.
So, there are less chances of DOS by quadratic complexity.

3 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.

3 years agohttp2: makes some settings configurable
Philippe Antoine [Thu, 6 Jan 2022 15:04:17 +0000 (16:04 +0100)] 
http2: makes some settings configurable

max-streams and max-table-size

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

3 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

3 years agohttp2: limits the number of active transactions per flow
Philippe Antoine [Thu, 2 Dec 2021 08:54:05 +0000 (09:54 +0100)] 
http2: 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 stream id over the ever growing list
of active streams

3 years agofuzz: target for applayer cleans transactions
Philippe Antoine [Thu, 17 Jun 2021 13:02:30 +0000 (15:02 +0200)] 
fuzz: target for applayer cleans transactions

Ticket: 4530

Otherwise, we timeout because we kept too many of them
as Suricata would not

3 years agosrc: use bool instead of int 6907/head
Aaron Bungay [Mon, 1 Mar 2021 02:41:13 +0000 (02:41 +0000)] 
src: use bool instead of int

3 years agosmtp/mime: configurable url scheme extraction
Aaron Bungay [Sun, 19 Apr 2020 22:22:18 +0000 (18:22 -0400)] 
smtp/mime: configurable url scheme extraction

Parse extract-url-schemes from the mime config.
e.g. 'extract-urls-schemes: [http, https, ftp, mailto]'
Update MimeDecConfig struct to new url extraction fields.
Change app-layer-smtp.c & util-decode-mime.c to initialize new struct
fields for MimeDecConfig.
Sets the default value for extract-url-schemes if not found in the
config to 'extract-urls-schemes: [http]' for backwards compatibility.

Uses the schemes defined in the mime config value for
extract-urls-schemes to search for URLS starting with those scheme
names followed by "://".
Logs the URLS with the scheme + '://' at the start if the
log-url-scheme is set in the mime config, otherwise the old behaviour
is reverted to and the urls are logged with the schemes stripped.

Removed unused constant URL_STR now that URLS are being searched for
using extract-urls-schemes mime config values instead of just URL's
starting with 'http://'.

Added commented out new options for extract-urls-schemes and
log-url-scheme to suricata.yaml.in.

Update FindUrlStrings comments.
Remove old outdated comments/commented code from FindUrlStrings.
Update test case for mime which now needs schemes list to be set.
Add Test Cases for FindUrlStrings() method.

Feature: #2054

3 years agogithub-ci: replace failing CentOS 8 by AlmaLinux 8.4 6903/head
Victor Julien [Mon, 31 Jan 2022 10:42:10 +0000 (11:42 +0100)] 
github-ci: replace failing CentOS 8 by AlmaLinux 8.4

3 years agodetect-flowbits: remove unittests
Modupe Falodun [Sun, 30 Jan 2022 14:06:09 +0000 (15:06 +0100)] 
detect-flowbits: remove unittests

These tests are reimplemented in Suricata-Verify

Task: 4911

3 years agomqtt: parse properties with the right buffer's length
Philippe Antoine [Sun, 23 Jan 2022 20:30:22 +0000 (21:30 +0100)] 
mqtt: parse properties with the right buffer's length

3 years agohttp2: event for variable-length integer overflow
Philippe Antoine [Tue, 25 Jan 2022 08:01:54 +0000 (09:01 +0100)] 
http2: event for variable-length integer overflow

http2_parse_var_uint can overflow the variable-length
integer it is decoding. In this case, it now returns an error
of kind LengthValue.

The new function http2_parse_headers_blocks, which factorizes
the code loop for headers, push promise, and continuation, will
check for this specific error, and instead of erroring itself,
will return the list of so far parsed headers, plus another one
with HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeIntegerOverflow

This status is then checked by process_headers to create an
app-layer event.

3 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

3 years agogithub-ci: update commit and formatting containers 6894/head
Jason Ish [Thu, 27 Jan 2022 17:20:31 +0000 (11:20 -0600)] 
github-ci: update commit and formatting containers

Update the Ubuntu containers for the commit and formatting checks to
Ubuntu 20.04.

The latest version of the checkout action requires git v2.18 in order to
checkout the code as a git repo, which is required for these workflows.

With older versions of git the action will download the code as a
tarball and lack the .git directory.

3 years agogithub-ci: pin actions to specific versions
Jason Ish [Fri, 21 Jan 2022 21:29:48 +0000 (15:29 -0600)] 
github-ci: pin actions to specific versions

Resolve the GitHub scanning pinned-dependencies for most of our GitHub
actions.  The oss-fuzz actions have not been updated.

3 years agodetect: logs an error if a protocol is disabled
Philippe Antoine [Thu, 9 Dec 2021 14:40:09 +0000 (15:40 +0100)] 
detect: logs an error if a protocol is disabled

So that the user knows that the rule cannot match

3 years agodetect: checking validity of rules with http protocol
Philippe Antoine [Fri, 28 Jan 2022 13:02:32 +0000 (14:02 +0100)] 
detect: checking validity of rules with http protocol

We want to check that a rule beginning with alert http
can be valid, that is if either HTTP1 or HTTP2 is enabled.
So, AppLayerProtoDetectGetProtoName will do a more complex
check for this ALPROTO_HTTP (any).

3 years agogeneral: Fix typo
Jeff Lucovsky [Thu, 27 Jan 2022 17:30:14 +0000 (12:30 -0500)] 
general: Fix typo

3 years agoconfig/ref: Raise errors for ref.config parsing
Jeff Lucovsky [Wed, 26 Jan 2022 21:35:12 +0000 (16:35 -0500)] 
config/ref: Raise errors for ref.config parsing

This commit raises an error in configuration test mode if there was an
error parsing reference.config.

Issue: 4659

3 years agodetect/bypass: remove unittest
Modupe Falodun [Thu, 27 Jan 2022 14:32:30 +0000 (15:32 +0100)] 
detect/bypass: remove unittest

This test is reimplemented in Suricata-Verify

Task: 4911

3 years agogithub-ci: update codecov 6880/head
Victor Julien [Fri, 28 Jan 2022 09:37:08 +0000 (10:37 +0100)] 
github-ci: update codecov

Update to v2 API.
Pin the version as suggested by Scorecard.
No longer fail on error. This was not found to be very actionable.

3 years agogithub-ci: set workflow permissions to read-all
Jason Ish [Fri, 21 Jan 2022 21:45:59 +0000 (15:45 -0600)] 
github-ci: set workflow permissions to read-all

3 years agoeve/pgsql: log txs in flow direction 6879/head
Victor Julien [Thu, 27 Jan 2022 15:48:05 +0000 (16:48 +0100)] 
eve/pgsql: log txs in flow direction

3 years agostream-tcp-reassemble: fix reassembly direction for FIN packets
Angelo Mirabella [Thu, 20 Jan 2022 14:52:33 +0000 (14:52 +0000)] 
stream-tcp-reassemble: fix reassembly direction for FIN packets

Suricata invokes the stream reassembly logic only for the current packet
direction if the packet contains a FIN flag. However, this does not
handle the case in which the packet ACKs data from the opposing direction.
This patch forces the invocation of the stream reassembly logic
on both direction when Suricata sees a FIN packet.

3 years agowindows: exit early if live capture requested without npcap 6870/head
Jason Ish [Wed, 26 Jan 2022 22:38:22 +0000 (16:38 -0600)] 
windows: exit early if live capture requested without npcap

3 years agogithub-ci: add windows build for libpcap
Jason Ish [Fri, 21 Jan 2022 17:55:54 +0000 (11:55 -0600)] 
github-ci: add windows build for libpcap

3 years agoconfigure: fallback to libpcap on Windows
Jason Ish [Tue, 25 Jan 2022 20:53:24 +0000 (14:53 -0600)] 
configure: fallback to libpcap on Windows

If npcap/wpcap is not found on Windows, try libpcap. This allows
Suricata to build without NPCap on Windows, however live capture won't
be available.

3 years agohttp-response-line: remove unittest
Modupe Falodun [Wed, 26 Jan 2022 21:52:14 +0000 (22:52 +0100)] 
http-response-line: remove unittest

This test is reimplemented in Suricata-Verify

Task: 4911

3 years agodetect/modbus: remove unittests
Modupe Falodun [Wed, 26 Jan 2022 09:11:11 +0000 (10:11 +0100)] 
detect/modbus: remove unittests

These tests are reimplemented in Suricata-Verify

Task: 4911

3 years agodetect-http-request-line: remove unittests 6865/head
Modupe Falodun [Tue, 25 Jan 2022 21:56:26 +0000 (22:56 +0100)] 
detect-http-request-line: remove unittests

These tests are reimplemented as Suricata-Verify

Task: 4911

3 years agodetect/hostbits: remove unittests 6861/head
Modupe Falodun [Mon, 24 Jan 2022 22:38:56 +0000 (23:38 +0100)] 
detect/hostbits: remove unittests

These tests are reimplemented as Suricata-Verify tests

Task: 4911

3 years agodetect/proto: remove unittests
Modupe Falodun [Mon, 24 Jan 2022 22:11:56 +0000 (23:11 +0100)] 
detect/proto: remove unittests

This test is reimplemented in Suricata-Verify

Task: 4911

3 years agofuzz: cleans all flow after one run
Philippe Antoine [Fri, 21 Jan 2022 12:40:08 +0000 (13:40 +0100)] 
fuzz: cleans all flow after one run

Completes commit e2370d6861990e9aba7b551e51cfa04d945f4510
for all the fuzz targets processing pcaps
using a generic function.

FlowShutdown is not used because it uses the loop to destroy
mutexes, which we want to reuse for fuzzing

3 years agodetect/frames: fix coverity warning 6860/head
Victor Julien [Tue, 25 Jan 2022 07:07:33 +0000 (08:07 +0100)] 
detect/frames: fix coverity warning

Harmless warning, but it was correct in that the code made no sense:
1497420 Dereference before null check

3 years agodetect/frames: fix crash when parsing bad rule
Victor Julien [Mon, 24 Jan 2022 22:30:51 +0000 (23:30 +0100)] 
detect/frames: fix crash when parsing bad rule

Indexing of Signature::init_data::smlists would fail for a rule that
used a frame w/o content, as the array would only be expanded when
adding a content. Adding a check to see if there list id is in bounds
is an implicit check for the "no content" case.

Bug #5011.

3 years agodetect/frames: fix error messages
Victor Julien [Sun, 23 Jan 2022 19:32:16 +0000 (20:32 +0100)] 
detect/frames: fix error messages

3 years agosmb/dce_iface: avoid deleting current ifaces from state
Eloy Pérez González [Fri, 22 Oct 2021 11:53:39 +0000 (13:53 +0200)] 
smb/dce_iface: avoid deleting current ifaces from state

The smb dce_iface keyword must match for all those dcerpc requests
and responses sent in the context of the given interface. They are
not matching as the current bind interfaces are deleted by any
non bind message.

Ticket: 4767

3 years agosmb/dce_iface: use DCERPC_TYPE_REQUEST
Eloy Pérez González [Fri, 22 Oct 2021 11:52:14 +0000 (13:52 +0200)] 
smb/dce_iface: use DCERPC_TYPE_REQUEST

The smb dce_iface keyword must match for all those dcerpc requests and
responses sent in the context of the given interface. They are not
matching because in rs_smb_tx_get_dce_iface, x.req_cmd is erroneously
compared with 1. Fix this by comparing with DCERPC_TYPE_REQUEST instead.

Ticket: 4767

3 years agosmb/dce_opnum: move range if to outer context
Eloy Pérez González [Fri, 22 Oct 2021 13:01:39 +0000 (15:01 +0200)] 
smb/dce_opnum: move range if to outer context

The smb dce_opnum matches all the opnums that are higher that the
indicated opnum. This is due the range comparison if was put in the
exact comparison context, and in case the opnum doesn't match exactly,
then the range comparison is triggered (the upper limit is always true).

Move the erroneus if to the outer context, as else option of the block
checks if comparison should be exact or range.

Ticket: 4767

3 years agosmb/dce_opnum: use DCERPC_TYPE_REQUEST
Eloy Pérez González [Fri, 22 Oct 2021 13:00:11 +0000 (15:00 +0200)] 
smb/dce_opnum: use DCERPC_TYPE_REQUEST

The smb dce_opnum keyword doesn't match the dcerpc requests/responses.
This occurs because in the rs_smb_tx_match_dce_opnum function, the
x.req_cmd is matched against the erroneous code 1. Fix this by using
DCERPC_TYPE_REQUEST for the comparison instead.

Ticket: 4767

3 years agodcerpc: remove prev_tx_call_id and clear_bind_cache from DCERPCState
Eloy Pérez González [Thu, 4 Nov 2021 14:20:14 +0000 (15:20 +0100)] 
dcerpc: remove prev_tx_call_id and clear_bind_cache from DCERPCState

remove those fields since are not used because of the removal of
handle_bind_cache.

3 years agodcerpc: avoid delete the rpc state interface context
Eloy Pérez González [Fri, 22 Oct 2021 13:32:41 +0000 (15:32 +0200)] 
dcerpc: avoid delete the rpc state interface context

The bug:
The dcerpc dce_iface keyword just match the packet following the bind. Only the
next request after the rpc is sent will match. However the expected behaviour it
that all the rpc requests/responses sent under the context of the given
interface would match.

In the Open Group c706 the following is indicated:

In 2.2.1 Binding-related Operations, indicates that one category of binding
operations are those that "operations that establish internal call routing
information for the server." (The other are to establish the protocol which is
not relevant here). And the following statement can be found:

Operations in the second category establish a set of mappings that the server
can use to route calls internally to the appropriate manager routine. This
routing is based on the interface and version, operation and any object
requested by the call.

It indicates that server routes (to call methods) are based on the operation,
interface and object.

- Operation: To indicate the method to call, and operation number is
             specified as indicated in the second step of 2.3.3.2 (Client
             Binding Steps).
- Interface: An interface is a set of remotely callable operations offered by a
             server and invokable by clients. (2.1.1.1)
- Object: Is the manager that implements the interface, as stated in section
          Interface and Manager Selection of 2.3.3.3. It is not mandatory, can
          be nil.

To call a method, a client must send a request message as defined in 2.6.4.9,
that contains these identifiers:

- opnum: The opnum field identifies the operation being invoked within the
         interface.
- p_cont_id (Context ID in Wireshark): The p_cont_id field holds a presentation
                                       context identifier that identifies the
                                       data representation and interface, as
                                       defined in 12.6.3.4 (Context Identifiers).
- object: The object field is contained if the PFC_OBJECT_UUID is set. (Could be
          interesting to create a keyword dce_object for matching this UUID)

Therefore, to get the correct method to invoke, the server must map the context
to the correct interface. This is negotiated by the bind request

Interfaces are first negotiated using the bind message (12.6.4.3), contained in
the p_context_elem array. Then they are accepted or rejected using the bind_ack
message (12.6.4.4).

Once these contexts are established, both client and server can use the context
id, which is the index of the p_context_elem array, to refer the interface they
are using.

Moreover, in the middle of the connection, the context can be changed with the
alter_context message.

This is way suricata shouldn't delete the bindack attribute, that contains
the contexts, used by match_backuuid. This is the only way to know the interface
a request message is referring to.

ticket: 4769
https://redmine.openinfosecfoundation.org/issues/4769

3 years agopgsql: fix defect found by coverity 6854/head
Juliana Fajardini [Fri, 21 Jan 2022 11:47:15 +0000 (11:47 +0000)] 
pgsql: fix defect found by coverity

Pgsql was using bitwise operations to assign password output config to
its context flags, but mixing that with logic negation of the default
value, resulting in the expressions having a constant value as result.

Bug: #5007

3 years agologging: change ownership of application log if needed
Jason Ish [Thu, 20 Jan 2022 18:08:33 +0000 (12:08 -0600)] 
logging: change ownership of application log if needed

When running with privilege dropping, the application log file
is opened before privileges are dropped resulting in Suricata
failing to re-open the file for file rotation.

If needed, chown the application to the run-as user/group after
opening.

Ticker #4523

3 years agostartup: initialize run as user info sooner
Jason Ish [Thu, 20 Jan 2022 17:40:24 +0000 (11:40 -0600)] 
startup: initialize run as user info sooner

Initialize the run-as user info after loading the config, but
before setting up logging (previously it was done while initializing
signal handlers). This will allow the log file to be given the
correct permissions if Suricata is configured to run as a non-root
user.

3 years agodpdk: adjust setting of MTU to the new DPDK API (21.11)
Lukas Sismis [Sun, 23 Jan 2022 12:41:19 +0000 (13:41 +0100)] 
dpdk: adjust setting of MTU to the new DPDK API (21.11)

3 years agogithub-ci: use curl -L for npcap: follow redirects 6836/head 6844/head
Jason Ish [Fri, 21 Jan 2022 05:21:08 +0000 (23:21 -0600)] 
github-ci: use curl -L for npcap: follow redirects

3 years agorust/pgsql: convert parsers to nom7 functions 6842/head
Pierre Chifflier [Fri, 21 Jan 2022 12:37:54 +0000 (13:37 +0100)] 
rust/pgsql: convert parsers to nom7 functions

3 years agodetect: fix possible leak found by coverity
Philippe Antoine [Fri, 21 Jan 2022 15:31:54 +0000 (16:31 +0100)] 
detect: fix possible leak found by coverity

Conditions to create the leak are likely not reachable,
but this is still a bad pattern.

3 years agoci: adds scorecard analysis GitHub workflow 6835/head
Catena cyber [Fri, 21 Jan 2022 14:21:46 +0000 (15:21 +0100)] 
ci: adds scorecard analysis GitHub workflow

3 years agopgsql: add initial support 6822/head
Juliana Fajardini [Wed, 31 Mar 2021 13:29:34 +0000 (14:29 +0100)] 
pgsql: add initial support

- add nom parsers for decoding most messages from StartupPhase and
SimpleQuery subprotocols
- add unittests
- tests/fuzz: add pgsql to confyaml

Feature: #4241

3 years agorust/applayer: add function for upgrading to TLS
Juliana Fajardini [Tue, 14 Sep 2021 19:05:26 +0000 (20:05 +0100)] 
rust/applayer: add function for upgrading to TLS

3 years agosmtp: use AppLayerResult instead of buffering 6819/head
Shivani Bhardwaj [Mon, 3 Jan 2022 14:14:53 +0000 (19:44 +0530)] 
smtp: use AppLayerResult instead of buffering

Also, remove tests that check for the removed buffers and any middle
states while parsing and buffering.

Ticket 4907

3 years agoquic: add quic.ua for matching user agent
Victor Julien [Sun, 16 Jan 2022 16:41:31 +0000 (17:41 +0100)] 
quic: add quic.ua for matching user agent

3 years agoquic: log user agent when available
Victor Julien [Sun, 16 Jan 2022 13:07:21 +0000 (14:07 +0100)] 
quic: log user agent when available

3 years agodetect/quic: add quic.sni sticky buffer
Victor Julien [Sat, 15 Jan 2022 18:24:46 +0000 (19:24 +0100)] 
detect/quic: add quic.sni sticky buffer

3 years agoquic: log sni; reduce number of transactions
Victor Julien [Sat, 15 Jan 2022 13:19:06 +0000 (14:19 +0100)] 
quic: log sni; reduce number of transactions

Only create transactions for long headers.

Store SNI in tx, log it.

3 years agodoc/quic: update for new quic.version logic
Victor Julien [Fri, 14 Jan 2022 20:12:48 +0000 (21:12 +0100)] 
doc/quic: update for new quic.version logic

3 years agoquic: log version as string
Victor Julien [Fri, 14 Jan 2022 15:31:34 +0000 (16:31 +0100)] 
quic: log version as string

Log as Q043, Q044, Q045, Q046. If the version is not supported/recognized,
log the 4 bytes as hex.

Only log for txs based on long headers.

3 years agoquic: redo quic.version; parser cleanups
Victor Julien [Fri, 14 Jan 2022 19:34:04 +0000 (20:34 +0100)] 
quic: redo quic.version; parser cleanups

Reimplement quic.version as sticky buffer.

Removed unused parts of the parser.

Set unidirectional tx flag to fix double matching.

3 years agodoc/quic: Add documentation for QUIC keywords
Emmanuel Thompson [Thu, 23 Sep 2021 20:54:58 +0000 (16:54 -0400)] 
doc/quic: Add documentation for QUIC keywords