Commit Graph

12774 Commits (suricata-6.0.20)
 

Author SHA1 Message Date
Victor Julien 71ec1c85ff detect/content: cleanup nocase conversion
(cherry picked from commit ef936acdba)
2 years ago
Victor Julien 69895fbe00 detect/fileext: reimplement based on file.name
Ticket: #6194.
(cherry picked from commit 9b09b29350)
2 years ago
Victor Julien aee7ced345 detect/filename: switch to file.name implementation
Ticket: #6194.
(cherry picked from commit 74f095c915)
2 years ago
Victor Julien bb2758e01c detect/filemagic: switch to file.magic implementation
Replace implementation of the legacy `filemagic` keyword by the
implementation for the `file.magic` variant. This leads to better
performance and hooks the rules into the detection engine better.

Remove unittests that depended on the old logic.

Ticket: #6194.
(cherry picked from commit 1f22b51848)
2 years ago
Victor Julien ae9422fec9 detect/tls: minor fingerprint cleanup
(cherry picked from commit ee68947460)
2 years ago
jason taylor 0e6e5f562d userguide: add details about tcp flow pass
Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years ago
jason taylor 5a6700e2b6 doc: hyperscan information updated
Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years ago
jason taylor 5bff34860f doc: update file.name keyword information
Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years ago
jason taylor ee9637f5a7 doc: update fileext keyword information
Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years ago
jason taylor fba868a94e doc: update file.magic information
Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years ago
Victor Julien 8cc59df576 stream: special handling for RST data
Data on RST packets is not invalid, but also shouldn't be used
in reassembly.

RFC 1122:

  4.2.2.12  RST Segment: RFC-793 Section 3.4

    A TCP SHOULD allow a received RST segment to include data.

    DISCUSSION
        It has been suggested that a RST segment could contain
        ASCII text that encoded and explained the cause of the
        RST.  No standard has yet been established for such
        data.

RST data will be presented to the detection engine per packet,
but will not be part of stream reassembly.

Bug: #6244.
(cherry picked from commit b63374bf5f)
2 years ago
Victor Julien 71a0084b70 stream: add stream.rst_with_data event for RST with data
(cherry picked from commit 9ba55b8a28)
2 years ago
Juliana Fajardini 8bc6514e02 userguide/install: add info on ubuntu ppa installs
Bringing info that was only in our Redmine wiki to our documentation,
and update package to Suricata-6.0, now that the stable points to
Suricata 7.

Task #6231

(cherry picked from commit 4fd3205bf0)
2 years ago
Juliana Fajardini 15b100bc4c userguide/eve: format and reorganize alert section
The `field action` portion seemed to be comprised of a more generic
section that followed it. Also formatted the section for lines to be
within the character limit.

(cherry picked from commit 9900bdc162)
2 years ago
Juliana Fajardini 5eeb81563f output/drop: add verdict field
Related to
Bug #5464

(cherry picked from commit 0437173848)
2 years ago
Juliana Fajardini 8ef2940af4 output/alert: add verdict field
Related to
Bug #5464

(cherry picked from commit 53b8defd79)
2 years ago
Shivani Bhardwaj 9e2fb158ab dcerpc: accept ALTER_CONTEXT as a valid request
So far, if only the starting request was a DCERPC request, it would be
considered DCERPC traffic. Since ALTER_CONTEXT is a valid request type,
it should be accepted too.

Reported and patch proposed in the following Redmine ticket by
InterNALXz.

Bug 6191

(cherry picked from commit 8770431986)
2 years ago
Juliana Fajardini bbfc445b4a exception: fix use of master switch with default
If an exception policy wasn't set up individually, use the GetDefault
function to pick one. This will check for the master switch option and
handle 'auto' cases.

Instead of deciding what the auto value should be when we are parsing
the master switch, leave that for when some of the other policies is to
be set via the master switch, when since this can change for specific
exception policies - like for midstream, for instance.

Update exceptions policies documentation to clarify that the default
configuration in IPS when midstream is enabled is `ignore`, not
`drop-flow`.

Bug #6169

(cherry picked from commit e306bc6ecc)
2 years ago
Juliana Fajardini 33bd94ccbe exception: fix 'auto' for master switch in IDS
If the master exception policy was set to 'auto' in IDS mode, instead of
just setting the master switch to the default in this case, which is
'ignore', the engine would switch a warning saying that auto wasn't a
valid config and then set the policy to ignore.

This makes 'auto' work for the master switch in IDS, removes function
for setting IPS option and handles the valid IDS options directly from
the function that parses the master policy, as this was the only place
where the function was still called.

