Commit Graph

12750 Commits (1aac268242002b333fcca3a619867146d6a30f30)
 

Author SHA1 Message Date
Victor Julien 1aac268242 pcap: support LINKTYPE_IPV6 (229)
This is just another variant of DLT_RAW.

Ticket: #6943.
(cherry picked from commit 76322368ed)
2 years ago
Victor Julien 6f1412c901 defrag: fix wrong datalink being logged
Eve's packet_info.linktype should correctly indicated what the `packet`
field contains. Until now it was using DLT_RAW even if Ethernet or other
L2+ headers were present.

This commit records the datalink of the packet creating the first
fragment, which can include the L2+ header data.

Bug: #6887.
(cherry picked from commit 49c67b2bb1)
2 years ago
Victor Julien 5950fe2cda defrag: match up v4 and v6 packet setup
v4 was doing redundant recursion level setup.

v6 was missing PKT_REBUILT_FRAGMENT flag.

(cherry picked from commit af97316f42)
2 years ago
Philippe Antoine fa6c003f16 rust/mqtt: fix clippy 1.77 warning
error: creating a mutable reference to mutable static is discouraged
   --> src/mqtt/mqtt.rs:752:23
    |
752 |     let max_msg_len = &mut MAX_MSG_LEN;
    |                       ^^^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
    = note: this will be a hard error in the 2024 edition
    = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
2 years ago
Philippe Antoine 47781a7985 rust: fix clippy 1.77 warning
Ticket: 6883

error: field `0` is never read
  --> src/asn1/mod.rs:36:14
   |
36 |     BerError(Err<der_parser::error::BerError>),
   |     -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     field in this variant
   |

(cherry picked from commit 02f2fb8833)
2 years ago
Philippe Antoine 77563fd27c conf: avoid quadratic complexity
Ticket: 6878

Follow up on 15649424a7

When adding many sequence nodes, either from start or scalar event

We add "sequence nodes" whose name is an integer cf sequence_node_name
and then run ConfNodeLookupChild to see if it had been already set
(from the command line cf comment in the code)
And ConfNodeLookupChild iterates the whole linked list...

1. We add node 1
2. To add node 2, we check if node 1 equals this new node
3. To add node 3, we check if nodes 1, or 2 equals this new node's name
And so on...

This commits avoids these checks ig the list is empty at the beginning

(cherry picked from commit 240e068b81)
2 years ago
Shivani Bhardwaj 3422764933 version: start development towards 6.0.19 3 years ago
Shivani Bhardwaj 7ac695ba26 release: 6.0.18; update changelog 3 years ago
Philippe Antoine c2202b152e rust: fix build with MSRV
Ticket: 6876

Do not backport try_string_from_bytes as it uses try_reserve
And just use string_from_bytes instead

Fixes: b9963b3e29 ("ssh: limit length for banner logs")
3 years ago
Victor Julien a4d3e9b1a1 rust: add MSRV as rust-version
Update github-actions to use it for the MSRV check.
3 years ago
Shivani Bhardwaj 7b53aedad5 version: start development towards 6.0.18 3 years ago
Shivani Bhardwaj 51285f2f13 release: 6.0.17; update changelog 3 years ago
Philippe Antoine b9963b3e29 ssh: limit length for banner logs
Ticket: 6770
(cherry picked from commit c4b8fb7aca)
3 years ago
Philippe Antoine a947228259 ssh: avoid quadratic complexity from long banner
Ticket: 6799

When we find an overlong banner, we get into the state just
waiting for end of line, and we just want to skip the bytes
until then.
Returning AppLayerResult::incomplete made TCP engine retain
the bytes and grow the buffer that we parsed again and again...

(cherry picked from commit 271ed2008b)
3 years ago
Jason Ish 0dfa339cc9 ci: update ubuntu22.04 builds with clang14+asan
using a workround about ASLR

Backport of 632e52ca2b but not a cherry
pick.
3 years ago
Philippe Antoine 7596c4a76d detect: update packet action on protocol change
Ticket: #6305

When running FlowWorkerStreamTCPUpdate, one of the dequeued packet
may set the flow action to drop, without updating the not-pseudo
packet action, as is done usually with a previous call to
FlowHandlePacketUpdate

(cherry picked from commit 4c4f7ff1a2)
3 years ago
Victor Julien b85255cf59 yaml: remove newline from error message
(cherry picked from commit f53c4ab149)
3 years ago
Alexey Simakov 5fbca79aaf util/mime: fix memory leak
Fix memory leak at util-decode-mime:MimeDecInitParser, which
root cause is not-freeing allocated memory for mimeMsg

