]>
git.ipfire.org Git - thirdparty/suricata.git/log
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
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
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.
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)
Jason Ish [Fri, 21 Jan 2022 05:21:08 +0000 (23:21 -0600)]
github-ci: use curl -L for npcap: follow redirects
Pierre Chifflier [Fri, 21 Jan 2022 12:37:54 +0000 (13:37 +0100)]
rust/pgsql: convert parsers to nom7 functions
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.
Catena cyber [Fri, 21 Jan 2022 14:21:46 +0000 (15:21 +0100)]
ci: adds scorecard analysis GitHub workflow
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
Juliana Fajardini [Tue, 14 Sep 2021 19:05:26 +0000 (20:05 +0100)]
rust/applayer: add function for upgrading to TLS
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
Victor Julien [Sun, 16 Jan 2022 16:41:31 +0000 (17:41 +0100)]
quic: add quic.ua for matching user agent
Victor Julien [Sun, 16 Jan 2022 13:07:21 +0000 (14:07 +0100)]
quic: log user agent when available
Victor Julien [Sat, 15 Jan 2022 18:24:46 +0000 (19:24 +0100)]
detect/quic: add quic.sni sticky buffer
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.
Victor Julien [Fri, 14 Jan 2022 20:12:48 +0000 (21:12 +0100)]
doc/quic: update for new quic.version logic
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.
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.
Emmanuel Thompson [Thu, 23 Sep 2021 20:54:58 +0000 (16:54 -0400)]
doc/quic: Add documentation for QUIC keywords
Emmanuel Thompson [Mon, 23 Aug 2021 22:58:55 +0000 (18:58 -0400)]
doc/quic: Add quic to eve json format
Emmanuel Thompson [Thu, 16 Jul 2020 15:04:52 +0000 (11:04 -0400)]
quic: Add QUIC App Layer
Parses quic and logs a CYU hash for gquic frames
Andreas Dolp [Tue, 18 Jan 2022 18:27:40 +0000 (19:27 +0100)]
Doc: Fix typos in documentation of suricata.yaml.
Sam Muhammed [Fri, 14 Jan 2022 00:25:12 +0000 (02:25 +0200)]
nfs4_records: add unittests
Add unittests for setclientid, readdir records
Task #4866
Pierre Chifflier [Tue, 18 Jan 2022 21:38:19 +0000 (22:38 +0100)]
rust: simplify bits parser annotations
Pierre Chifflier [Tue, 18 Jan 2022 21:21:07 +0000 (22:21 +0100)]
rust/smb: simplify bits parser annotations
Pierre Chifflier [Tue, 18 Jan 2022 20:56:37 +0000 (21:56 +0100)]
rust: add 'bits' combinator to simplify nom bits parsers
Add a specialized version of the 'bits' nom combinator so adding
bits-level parsers does not require type annotations.
Philippe Antoine [Thu, 9 Dec 2021 19:43:56 +0000 (20:43 +0100)]
detect: do not upgrade base64 decode when fuzzing
As fuzzing will put a very big value, and then
ThreadCtxDoInit will try to allocate it,
ending in out of memory
Victor Julien [Tue, 18 Jan 2022 14:17:12 +0000 (15:17 +0100)]
proto-detect: set flags in packet direction for UDP
Victor Julien [Tue, 18 Jan 2022 13:52:13 +0000 (14:52 +0100)]
proto-detect: fix UDP not setting alproto_ts/tc
This would lead to the `app-layer-protocol` keyword not matching correctly.
Philippe Antoine [Fri, 22 Oct 2021 17:47:49 +0000 (19:47 +0200)]
detect: xor transform
Ticket: 3285
The xor transform applies xor decoding to a buffer, with a key
specified as an option in hexadecimal. Arbitrary key sizes are
accepted.
Philippe Antoine [Thu, 18 Feb 2021 14:43:16 +0000 (15:43 +0100)]
detect: adds test with invalid uint mode <<
Philippe Antoine [Wed, 17 Feb 2021 16:28:51 +0000 (17:28 +0100)]
detect: use generic functions for icode parsing
Philippe Antoine [Thu, 16 Dec 2021 09:23:40 +0000 (10:23 +0100)]
fuzz: cleans all flow after one run
Makes the fuzz target more stateless
And manages to find bugs on the FlowFree path
Philippe Antoine [Thu, 9 Dec 2021 14:06:24 +0000 (15:06 +0100)]
fuzz: use parsed rules in sigpcap target
Ticket: 4125
As commit
d21a252238fd766d3c2ec4c2d165d429dad0d85a
But for sigpcap target as well
Philippe Antoine [Thu, 9 Dec 2021 09:24:50 +0000 (10:24 +0100)]
dns: wrap with HAVE_LUA
This is just code style, to minimize the compiled code.
Philippe Antoine [Thu, 9 Dec 2021 08:57:05 +0000 (09:57 +0100)]
fuzz: enable template protocols
Ticket: 4125
Philippe Antoine [Wed, 15 Dec 2021 20:11:05 +0000 (21:11 +0100)]
enip: fix too restrictive check in probing parser
As is shown later in the code, enip_len can be
ENIP_LEN_REGISTER_SESSION which is 4, which is
smaller than sizeof(ENIPEncapHdr) which is 24
Philippe Antoine [Wed, 15 Dec 2021 19:48:47 +0000 (20:48 +0100)]
fuzz: use fuzzing confyaml for protodetect target
As is done for other targets,
so that all app-layer protocols are enabled,
even the ones disabled by default such as enip
And resets protocol detection every time we try
so that probing_parser_toserver_alproto_masks are fresh.
Jason Ish [Thu, 16 Dec 2021 22:27:42 +0000 (16:27 -0600)]
doc/update: mention change of default rule path
Jason Ish [Thu, 16 Dec 2021 22:26:47 +0000 (16:26 -0600)]
doc: update rule section to current default
Update the rule section to better describe whats seen in a default
install of Suricata including a link to the rule management section.
Jason Ish [Thu, 16 Dec 2021 22:24:38 +0000 (16:24 -0600)]
rule-path: always use $localstatedir/lib/suricata/rules
Always use the same path for default-rule-path whether or not
Suricata-Update will be installed as part of the Suricata install or
not.
This provides consistency, and maps better to our recommendation that
Suricata-Update be used to manage rules.
Probably should have been done as part of
55852d0de3151517b6cb22c736cb2de8a893cb11 .
Ticket #4912.
Victor Julien [Tue, 4 Jan 2022 15:43:24 +0000 (16:43 +0100)]
telnet: initial support with frames
Bootstrapped using setup script. Basic option parsing for purpose
of tagging frames.
Victor Julien [Sun, 12 Dec 2021 07:11:46 +0000 (08:11 +0100)]
htp: improve request/response size accuracy
Victor Julien [Fri, 10 Dec 2021 17:19:06 +0000 (18:19 +0100)]
htp: implement basic request/response frames
Victor Julien [Fri, 3 Dec 2021 07:17:37 +0000 (08:17 +0100)]
ssl: implement frames for SSLv3 and TLS
Jason Ish [Wed, 8 Dec 2021 23:08:07 +0000 (17:08 -0600)]
smb: use derive AppLayerFrameType
Victor Julien [Mon, 6 Dec 2021 10:35:23 +0000 (11:35 +0100)]
smb: implement frames
SMB1 record parsing code simplification.
Frames:
nbss.pdu
nbss.hdr
nbss.data
smb1.pdu
smb1.hdr
smb1.data
smb2.pdu
smb2.hdr
smb2.data
smb3.pdu
smb3.hdr
smb3.data
The smb* frames are created for valid SMB records.
Victor Julien [Fri, 3 Dec 2021 07:14:34 +0000 (08:14 +0100)]
detect/frames: implement 'frame' keyword
Implement a special sticky buffer to select frames for inspection.
This keyword takes an argument to specify the per protocol frame type:
alert <app proto name> ... frame:<specific frame name>
Or it can specify both in the keyword:
alert tcp ... frame:<app proto name>.<specific frame name>
The latter is useful in some cases like http, where "http" applies to
both HTTP and HTTP/2.
alert http ... frame:http1.request;
alert http1 ... frame:request;
Examples:
tls.pdu
smb.smb2.hdr
smb.smb3.data
Consider a rule like:
alert tcp ... flow:to_server; content:"|ff|SMB"; content:"some smb 1 issue";
this will scan all toserver TCP traffic, where it will only be limited by a port,
depending on how rules are grouped.
With this work we'll be able to do:
alert smb ... flow:to_server; frame:smb1.data; content:"some smb 1 issue";
This rule will only inspect the data portion of SMB1 frames. It will not affect
any other protocol, and it won't need special patterns to "search" for the
SMB1 frame in the raw stream.
Victor Julien [Fri, 3 Dec 2021 07:15:15 +0000 (08:15 +0100)]
detect/frames: limit mixing frames and other detection
Don't allow mixing of payload/stream/tx and frame keywords. Initial
support is only for 'pure' frame inspection.
Victor Julien [Fri, 3 Dec 2021 07:18:40 +0000 (08:18 +0100)]
detect/analyzer: add frame support
Victor Julien [Fri, 3 Dec 2021 06:53:32 +0000 (07:53 +0100)]
detect/engine: support frames
Implement the low level detect engine support for inspecting frames,
including MPM, transforms and inspect API's.
Victor Julien [Fri, 3 Dec 2021 06:47:29 +0000 (07:47 +0100)]
eve/alert: add support for logging frame
If detection was done in a frame, the frame will be added to the
eve.alert output.
Victor Julien [Fri, 3 Dec 2021 06:45:28 +0000 (07:45 +0100)]
eve: implement frame logging
This is mostly to assist development and QA. It produces too much data
for practical use.
Jason Ish [Tue, 7 Dec 2021 21:42:23 +0000 (15:42 -0600)]
cbindgen: ignore frames module
Jason Ish [Wed, 8 Dec 2021 23:06:04 +0000 (17:06 -0600)]
rust: derive macro for app-layer frame type
Jason Ish [Wed, 8 Dec 2021 23:06:37 +0000 (17:06 -0600)]
rust/applayer: create trait for app-layer frame types
Jason Ish [Mon, 13 Dec 2021 19:12:13 +0000 (20:12 +0100)]
app/frames: implement rust API
Victor Julien [Tue, 21 Dec 2021 08:59:15 +0000 (09:59 +0100)]
app-layer: move app_progress forward on errors as well
In case of APP_LAYER_ERROR still move the app_progress forward.
This helps validation of frame offsets and should be harmless
otherwise.
Victor Julien [Fri, 3 Dec 2021 06:40:56 +0000 (07:40 +0100)]
app/frames: initial support
The idea of stream frames is that the applayer parsers can tag PDUs and
other arbitrary frames in the stream while parsing. These frames can then
be inspected from the rule language. This will allow rules that are more
precise and less costly.
The frames are stored per direction in the `AppLayerParserState` and will only
be initialized when actual frames are in use. The per direction storage has a
fixed size static portion and dynamic support for a larger number. This is done
for effeciency.
When the Stream Buffer slides, frames are updated as they use offsets relative
to the stream. A negative offset is used for frames that started before the
current window.
Frames have events to inspect/log parser errors that don't fit the TX model.
Frame id starts at 1. So implementations can keep track of frame ids where 0
is not set.
Frames affect TCP window sliding. The frames keep a "left edge" which
signifies how much data to keep for frames that are still in progress.
Victor Julien [Fri, 3 Dec 2021 06:42:22 +0000 (07:42 +0100)]
app/frames: implement name to id API for frames
Victor Julien [Sat, 18 Dec 2021 18:11:40 +0000 (19:11 +0100)]
stream: add util function to get 'usable' data
Philippe Antoine [Mon, 17 Jan 2022 14:14:54 +0000 (15:14 +0100)]
ci: do not use ppa for cocci
As this version segfaults
Pierre Chifflier [Wed, 12 Jan 2022 15:41:15 +0000 (16:41 +0100)]
rust/http2: convert parser to nom7 functions (HTTP2 ranges)
Pierre Chifflier [Wed, 12 Jan 2022 15:17:40 +0000 (16:17 +0100)]
rust/http2: convert parser to nom7 functions (HTTP2 core functions)
Lukas Sismis [Wed, 15 Dec 2021 13:24:55 +0000 (14:24 +0100)]
dpdk: fix received/error counters
Victor Julien [Mon, 17 Jan 2022 12:02:51 +0000 (13:02 +0100)]
tests/pppoe: clean up more tests to use PASS/FAIL macros
Steven Ottenhoff [Thu, 13 Jan 2022 13:05:58 +0000 (13:05 +0000)]
pppoe: fix protocol field length variation
Detect when protocol field is not a 16 bit field.
Added tests to prove logic
Ticket: 4810
Steven Ottenhoff [Thu, 13 Jan 2022 12:38:01 +0000 (12:38 +0000)]
test/pppoe: refactor to use FAIL/PASS macros
Modupe Falodun [Fri, 14 Jan 2022 15:53:28 +0000 (16:53 +0100)]
detect-file-data: remove SMTP unittests
These tests are reimplemented as Suricata-verify tests
Task: 4938
Eric Leblond [Mon, 17 Jan 2022 08:31:06 +0000 (09:31 +0100)]
output/alert: don't call basic logging twice
Issue: 4106
Victor Julien [Fri, 14 Jan 2022 10:48:16 +0000 (11:48 +0100)]
stream: suppress noisy debug message
Victor Julien [Thu, 13 Jan 2022 11:13:43 +0000 (12:13 +0100)]
stream: fix stream pruning being too aggressive
Pruning of StreamBufferBlocks could remove blocks that fell entirely
after the target offset due to a logic error. This could lead to data
being evicted that was still meant to be processed in theapp-layer
parsers.
Bug: #4953.
Victor Julien [Thu, 13 Jan 2022 11:12:56 +0000 (12:12 +0100)]
stream: debug code for showing segment list state
Jeff Lucovsky [Sun, 26 Dec 2021 15:22:34 +0000 (10:22 -0500)]
detect: Avoid recomputing ntohl() in addr match
This commit makes a small optimization when comparing IPv4 and IPv6
addresses by making the host order value invariant and calculating the
value once, before entering the loop.
Philippe Antoine [Wed, 8 Dec 2021 20:14:54 +0000 (21:14 +0100)]
file: define own variable instead of PATH_MAX
to be used for maximum size of file names,
and not depend on the OS
Philippe Antoine [Mon, 6 Dec 2021 08:44:12 +0000 (09:44 +0100)]
ssl: fix int warnings
especially increasing padding_len size
Philippe Antoine [Mon, 6 Dec 2021 08:36:14 +0000 (09:36 +0100)]
smtp: fix int warnings
and explicitly truncating filename's length
Philippe Antoine [Mon, 6 Dec 2021 08:26:54 +0000 (09:26 +0100)]
app: fix int warnings in generic app files
Philippe Antoine [Mon, 6 Dec 2021 08:22:52 +0000 (09:22 +0100)]
http: : fix int warnings
Explicitly truncate file names to UINT16_MAX
Before, they got implicitly truncated, meaning a UINT16_MAX + 1
file name, went to 0 file name (because of modulo 65536)
Philippe Antoine [Mon, 6 Dec 2021 08:11:09 +0000 (09:11 +0100)]
ftp: fix int warnings
Explicitly truncate a file name if it is longer
than UINT16_MAX
Jeff Lucovsky [Tue, 21 Sep 2021 13:52:11 +0000 (09:52 -0400)]
log: Coverity REVERSE_INULL warnings
This commit addresses Coverity reported "REVERSE_INULL" warnings.
Issue: 4699
Philippe Antoine [Thu, 6 Jan 2022 13:07:21 +0000 (14:07 +0100)]
doc: fix typo lenght/length
Sam Muhammed [Fri, 7 Jan 2022 17:27:06 +0000 (19:27 +0200)]
nfs4_records: add unittests for nom7 parsers
Task #4866
Sam Muhammed [Mon, 10 Jan 2022 23:52:34 +0000 (01:52 +0200)]
nfs4_records: add missing field to res_sequence_ok()
Missing _seqid in sequence op struct left a trailing four zeros
that are parsed by nfs4_res_compound_command() as a cmd
causing a Switch Error Code
Sam Muhammed [Sun, 2 Jan 2022 05:31:34 +0000 (07:31 +0200)]
nfs3-records: add unittests to nom7 parsers
Task #4866
Sam Muhammed [Sun, 2 Jan 2022 04:57:39 +0000 (06:57 +0200)]
nfs3-records: add missing fields and update parsers
Add missing fields to some record structures and
update their respective parsers
Sam Muhammed [Mon, 27 Dec 2021 12:19:27 +0000 (14:19 +0200)]
nfs2-records: add unittests for nom7 parsers
Task #4866
Jeff Lucovsky [Tue, 11 Jan 2022 19:16:24 +0000 (14:16 -0500)]
suricatasc: Handle incomplete/empty recv values
Issue: 4947
Improve handling of values returned by recv. Sometimes, recv returns an
empty string if suricata terminates asynchronously.
Victor Julien [Tue, 11 Jan 2022 07:09:56 +0000 (08:09 +0100)]
nfs2: improve READ parsing
Take fill_bytes into account.
Jason Ish [Fri, 17 Dec 2021 22:33:48 +0000 (16:33 -0600)]
rust/app-layer: expose AppLayerEvent derive macro
Export the AppLayerEvent derive macro so plugin (or library code) can
use it as expected, for example:
use suricata::applayer::AppLayerEvent;
enum MyEvent {
EventOne,
EventTwo,
}
Jason Ish [Fri, 17 Dec 2021 22:32:05 +0000 (16:32 -0600)]
rust/derive: make usable from a plugin or lib user
The macro was generating code that references names use the "crate"
prefix which will fail if the macro is used by a library user or plugin.
Dynamically check where we are running an use the correct import paths
as needed.
Jason Ish [Fri, 17 Dec 2021 22:28:56 +0000 (16:28 -0600)]
rust: rename to suricata (from suricata_rust)
Rename the Rust lib to simply "suricata" instead of "suricata_rust".
This allows Rust plugin/library code to use it under the name "suricata"
which is what should be expected.
The name was only "suricata_rust" to prevent on-disk conflict with the C
code, so just rename the file on disk, which doesn't affect how the code
is interacted with from an API layer.
Jason Ish [Fri, 17 Dec 2021 22:25:47 +0000 (16:25 -0600)]
rust: remove feature function-macro
The function macro existed so it would only be enabled on Rust
versions that supported. Now that our MSRV is 1.41, which is
greater than 1.38 we can assume we always have support for
this macro.
Shivani Bhardwaj [Tue, 14 Dec 2021 15:44:30 +0000 (21:14 +0530)]
rust: bump MSRV to 1.41.1
Ticket: #4902.
(cherry picked from commit
87f04475aaa75ee205b1b699e59fb2b5ba7ed59f )
Jason Ish [Thu, 6 Jan 2022 17:28:40 +0000 (11:28 -0600)]
rust/http2: use base64 crate for base64 decode
Jason Ish [Fri, 3 Sep 2021 21:04:58 +0000 (15:04 -0600)]
base64: use the Rust base64 encode implementation
Replace our internal base64 implementation with a ffi wrapper
around the Rust implementation provided by an external crate.
Jason Ish [Thu, 24 Jun 2021 16:21:52 +0000 (10:21 -0600)]
eve: use JsonBuilder for encoding base64
Replaces all usages of Base64Encode just before writing to a
JsonBuilder with jb_set_base64 and jb_append_base64.
Jason Ish [Thu, 24 Jun 2021 16:20:09 +0000 (10:20 -0600)]
jsonbuilder: add methods to encode values as base64
Add new methods to set a value as a base64 encoded string of
a byte array. This uses the Rust base64 crate and encodes
directly into the JsonBuilder buffer with no intermediate
buffer required.
jb_set_base64: set a field on an object
jb_append_base64: append a value to an array
Victor Julien [Mon, 6 Dec 2021 07:31:25 +0000 (08:31 +0100)]
app-layer: use StreamSlice as input to parsers
Remove input, input_len and flags in favor of stream slice.
Victor Julien [Sun, 5 Dec 2021 10:16:06 +0000 (11:16 +0100)]
app-layer: add StreamSlice to pass data to parsers
Since object to contain relevant pointer, length, offset, flags to make
it easy to pass these to the parsers.