]>
git.ipfire.org Git - thirdparty/suricata.git/log
Victor Julien [Tue, 5 Apr 2022 11:50:30 +0000 (13:50 +0200)]
detect/urilen: don't pass null pointer to pcre2 free
Bug #5228.
Victor Julien [Mon, 4 Apr 2022 11:30:19 +0000 (13:30 +0200)]
detect/mpm: initialization micro optimization
Victor Julien [Sat, 2 Apr 2022 20:25:17 +0000 (22:25 +0200)]
detect: pattern id assignment through hash table
Only consider active part of the pattern for mpm (so consider chop).
Move data structure to hash list table over the custom array logic.
Victor Julien [Fri, 1 Apr 2022 13:00:05 +0000 (15:00 +0200)]
detect: keyword list to hash to improve perf
Since the switch to pcre2 this was much more heavily used, which
would lead to measurable time spent in list handling.
Victor Julien [Fri, 1 Apr 2022 10:22:51 +0000 (12:22 +0200)]
detect: optimize mpm-engine setup
Instead of a loop over the rules in a group *per engine* do a single
loop in which all the engines are prepared in parallel.
Victor Julien [Thu, 31 Mar 2022 16:00:57 +0000 (18:00 +0200)]
detect: initialization optimization
A lot of time was spent in `SigMatchListSMBelongsTo` for the `mpm_sm`.
Optimize this by keeping the value at hand during Signature parsing and
detection engine setup.
Victor Julien [Sat, 2 Apr 2022 08:51:42 +0000 (10:51 +0200)]
hash: constify data input
Victor Julien [Sat, 2 Apr 2022 20:02:41 +0000 (22:02 +0200)]
detect/analyzer: support frames in pattern dump
Victor Julien [Sat, 2 Apr 2022 13:37:16 +0000 (15:37 +0200)]
detect/filemagic: don't pass unused pointer
Arne Welzel [Sat, 12 Feb 2022 16:49:07 +0000 (17:49 +0100)]
flow-manager: fix off-by-one in flow_hash row allocation
The current code doesn't cover all rows when more than one flow manager is
used. It leaves a single row between ftd->max and ftd->min of the next
manager orphaned. As an example:
hash_size=1000
flowmgr_number=3
range=333
instance ftd->min ftd->max
0 0 333
1 334 666
2 667 1000
Rows not covered: 333, 666
Victor Julien [Thu, 24 Mar 2022 15:44:10 +0000 (16:44 +0100)]
http: fix reassembled range file accounting
Victor Julien [Fri, 25 Mar 2022 13:38:40 +0000 (14:38 +0100)]
http2: fix file accounting for ranged files
Increment files_opened for tx that 'gets' reassembled ranged file
Victor Julien [Fri, 25 Mar 2022 10:17:23 +0000 (11:17 +0100)]
smb1: apply close to direction
Instead of closing files in both direction when receiving a close request,
close only toserver files for the request and close toclient on receiving
a response.
Victor Julien [Fri, 25 Mar 2022 09:36:03 +0000 (10:36 +0100)]
smb: convert 'close' parser to function
Victor Julien [Thu, 24 Mar 2022 15:53:31 +0000 (16:53 +0100)]
files: open/log debug validation bugon
Meant to find more cases where there is a mismatch.
Juliana Fajardini [Tue, 15 Feb 2022 13:06:50 +0000 (13:06 +0000)]
devguide: update readme
Use it to explain how to go about the sequence diagram images
(generation, updating, what is mscgen etc).
Also remove portion that referred to Sphinx builds, as these don't make
sense now.
Juliana Fajardini [Wed, 9 Feb 2022 19:46:24 +0000 (19:46 +0000)]
userguide: dynamically determine copyright date
This uses the date of doc generation to determine the copyright date
for the trailing date. Based on Jeff Lucovsky solution.
Juliana Fajardini [Mon, 14 Feb 2022 18:29:00 +0000 (18:29 +0000)]
devguide: drop use of mscgen script in builds/make
Currently, it seems easier to upload the diagram images to git than to
try to make the image generation script work with out of the tree builds
and other corner cases.
This means, however, that one must activelly remember to update msc
diagram files, run the script and re-add new png files, if those ever
need to be updated. To raise awareness to that, a watermark was added
to the diagram images.
Also removed configuration steps that added mscgen as dependency
(locally and for workflow builds and readthedocs).
Juliana Fajardini [Fri, 18 Feb 2022 16:28:27 +0000 (16:28 +0000)]
devguide: add watermark to sequence diagrams
Make it more evident that the sequence diagrams in the transactions
page are generated with Mscgen
Juliana Fajardini [Thu, 16 Dec 2021 18:40:41 +0000 (18:40 +0000)]
devguide: move into userguide as last chapter
Moved devguide dir into userguide dir.
Since the devguide is now incorporated as the last chapter of the
userguide, removed build and configuration files from the devguide
dir, as these are no longer needed.
Task #4909
Juliana Fajardini [Wed, 22 Dec 2021 17:57:25 +0000 (17:57 +0000)]
devguide: clarify cargo test usage for modules
The documentation was showing an invalid path for running single tests.
Philippe Antoine [Tue, 30 Nov 2021 14:06:38 +0000 (15:06 +0100)]
http: move xff logging to alert object
Ticket: 4860
instead of root field
Philippe Antoine [Thu, 10 Mar 2022 14:09:57 +0000 (15:09 +0100)]
ssl: first pass limit when allocating buffer for certificates
With this check, on the first packet of a certificate presenting
a length of 16Mbytes, we only allocate up to 65Kb
When we get to the point where need more than 65Kb, we realloc
to the true size.
With this check, it makes it more expensive for an attacket to use
this allocation as a way to trigger ressource exhaustion...
Philippe Antoine [Tue, 22 Feb 2022 12:10:59 +0000 (13:10 +0100)]
smtp: check if there is a transaction to close
Ticket: 4948
When parsing the response for starttls
Philippe Antoine [Tue, 15 Mar 2022 19:59:28 +0000 (20:59 +0100)]
tmqh: fix possible null dereference
Coverity ID:
1502953
As we check just on the next line my_pool against NULL, we should
not dereference it, even for debug validation
Philippe Antoine [Tue, 15 Mar 2022 19:55:09 +0000 (20:55 +0100)]
detect: remove dead code about xbits keyword
Philippe Antoine [Thu, 10 Mar 2022 14:26:48 +0000 (15:26 +0100)]
log: prevents use of uninitialized variable
Even if the code seems unreachable for now
Jason Ish [Tue, 22 Mar 2022 15:46:45 +0000 (09:46 -0600)]
detect-content: error on single char hex pairs
Fix parsing of content like "|aa b cc|" which was parsed as "|aa bc|"
without error or warning. This will now fail out, requiring all hex
values to be 2 chars.
Ticket #5201
Victor Julien [Sun, 20 Mar 2022 15:14:10 +0000 (16:14 +0100)]
streaming: remove unused 'auto slide' support
Add debug validation checks for "impossible" conditions.
Philippe Antoine [Tue, 8 Mar 2022 11:50:16 +0000 (12:50 +0100)]
detect: makes config keyword really require a flow
Ticket: 4972
Completes commit
c3a220647
DETECT_CONFIG is added as DETECT_SM_LIST_POSTMATCH and not
as DETECT_SM_LIST_MATCH as other keywords handled in SignatureCreateMask
Modupe Falodun [Fri, 4 Mar 2022 13:10:54 +0000 (14:10 +0100)]
detect-pcre: remove unittests
These tests are reimplemented in Suricata-Verify
Task: 4911
Sam Muhammed [Wed, 23 Feb 2022 12:15:00 +0000 (14:15 +0200)]
nfs: Implement frames
Feature #4872
Frames:
- RPC Frames: Generic over TCP/UDP
- rpc.pdu
- rpc.hdr
- rpc.data
- rpc.creds -- for rpc calls
- NFSv2, NFSv3
- nfs.pdu
- nfs.status -- for nfs responses
- NFSv4 Only Frames
- nfs4.pdu
- nfs4.hdr
- nfs4.ops -- for compound request/response operations
- nfs4.status -- for nfs4 responses
RPC tcp/udp frames created with separate registeration functions e.g:
add_rpc_tcp_tc_frames()
add_rpc_udp_tc_frames()
Sam Muhammed [Mon, 28 Feb 2022 11:44:45 +0000 (13:44 +0200)]
rpc: Improve rpc_record struct
Add creds_len field to rpc_record
needed for rpc.creds frame length calculation
Sam Muhammed [Sun, 20 Feb 2022 17:46:03 +0000 (19:46 +0200)]
rust/nfs4: Add NFSPROC4_DESTROY_CLIENTID op parsers
Sam Muhammed [Sun, 20 Feb 2022 17:25:02 +0000 (19:25 +0200)]
rust/nfs4: Add NFSPROC4_DESTROY_SESSION op parsers
Also add respective request unittest
test_nfs4_request_destroy_session()
Sam Muhammed [Sun, 20 Feb 2022 17:10:41 +0000 (19:10 +0200)]
rust/nfs4: Add NFSPROC4_LAYOUTRETURN op parsers
Also add respective request unittest
test_nfs4_request_layoutreturn()
Sam Muhammed [Sun, 20 Feb 2022 16:40:11 +0000 (18:40 +0200)]
rust/nfs4: Add NFSPROC4_GETDEVINFO op parsers
Also add respective response/request unittests
test_nfs4_response_getdevinfo()
test_nfs4_request_getdevinfo()
Sam Muhammed [Sun, 20 Feb 2022 15:45:14 +0000 (17:45 +0200)]
rust/nfs4: Add NFSPROC4_LAYOUTGET op parsers
Also add respective response/request unittests
test_nfs4_response_layoutget()
test_nfs4_request_layoutget()
Sam Muhammed [Sun, 20 Feb 2022 12:47:08 +0000 (14:47 +0200)]
rust/nfs4: Add NFSPROC4_SECINFO_NO_NAME op parsers
Sam Muhammed [Sun, 20 Feb 2022 12:27:17 +0000 (14:27 +0200)]
rust/nfs4: Add NFSPROC4_RECLAIM_COMPLETE op parsers
Sam Muhammed [Sun, 20 Feb 2022 12:15:29 +0000 (14:15 +0200)]
rust/nfs4: Add NFSPROC4_CREATE_SESSION op parsers
Also add respective response/request unittests
test_nfs4_request_create_session()
test_nfs4_response_create_session()
Sam Muhammed [Sun, 20 Feb 2022 11:28:12 +0000 (13:28 +0200)]
rust/nfs4: Add NFSPROC4_EXCHANGEID response parser
Also add test_nfs4_response_exchangeid() unittest
Sam Muhammed [Sun, 20 Feb 2022 10:33:44 +0000 (12:33 +0200)]
rust/nfs4: improve NFSPROC4_OPEN op parser
Improve nfs4_res_open() parser to reflect other file-delegation types
Reflect the changes on test_nfs4_response_open() unittest
Philippe Antoine [Tue, 18 Jan 2022 09:50:46 +0000 (10:50 +0100)]
fuzz: fix integer warnings
Ticket: 4516
Philippe Antoine [Tue, 18 Jan 2022 09:43:56 +0000 (10:43 +0100)]
utils: fix integer warnings in r files
Ticket: 4516
Philippe Antoine [Mon, 17 Jan 2022 21:37:21 +0000 (22:37 +0100)]
stream-tcp: fix integer warnings
Ticket: 4516
Philippe Antoine [Mon, 17 Jan 2022 21:22:49 +0000 (22:22 +0100)]
util: fix int warnings in tm threads
Ticket: 4516
Philippe Antoine [Fri, 14 Jan 2022 12:15:57 +0000 (13:15 +0100)]
util: fix int warnings in unit tests
Ticket: 4516
Philippe Antoine [Fri, 14 Jan 2022 09:05:54 +0000 (10:05 +0100)]
util: fix int warnings
Ticket: 4516
Jason Ish [Mon, 28 Feb 2022 21:12:37 +0000 (15:12 -0600)]
smb: rules for messages in the wrong direction
Jason Ish [Fri, 18 Feb 2022 04:57:30 +0000 (22:57 -0600)]
smb: handle records in the wrong direction
If an SMB record is seen in the wrong direction, set an event on the PDU
frame and don't process the record in the state.
No error is returned, so the next record will be processed.
Jason Ish [Fri, 18 Feb 2022 17:43:17 +0000 (11:43 -0600)]
smb: expose smb1 request/reply flags with a method
Adds `.is_request()` and `.is_reply()` to check if a SMB record flags
say the message is a request or a reply.
Jason Ish [Thu, 17 Feb 2022 22:52:44 +0000 (16:52 -0600)]
smb: fix smb2 header flag parsing
The bits were being parsed in the order they're displayed in Wireshark,
rather than the order they were being seen on the wire, resulting in
direction and async being 0 more often than they should be.
Instead of bits, take the 4 bytes as an le_u32 and just use bit masks to
extract what we need into a struct, I think its easier to reason about
this way when comparing to the Microsoft documentation.
Philippe Antoine [Mon, 17 Jan 2022 13:47:48 +0000 (14:47 +0100)]
detect: only apply ConfigApplyTx with app-layers
Ticket: 4972
Otherwise, it makes no sense to look for a tx...
Juliana Fajardini [Thu, 24 Feb 2022 16:04:36 +0000 (16:04 +0000)]
applayer/frame: remove output from GetFrame funcs
As these functions can be probed, having output there results in
misleading output.
Modupe Falodun [Mon, 21 Feb 2022 15:43:04 +0000 (16:43 +0100)]
detect-dce-iface: remove unittests
These tests are reimplemented in Suricata Verify
Task: 4911
Victor Julien [Tue, 1 Mar 2022 11:44:01 +0000 (12:44 +0100)]
detect/iponly: add tests for 5168
Victor Julien [Tue, 1 Mar 2022 11:43:25 +0000 (12:43 +0100)]
detect/address: minor unittest cleanup
Victor Julien [Tue, 1 Mar 2022 11:42:49 +0000 (12:42 +0100)]
detect/iponly: validate netmask
Only accept netmask in dotted quad notation if they can be turned
into a CIDR.
According to rfc 4632, CIDR (compat) netmasks are all that should be
used.
Bug: #5168.
Victor Julien [Tue, 1 Mar 2022 11:41:04 +0000 (12:41 +0100)]
detect/address: validate netmasks
Only accept netmask in dotted quad notation if they can be turned
into a CIDR.
According to rfc 4632, CIDR (compat) netmasks are all that should be
used.
Bug: #5168.
Victor Julien [Mon, 28 Feb 2022 21:31:58 +0000 (22:31 +0100)]
detect/iponly: break out range insert code
So we can reuse it.
Victor Julien [Tue, 1 Mar 2022 11:41:49 +0000 (12:41 +0100)]
util/cidr: add util to convert netmask to cidr
Philippe Antoine [Mon, 28 Feb 2022 07:32:42 +0000 (08:32 +0100)]
src: use u8_tolower everywhere
Ticket: 4516
Instead of basic to_lower to get the cast to avoid warning
about integer
Sames goes for u8_toupper
Philippe Antoine [Mon, 28 Feb 2022 10:21:28 +0000 (11:21 +0100)]
range: better closing for out of order ranges
Ticket: 5132
In case of a duplicate range, we can return early, because
there is no new data to process.
More importantly, this commit adds a check about wether the file
got closed meanwhile, so that this just completed out of order
range, even if it brings new data, is now irrelevant.
This can happen for instance if there was a gap...
Philippe Antoine [Mon, 28 Feb 2022 10:19:49 +0000 (11:19 +0100)]
range: validity check when end is bigger than size
Ticket: 5132
Down the line, HttpRangeOpenFileAux assumes the range has a
valid value when doing buflen = end - start + 1;
Modupe Falodun [Mon, 28 Feb 2022 08:55:42 +0000 (09:55 +0100)]
detect-dnp3: remove dnp3_data unittests
These tests are reimplemented in Suricata-Verify
Task: 4911
Philippe Antoine [Mon, 28 Feb 2022 07:56:07 +0000 (08:56 +0100)]
util/mime: fix integer warnings
Ticket: 4516
Victor Julien [Thu, 24 Feb 2022 21:01:32 +0000 (22:01 +0100)]
detect: minor debug fixup
Victor Julien [Wed, 23 Feb 2022 19:58:57 +0000 (20:58 +0100)]
decode/vntag: don't leak memory in tests
Victor Julien [Wed, 23 Feb 2022 12:41:42 +0000 (13:41 +0100)]
unittests: clean up packet clear logic
Victor Julien [Wed, 23 Feb 2022 12:40:59 +0000 (13:40 +0100)]
decode: release refs from PacketFree
Mostly helps unittests.
Victor Julien [Wed, 23 Feb 2022 10:08:45 +0000 (11:08 +0100)]
detect/iprep: fix host locking issues
Separate the code paths between reusing a Packet stored host reference
and fetching a new reference from the host hash.
This addresses the issue where in some conditions use_cnt could get
desync'd.
Bug: #2802.
Victor Julien [Wed, 23 Feb 2022 10:05:40 +0000 (11:05 +0100)]
iprep: unify free handling
Introduce a new util function to free a Hosts iprep code. It also
handles the Host use_cnt decrement.
This change makes sure we also decrement the use_cnt when cleaning
up when shutting down the host table.
Move the BUG_ON check for use_cnt into the HostClearMemory() func
to check it in more cases.
Philippe Antoine [Thu, 7 Oct 2021 14:39:42 +0000 (16:39 +0200)]
bytejump: fix ubsan warning
Instead of checking the offset, we checked the pointer after
adding the offset ot it...
Jeff Lucovsky [Sat, 12 Feb 2022 14:46:29 +0000 (09:46 -0500)]
detect/ipproto: Use builtin protocol table
Issue 5072
This commit causes the built-in protocol table to be used for protocol
name and number validation.
Jeff Lucovsky [Thu, 17 Feb 2022 16:06:16 +0000 (11:06 -0500)]
detect/tests: Register protoname tests
Issue: 5072
This commit registers the proto-name unit tests.
Jeff Lucovsky [Thu, 17 Feb 2022 16:05:22 +0000 (11:05 -0500)]
detect/ipproto: Add init/release functions
Issue: 5072
This commit insures that the protocol name hashtables are initialized
and released.
Jeff Lucovsky [Sat, 12 Feb 2022 14:44:13 +0000 (09:44 -0500)]
util/proto: Protocol-name functions
Issue: 5072
This commit adds utility functions handling protocol names.
Jeff Lucovsky [Fri, 18 Feb 2022 12:41:13 +0000 (07:41 -0500)]
error/hash: Add error code for hash add failures
Issue: 5072
Andreas Dolp [Fri, 4 Feb 2022 18:49:23 +0000 (19:49 +0100)]
Doc: Fix typo in documentation of suricata.yaml.
Juliana Fajardini [Fri, 18 Feb 2022 14:24:25 +0000 (14:24 +0000)]
build-info: add info about fuzztargets
We were missing that information from the Development information
Shivani Bhardwaj [Sat, 19 Feb 2022 06:33:10 +0000 (12:03 +0530)]
doc: add usage of flowbits OR op
Ticket 5130
Juliana Fajardini [Fri, 18 Feb 2022 19:21:23 +0000 (19:21 +0000)]
devguide: clarify style guide for getframe funcs
As the GetFrameIdByName can be probed, we must warn developers not to
leave any output in them, or misleading messages could be printed.
Task #5129
Jeff Lucovsky [Fri, 11 Feb 2022 14:02:39 +0000 (09:02 -0500)]
threads: Honor per-thread stack size setting
Issue: 4550
This commit adjusts the per-thread stack size if a size has been
configured. If the setting has not been configured, the default
per-thread stack size provided by the runtime mechanisms are used.
Jeff Lucovsky [Fri, 11 Feb 2022 13:36:28 +0000 (08:36 -0500)]
config/thread: Use config'd per-thread stack size
Issue: 4550
This commit checks if there's a config setting for threading.stack-size
and assigns the value to a global variable for use during thread
creation.
Jeff Lucovsky [Fri, 11 Feb 2022 13:35:36 +0000 (08:35 -0500)]
suricata.yaml: Add per-thread stack size setting
Issue: 4550
Jeff Lucovsky [Tue, 15 Feb 2022 15:50:33 +0000 (10:50 -0500)]
config/debug: Debug probe for getattr_np
This commit adds a probe for a non-portable function to be used in
diagnostic debug display of a thread's stack size.
Jeff Lucovsky [Fri, 11 Feb 2022 13:34:12 +0000 (08:34 -0500)]
doc: Describe per-thread stack size config setting
Issue: 4550
This commit documents the new per-thread stack-size setting. Some
systems have a small default value that is not suitable for Suricata's
multi-threaded architecture and adjustment may be required.
Victor Julien [Mon, 21 Feb 2022 17:10:44 +0000 (18:10 +0100)]
nfs: clean up partial record handling
There should be no remaining data after parsing the partial
RPC record, so don't handle it but instead add a debug validation
bug on.
Successful processing for NFSv3 read/write records returns
AppLayerResult::ok() directly as all data is consumed.
Victor Julien [Mon, 21 Feb 2022 19:30:45 +0000 (20:30 +0100)]
nfs3: improve read validation; fix partial handling
Victor Julien [Mon, 21 Feb 2022 19:30:35 +0000 (20:30 +0100)]
nfs3: fix partial write record handling
Victor Julien [Sun, 20 Feb 2022 22:02:13 +0000 (23:02 +0100)]
nfs3: enforce more values
Enforce values of a number of u32's that are used as bools or for
really low values.
Victor Julien [Mon, 21 Feb 2022 09:08:41 +0000 (10:08 +0100)]
rpc: enforce various field values
Minimal frag_len. Correct msgtype and others.
Victor Julien [Sun, 20 Feb 2022 09:00:48 +0000 (10:00 +0100)]
nfs/rpc: update full record parsers to be more exact
Instead of 'take'ing all data for the RPC prog_data and then
letting the higher level parsers figure out which part to use
take the exact amount.
Victor Julien [Sun, 20 Feb 2022 07:59:05 +0000 (08:59 +0100)]
nfs: break out partial record handling
Victor Julien [Sat, 19 Feb 2022 07:42:35 +0000 (08:42 +0100)]
nfs/rpc: enforce length field limits
Limits based on the Linux kernel limits. Then multiplied a few times
to allow for other implementations to have higher limits.
Victor Julien [Mon, 21 Feb 2022 11:20:13 +0000 (12:20 +0100)]
nfs4: verify bool fields
Victor Julien [Fri, 18 Feb 2022 09:19:04 +0000 (10:19 +0100)]
output: fix timestamp missing usecs
On ARM 32bit with Musl `tv_usecs` is defined as `int64_t` which lead to
CreateIsoTimeString() printing all zeros on the usecs. Work around this
by first assigning to a `int64_t` and then updating the expected format
string to accept `int64_t`.
Bug: #5094.
Jason Ish [Thu, 17 Feb 2022 13:23:38 +0000 (07:23 -0600)]
rust/derive: pin proc-macro-crate to v1.1.0.
The just released proc-macro-crate v1.1.2 requires at least Rust 1.53.
Pin to the previous release for now.
Pierre Chifflier [Wed, 19 Jan 2022 10:58:49 +0000 (11:58 +0100)]
rust/mime: convert parser to nom7