Bug #6149

(cherry picked from commit feb47f9a89)
2 years ago
Victor Julien 922706498c exception/policy: minor code cleanup
(cherry picked from commit 479fa609fa)
2 years ago
Juliana Fajardini c0efcbc407 stream/tcp: re-enable midstream-policy usage
We were always setting it to ignore, due to bug 5825.

The engine will now issue an initialization error if an invalid value
is passed in the configuration file for midstream exception policy.

'pass-packet' or 'drop-packet' are never valid, as the midstream policy
concerns the whole flow, not making sense for just a packet.

If midstream is enabled, only two actual config values are allowed:
'ignore' and 'pass-flow', both in IDS and in IPS mode. In default mode
('auto' or if no policy is defined), midstream-policy is set to
'ignore'. All other values will lead to initialization error.

In IDS mode, 'drop-flow' will also lead to initialization error.

Part of
Bug #5825

(cherry picked from commit 69d3750aaf)
2 years ago
Juliana Fajardini 49ba6db3f3 exception: extract 'auto' check to function
Part of
Bug #5825

(cherry picked from commit e849afbda1)
2 years ago
Juliana Fajardini 298706d5bd exception: use mix of logconfig/info/warning
Use a mix of SCLogConfig, Warning and Info.
This mix works as follows: when something unnexpected for the user
happens - for instance, the engine ignoring an invalid config value, we
use warning. For indicating the value for the master switch, which
happens only once, we use Info. For all the other cases, we use
SCLogConfig.

It is possible that SCLogConfig isn't showing at the moment, this is a
possible bug to investigate further.

Related to
Bug #5825

(cherry picked from commit 69311ab02f)
2 years ago
Juliana Fajardini 5116713e95 exception: parse config values, don't post process
Get the enum values from the config file. Update the new extracted
functions. Post-process the config values based on runmode and policy.
Also handle 'auto' enum value in these.

Related to
Bug #5825

(cherry picked from commit 7f8536b81c)
2 years ago
Juliana Fajardini d6bfcc0124 exception/midstream: parse midstream policy alone
As the midstream exception policy has its own specific scenarios, have a
dedicated function to parse and process its config values, and check for
midstream enabled when needed.

Related to
Bug #5825

(cherry picked from commit f97af0c0b1)
2 years ago
Juliana Fajardini 4e067da14a exception: refactor exception policy parse fn
Split up ExceptionPolicyParse to try to improve readability.

Related to
Bug #5825

(cherry picked from commit bf22129a0f)
2 years ago
Juliana Fajardini 82aa48f0e8 userguide: update exception policy behaviors table
Some exception policies can only be applied to the triggering packet or
only make sense considering the whole flow. Highlight such cases in the
table showing each exception policy.

Related to
Bug #5825

(cherry picked from commit c0db25d055)
2 years ago
Juliana Fajardini 63b2792f65 doc: add midstream scenarios for exception policy
The different interactions between midstream pick-up sessions and the
exception policy can be quite difficult to visualize. Add a section for
that in the userguide.

Related to
Bug #5825

(cherry picked from commit 0c2922f02e)
2 years ago
Juliana Fajardini 05ad4bd9b3 misc: fix typos, doc, update copyright years
Updated FlowGetNew documentation, where it said NULL was only returned
in case of error.

(cherry picked from commit f511a4ae3f)
2 years ago
Juliana Fajardini 5e674aaaa7 defrag: clean up existing stats counters
7a044a99ee removed the lines that incremented these defrag
counters, but kept the entities themselves. This commit removes counters
that we judge too complex to maintain, given the current state of the
code, and re-adds incrementing max_hit (memcap related).

Related to
Task #5816

(cherry picked from commit a37a88dcd5)
2 years ago
Juliana Fajardini c3b97b4d08 exception: in ids mode, only REJECT the packet
In case of 'EXCEPTION_POLICY_REJECT', we were applying the same behavior
regardless of being in IDS or IPS mode.
This meant that (at least) the 'flow.action' was changed to drop when we
hit an exception policy in IDS mode.

Bug #6109

(cherry picked from commit 8f324e3b3d)
2 years ago
Juliana Fajardini 6a32139a65 exceptions: add master switch config option
This allows all traffic Exception Policies to be set from one
configuration point. All exception policy options are available in IPS
mode. Bypass, pass and auto (disabled) are also available in iDS mode

Exception Policies set up individually will overwrite this setup for the
given traffic exception.

Task #5219

