Commit Graph

12298 Commits (40d1bb3422d7837e245d2588eb49ceb3ae70183e)
 

Author SHA1 Message Date
Philippe Antoine 40d1bb3422 mqtt: remove quadratic time complexity
When having many transactions in a single parsing call...

Fix has overhead of having one more field in the mqtt state.

Completes commit a8079dc978

Ticket: #5399
(cherry picked from commit e160917bcf)
3 years ago
Jeff Lucovsky ba37574ca5 mqtt: convert transaction list to vecdeque
Ticket: 5430
3 years ago
Philippe Antoine 18c616394e mqtt: make max transactions configurable
Allows users to find balance between completeness of decoding
and increases resource consumption, which can DOS suricata.

(cherry picked from commit e42094f238)
3 years ago
Philippe Antoine e029f80af2 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

(cherry picked from commit a8079dc978)
3 years ago
Victor Julien 7183e766f9 detect/flowbits: more permissive parsing by default
To get strict parsing, `--strict-rule-keywords=flowbits` command line
option can be used.

Bug: #5547.
3 years ago
Jason Ish 8174ba9e6f content: don't error out on incomplete hex
Before 6.0.6 if hex content was incomplete, Suricata didn't error out.
With 6.0.6 incomplete hex was detected and errored on which is a
breaking change in a release branch.  Instead, only emit a warning
unless strict content checking has been requested.

To enable strict behaviour on incomplete content hex in a rule,
"--strict-rule-keywords=content" can be used on the command line.

Issue: #5546
3 years ago
Jason Ish 726de4e70c detect: allow rule errors to display error, but not be fatal
Add a new setup return code, -4 which will print the error, but not
error out in test mode. This is to support allowing incomplete hex, as
there is no context as to which rule had the issue.

For context:
- -3: error ok, no message
- -2: error not ok, no message
- -4: error ok, message
3 years ago
Victor Julien f40ad90adf detect: fix duplicate detect state issue
For protocols with multi buffer inspection there could be multiple times
the same sid would be queued into the candidates queue. This triggered
a debug validation check.

W/o debug validation this would lead to duplicate work and possibly multiple
alerts where a single one would be appropriate.

Bug: 5419.
(cherry picked from commit 1bff888947)
3 years ago
Philippe Antoine dbadca1567 detect: transforms check for 0-sized buffer
So as to avoid undefined behavior with a 0-sized variable length
array

Ticket: #5521
(cherry picked from commit 61b73416e2)
3 years ago
Juliana Fajardini fff9d529b7 exceptions: add reject support to exception policy
This enables the usage of 'reject' as an exception policy. As for both
IPS and IDS modes the intended result of sending a reject packet is to
reject the related flow, this will effectively mean setting the reject
action to the packet that triggered the exception condition, and then
dropping the associated flow.

Task #5503

(cherry picked from commit bbd968c738)
3 years ago
Victor Julien 336cd57234 stream/ids: make sure we don't slide past last_ack
Bug: #5401.
(cherry picked from commit f04b7a1827)
3 years ago
Victor Julien a383f29aa2 decode/tcp: allow 4 byte TFO with 2 byte cookie
(cherry picked from commit f5bd55dac8)
3 years ago
Gleb Smirnoff ae9b4144be ipfw: use PF_DIVERT on modern FreeBSD
(cherry picked from commit 5dbbc52b06)
3 years ago
Victor Julien d483ace444 unittests: optimize RunmodeIsUnittests()
(cherry picked from commit 86e600dab8)
3 years ago
Philippe Antoine 16da02cfbd http2: remove to_vec for comparisons
Ticket: #5454
(cherry picked from commit 9b4a133777)

Conflict fixed by Philippe Antoine
3 years ago
Philippe Antoine eae0aadab8 http2: fix clippy warning about &Vec<u8>
Using &[u8] instead in function prototype

(cherry picked from commit d011b468da)

Conflict fixed by Philippe Antoine
3 years ago
Victor Julien 275975c699 github-ci: add cherry-pick line check 3 years ago
Victor Julien 0a6e2b9d1a flow/recycler: bring back pthread_cond_t sleep
Bug #4379.

(cherry picked from commit f271fb4575)
3 years ago
Victor Julien 33446b0f64 flow/manager: sleep handled by pthread_cond_t again
Use only in live mode to allow FM to respond quickly to time
increases in offline mode.