Bug: #6745
(cherry picked from commit 231c892bef)
3 years ago
Victor Julien 84714b3cb4 multi-tenant: fix loader dead lock
A dead lock could occur at start up, where a loader thread would
get stuck on it's condition variable, while the main thread was
polling the loaders task results.

The vector to the dead lock is as follows:

main	                        loader
DetectEngineMultiTenantSetup
-DetectLoaderSetupLoadTenant
--DetectLoaderQueueTask
---lock loader
---add task
---unlock loader
	                        lock loader
	                        check/exec tasks
	                        unlock loader
---wake up threads
	                        lock ctrl mutx
	                        cond wait ctrl
	                        unlock ctrl
-DetectLoadersSync
--lock loader
--check tasks
--unlock loader

Between the main thread unlocking the loader and waking up the
threads, it is possible that the loader has already moved ahead
but not yet entered its conditional wait. The main thread sends
its condition signal, but since the loader isn't yet waiting on
it the signal is ignored. Then when the loader does enter its
conditional wait, the signal is not sent again.

This patch updates the logic to send signals much more often.
It also makes sure that the signal is sent under lock, as the
API requires.

Bug: #6767.

Co-authored-by: Shivani Bhardwaj <shivani@oisf.net>
3 years ago
Ralph Eastwood 87ab88dc58 napatech: update docs to remove hba reference
(cherry picked from commit 9865164e75)
3 years ago
Ralph Eastwood 64eeb55692 napatech: remove deprecated hba support
(cherry picked from commit 7b0a5dae60)
3 years ago
Shivani Bhardwaj 48f5da9002 version: start development towards 6.0.17 3 years ago
Shivani Bhardwaj b46ffaaf43 release: 6.0.16; update changelog 3 years ago
Philippe Antoine b1549e930f http2: limit number of concurrent transactions
Ticket: 6481

Instead of just setting the old transactions to a drop state so
that they get later cleaned up by Suricata, fail creating new ones.

This is because one call to app-layer parsing can create many
transactions, and quadratic complexity could happen in one
single app-layer parsing because of find_or_create_tx

(cherry picked from commit 80abc22f64)
3 years ago
Philippe Antoine 83c5567ea7 smtp: avoid creating empty transaction
Ticket: 6477

So as to avoid ending up with too many empty transactions.

This happens when Suricata sees a DATA command in the current
transaction but did not have a confirmation response for it.
Then, if Suricata receives another DATA command, it will
create another new transaction, even if the previous one
is empty. And so, a malicious client can create many empty
transactions by just sending a repeated amount of DATA commands
without having a confirmation code for them.

Suricata cannot use state->current_command == SMTP_COMMAND_DATA
to prevent this attack and needs to resort to a new boolean
is_data because the malicious client may send another dummy command
after each DATA command.

This patch leaves only one call to SMTPTransactionCreate

(cherry picked from commit 61f2e4e1e5)
3 years ago
Philippe Antoine 2a2120ecf1 smtp: config limit maximum number of live transactions
Unlike the original commit, this fix just sets a limit but does not
expose it as a configurable option.

Ticket: #6477

(cherry picked from commit 8f73a0ac55)
3 years ago
Philippe Antoine 8efaebe293 http1: configurable max number of live tx per flow
Unlike the original commit, this commit just enforces a maximum limit,
but does not expose the configuration of it.

Ticket: #5921

(cherry picked from commit 4175680a8a)
3 years ago
Philippe Antoine 18841a58da http1: remove transactions from their list
instead of keeping a NULL pointer in an array

Ticket: #5921

(cherry picked from commit 8f63a8f3bf)
3 years ago
Philippe Antoine ffed4b35cb http2: handle reassembly for continuation frames
Ticket: 5926

HTTP2 continuation frames are defined in RFC 9113.
They allow header blocks to be split over multiple HTTP2 frames.
For Suricata to process correctly these header blocks, it
must do the reassembly of the payload of these HTTP2 frames.
Otherwise, we get incomplete decoding for headers names and/or
values while decoding a single frame.

Design is to add a field to the HTTP2 state, as the RFC states that
these continuation frames form a discrete unit :
> Field blocks MUST be transmitted as a contiguous sequence of frames,
> with no interleaved frames of any other type or from any other stream.
So, we do not have to duplicate this reassembly field per stream id.

Another design choice is to wait for the reassembly to be complete
before doing any decoding, to avoid quadratic complexity on partially
decoding of the data.

(cherry picked from commit aff54f29f8)
3 years ago
Jason Ish 39570d8d05 rules: use primary default-rule-path if set on command line
When reloading rules, respect `--set default-rule-path=...` from the
command line if set.

Previously the rule reload would always take the default-rule-path from
the configuration file, even if overrided on the command line.