(cherry picked from commit 0d9289014b)
2 years ago
Shivani Bhardwaj 77faa8833f workflows: use debug-failed for s-v run 2 years ago
Shivani Bhardwaj cdd6e20fba util/mime: skip over any invalid char
For certain edge case handling for spaces, spaces were handled
particularly in the remainder processing functions. Make sure that now
that as per RFC 2045, util-base64 would skip over any invalid char, the
edge cases in MIME processor also be handled the same way.

This completes the work done in e46b033.

Ticket 6135
Ticket 6207

(cherry picked from commit 789353bc1e)
2 years ago
Shivani Bhardwaj 6b42c09634 util/base64: fix tests for RFC2045
(cherry picked from commit 49ad38329a)
2 years ago
Shivani Bhardwaj 3661231c9a util/base64: update test macro to use user data
(cherry picked from commit c2ae87eecf)
2 years ago
Shivani Bhardwaj 9308a6c7a8 util/base64: check dest buf size to hold 3Bytes
The destination buffer should be able to hold at least 3 Bytes during
the processing of the last block of data. If it cannot hold at least 3
Bytes, then that may lead to dynamic buffer overflow while decoding.

(cherry picked from commit 62d782156c)
2 years ago
Shivani Bhardwaj cb9dd4be1d util/base64: check for dest buf size in last block
Just like the check for destination buffer size done previously for
complete data, it should also be done for the trailing data to avoid
goind out of bounds.

(cherry picked from commit 0e8b451699)
2 years ago
Shivani Bhardwaj f7b5bda272 util/base64: fix padding bytes for trailing data
Padding bytes for the last remainder data should be as follows:

Case   |    Remainder bytes     |    Padding
----------------------------------------------
  I    |              1         |      3
  II   |              2         |      2
  III  |              3         |      1

However, we calculate the decoded_bytes with the formula:
decoded_bytes = ASCII_BLOCK - padding

this means for Case I when padding is 3 bytes, the decoded_bytes would
be 0. This is incorrect for any trailing data. In any of the above
cases, if the parsing was successful, there should at least be 1 decoded
byte.

(cherry picked from commit 095c335c72)
2 years ago
Shivani Bhardwaj 328e2474d3 util/base64: skip any invalid char for RFC2045
RFC 2045 states that any invalid character should be skipped over, this
is the RFC used by mime handler in Suricata code to deal with base64
encoded data.
So far, only spaces were skipped as a part of implementation of this
RFC, extend it to also skip over any other invalid character. Add
corresponding test.

(cherry picked from commit e46b0337e5)
2 years ago
Shivani Bhardwaj bb242a04be util/base64: add test for long string w RFC4648
(cherry picked from commit 85ae1d25e4)
2 years ago
Philippe Antoine ce67172bbf decode: fix offset for DCE layer
Fixes: 136d351e40 ("decode: single network layer entrypoint")

Ticket: #3637
(cherry picked from commit fdf9cdf400)
2 years ago
Shivani Bhardwaj 71ebd0bd77 rust: fix compiler warnings 2 years ago
Jeff Lucovsky e25082c084 detect/multi-tenant: Make tenant_id 32 bits everywhere
Issue: 6047

This commit ensures that the tenant id is contained in a unsigned 32 bit
container.

(cherry picked from commit 9fd77c737f)
2 years ago
Cole Dishington 970d81ba91 decode-ipv6: Set L4 proto on ipv6 incase of GRE decode error
Set the L4 proto before decoding GRE in ipv6 decoding in case there is a
GRE header decoding error.

Bug: #6222
(cherry picked from commit 1b08c561f6)
2 years ago
Victor Julien 79c9d3e1ca rust: lock proc-macro2 to maintain MSRV 2 years ago
Sascha Steinbiss 74cbbd7ef4 rfb: also set unimplemented auth types
(cherry picked from commit 1521b77edd)
2 years ago
Sascha Steinbiss b1d2d78622 rfb: ensure logging of incompletely parsed txs
(cherry picked from commit 1606aca881)
2 years ago
Sascha Steinbiss 8f1e08b28e rfb: never return error on unknown traffic
We only try to parse a small subset of what is possible in
RFB. Currently we only understand some standard auth schemes
and stop parsing when the server-client handshake is complete.
Since in IPS mode returning an error from the parser causes
drops that are likely uncalled for, we do not want to return
errors when we simply do not understand what happens in the
traffic. This addresses Redmine #5912.

Bug: #5915.
(cherry picked from commit 1f8a5874fb)
2 years ago
Sascha Steinbiss 7a52e39297 rfb: add myself as contributor
(cherry picked from commit 836fff3679)
2 years ago