Bug #4379.

(cherry picked from commit e6ac2e4e8a)
3 years ago
Victor Julien bb8f743870 time: add timeradd implementation
timeradd isn't available on MinGW.

(cherry picked from commit 39141a8836)
3 years ago
Philippe Antoine 739eba94a5 fuzz: restrict flags passed to AppLayerProtoDetectGetProto
Manual adaptation of 05f9b3f and f4449d3
3 years ago
Philippe Antoine ed15b0d6ab http2: check overflow before it happens
instead of checking afterwards if value got smaller

(cherry picked from commit b86beb9b68)

Manually adapted to make it work with MSRV
3 years ago
Juliana Fajardini ac67593a0e userguide: briefly introduce exception policy opts
Added them in the configuration section so folks can be more aware of
them, while a more complete documentation isn't around.

Related to
Task #5475

(cherry picked from commit ef54f36e34)
3 years ago
Juliana Fajardini 374e4879a1 userguide: update defrag settings options
We were still mentioning that there were only three options.

(cherry picked from commit 3c74e443bd)
3 years ago
Juliana Fajardini 6f360471e3 userguide: add section about HTTP2 settings
This was in master but not in 60x yet.
3 years ago
Juliana Fajardini 06091e0fc6 userguide: merge sections about AppLayer Parsers
We had two sections under the suricata.yaml configuration section
describing settings for application layer parsers. This merges them into
one and also fixes a few subsection title levels.

Task #5364

(cherry picked from commit 0cc040cf61)
3 years ago
Juliana Fajardini 38cdfdfdf7 suricata.yaml: add exception policy config options
Related to
Task #5468

(cherry picked from commit fc81c80c04)
3 years ago
Juliana Fajardini 05378946dc stream: add exception policy for midstream flows
This allows to set a midstream-policy that can:
- fail closed (stream.midstream-policy=drop-flow)
- fail open (stream.midstream-policy=pass-flow)
- bypass stream (stream.midstream-policy=bypass)
- do nothing (default behavior)

Usage and behavior:

If stream.midstream-policy is set then if Suricata identifies a midstream flow
it will apply the corresponding action associated with the policy.

No setting means Suricata will not apply such policies, either inspecting the
flow (if stream.midstream=true) or ignoring it stream.midstream=false.

Task #5468

(cherry picked from commit aa5bb2c329)
3 years ago
Juliana Fajardini 430bb1cf74 exceptions: add callbacks for drop-flow policy
Make sure that when the policy is to drop the flow, we set no inspection
for payload and packet and disable applayer inspection as well.

Task #5468

(cherry picked from commit 242b8f7d65)
3 years ago
Jason Ish 6f1f651906 github-ci: add AlmaLinux 9 build
(cherry picked from commit 2b83cc799d)
3 years ago
Jason Ish a7d353edb4 github-ci: test execution of suricatasc and suricata-update
(cherry picked from commit d9b6e1d967)
3 years ago
Jason Ish c8a3aa608e python: install without distutils
Instead of using distutils/setuptools for installing the Python code,
just install it into our own Python directory.

Distutils is being removed from Python, and setuptools doesn't work well
when trying to install into your own location. For our usage its just
simpler to install with make.

In addition to removing the configure check for distutils, also remove
the check for pyyaml. This lets the user install pyyaml after Suricata
is installed, and Suricata-Update does handle this case gracefully.

Issue: #5313

(cherry picked from commit 9a1d6af858)
3 years ago
Shivani Bhardwaj 8762699edf doc/conf: fix sphinx language setting
sphinx-build 5.1.1 and above throws a warning which is treated as an
error while building.

Invalid configuration value found: 'language = None'. Update your configuration to a valid language code. Falling back to 'en' (English).

(cherry picked from commit 2c4d6b33ae)
3 years ago
Juliana Fajardini 0a124f2d27 exceptions: error out when invalid policy is used
Before, if an invalid value was passed as exception policy, Suricata
would log a warning and set the exception policy to "ignore". This is a
very different result, than, say, dropping or bypassing a midstream flow.

Task #5504