Issue: #1911
(cherry picked from commit 3ea6572e22)
3 years ago
Philippe Antoine a31ff846ec mpm: allocate StateQueue on the heap
So that we can have multi-tenant on MacOS without stack
overflows because of the size of the structure...

Ticket: #6263.
(cherry picked from commit 92fce2fdc0)
3 years ago
Victor Julien 11262a94de detect: fix path creation in Windows
Fixes file loading for rule files and Lua scripts.

Bug: #6095.
(cherry picked from commit 04aee5f099)
3 years ago
Victor Julien 13625cf7cc detect: free all tenant detect engines
Free all tenants registered in the master.

(cherry picked from commit a4d80bc7c4)
3 years ago
Jason Ish d323467c9a requirements: use libhtp 0.5.x
Move to libhtp to the 0.5.x branch instead of 0.5.45.

(cherry picked from commit c3b3c11e30)
3 years ago
Victor Julien f3648413b5 github-ci: only specify major version for alma 3 years ago
Lukas Sismis 02cb2dbe8d github-ci: add eBPF to the builds workflow
Ticket: #6602
3 years ago
Philippe Antoine 47c5d2b0fa doc: fix byte_test examples
As this keyword has 4 mandatory arguments, and some examples
had only three...

Ticket: 6629
(cherry picked from commit 4933b817aa)
3 years ago
Lukas Sismis 78c9722243 doc: update userguide installation instructions
The commit updates obsolete installation instructions
from the userguide and reformats certain parts for
improved clarity.

Ticket: #5988
3 years ago
Eric Leblond 16fbfe1f61 configure: fix llc detection on recent Debian
Where clang --version was returning:

clang version 9.0.1-15+b1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Newer version like clang-10 on Debian are returning:

Debian clang version 10.0.1-8+b1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

As a result the parsing was failing to determine which llc was
available on the system.

Ticket: #6598

(cherry picked from commit 37b1595c20)
3 years ago
Jeff Lucovsky 9602fe60ca detect/analysis: Move globals to engine ctx
Issue: 6239

This commit moves the global variables associated with engine analysis
into the detect engine context. Doing so provides encapsulation of the
analysis components as well as thread-safe operation in a multi-tenant
(context) deployment.

(cherry picked from commit c8615bcd47)
3 years ago
Jason Ish b8cf5ac398 github-ci: cancel previous builds workflow for branch
On a push of the same branch, cancel the previous running builds.yml
workflow.

(cherry picked from commit 2b9603d94d)
3 years ago
Jason Ish e1384734ac github-ci: remove Fedora 36, 37; add Fedora 39
Fedora 36 is EOL and some mirrors have been removed. Fedora 37 security
updates stop in in December 2023.
3 years ago
jason taylor a94254b53b doc: update file.data keyword documentation
Signed-off-by: jason taylor <jtfas90@gmail.com>
3 years ago
Juliana Fajardini 57a7d2830d userguide: update tls not_after/not_before mentions
Our tls fields not_after and not_before are actually logged as
`notafter` and `notbefore`, but were documented with the underscore.

Update the documentation, since updating the log format itself would be
a breaking change.

Task #5494

(cherry picked from commit a649a92afd)
3 years ago
Philippe Antoine 24404135e9 http2: app-layer event for userinfo in uri
Ticket: #6426

as per RFC 9113
":authority" MUST NOT include the deprecated userinfo subcomponent
for "http" or "https" schemed URIs.

(cherry picked from commit e3cd0d073f)
3 years ago
Travis Green d12a544891 doc: add tcp flags documentation
Signed-off-by: jason taylor <jtfas90@gmail.com>
(cherry picked from commit 96a0e7016f)
3 years ago
Victor Julien 0cfe81cc2b host/iprep: run all timeout logic
Run all timeout logic if iprep is in use as well.

Minor code cleanups.

Bug: #6436.
(cherry picked from commit 6307a4d4b9)
3 years ago
Philippe Antoine 595149d1e8 http2: event on mismatch between authority and host
Ticket: #6425
(cherry picked from commit 46a46e5b1f)
3 years ago
Jason Ish b0e8b6fb07 dns/eve: use default formats if formats is empty
If the configuration field "formats" is empty, DNS response records do
not have any relevant information other than that there was a
response, but not much about the response.

I'm pretty sure the intention here was to log the response details if
no formats were provided, which is what happens when the field is
commented out.

So if no formats are specified, use the default of all.

Bug: #6420
(cherry picked from commit a240a93b69)
3 years ago
Jeff Lucovsky 9e0c7c4b54 detect/bytejump: Improve end-of-buffer handling
Issue: 4623

This commit addresses the issues reported in issue 4623 when the jump
value points at the last byte in the buffer.

(cherry picked from commit f363b99fd7)
3 years ago