(cherry picked from commit 58ef3cde7a)
3 years ago
Victor Julien 449944ebec github: bump ubuntu-18.04 runners to 22.04
(cherry picked from commit 3dea69ec83)
3 years ago
Juliana Fajardini d21d4c757e detect/parse: test sig parsing for more actions
Our unittests were only covering sig parsing for alert actions. As in
environments without LibNet the reject action will not work, we must
ensure that our parser properly fails in such cases, instead of silently
accepting an unsupported action.

Added tests for the reject and drop action.

Task #5496

(cherry picked from commit c81b78fd1c)
3 years ago
Juliana Fajardini 15ec08881e detect/engine: fix typos in assorted files
(cherry picked from commit 5f4bcfe313)
3 years ago
Juliana Fajardini 8f3ec86e17 commandline: add alert-queue expand failure option
For testing purposes. Meant to simulate a reallocation failure when
dynamically growing the alert queue in DetectEngineThreadCtx, so we can
check that Suri's behavior doesn't break under such circumstances.

Task #5319

(cherry picked from commit 58928b249d)
3 years ago
Philippe Antoine 7dc493cf55 fuzz: disable enip detection based on source port
So as to avoid fuzzing detecting protocol polyglots with enip

(cherry picked from commit d1ebf320f7)
3 years ago
Juliana Fajardini 1710c5f13d decode: remove unused macros
With the recent changes, these macros weren't being used anymore.

Related to
Bug #5458

(cherry picked from commit e7727c3744)
3 years ago
Juliana Fajardini dcf990c7d0 stream/tcp: remove repeated header declaration
StreamTcpRegisterTests was being declared twice.

(cherry picked from commit d07a6c6174)
3 years ago
Juliana Fajardini 2b59f65d02 detect/alert: add unittests to check packet action
Add unittests to check that packet flags are correctly updated after
detection finds drop or reject rules that match.

Related to
Bug #5458

(cherry picked from commit f897761ecb)
3 years ago
Juliana Fajardini b3ae9f840a decode: validate if dropped packet has drop reason
Related to
Bug #5458

(cherry picked from commit abd595d695)
3 years ago
Juliana Fajardini 32f90371d9 detect/alert: ensure reject action is applied
Bug 5458 states that the reject action is no longer working. While SV
tests that use the reject action still pass, it indeed seems that a
regression has happened with commit aa93984, because while the
function that applies rule actions to the flow (RuleActionToFlow) does
check for the reject action, the newly added function PacketApply
SignatureActions only checks for ACTION_DROP or ACTION_PASS when
deciding to call RuleActionToFlow.

Bug #5458

(cherry picked from commit 1f54e8611a)
3 years ago
Juliana Fajardini 6742ecbc9e decode: make PacketDrop use action as parameter
A Packet may be dropped due to several different reasons. This change
adds action as a parameter, so we can update the packet action when we
drop it, instead of setting it to drop.

Related to
Bug #5458

(cherry picked from commit 1774ff18a6)
3 years ago
Juliana Fajardini c56871c9e6 source/pcap: fix infinite loop if interface goes down
When in live-pcap mode, if the sniffed interface went down and up again,
Suri would enter an infinite and keep running, while not registering new
events. This fixes that behavior by allowing Suri to retry to open the
pcap in case of a retry on an already activated capture
('PCAP_ERROR_ACTIVATED').

This change is based on Zhiyuan Liao's work.

Bug #3846

(cherry picked from commit 2544be4672)
4 years ago
Jufajardini Reichow 41967bf119 detect/engine: init alert queue counters on reload
alert_queue_overflow and alerts_suppressed were not being
reinitialized when there was a reload of Suricata rules, leading to
non-valid stats counters if that happened.

Bug #5457

(cherry picked from commit 93c2c9743d)
4 years ago
Jason Ish b8875d4a22 rust/nfs: add a maximum number of operations per compound
This is a backport of ea1d03f8e3 by Pierre
Chifflier adapted for 6.0.x.

> The `count` combinator preallocates a number of bytes. Since the value
> is untrusted, this can result in an Out Of Memory allocation.
> Use a maximum value, large enough to cover all current implementations.

Ticket: #5448
4 years ago
Jason Ish 18d18105f0 readthedocs: add configuration file
Readthedocs is attempting to use our /requirements.txt file as a Python
requirements file, which it is not. Add a Readthedocs configuration file
to tell it to not use any requirements file.
4 years ago
Jason Ish 2fc2297ff9 .gitignore: don't ignore *.yaml, just suricata.yaml 4 years ago