Commit Graph

17186 Commits (deb761367df0f98f00d35abce6cd1a6a8d0b32dd)
 

Author SHA1 Message Date
Jason Ish 155706f96b jsonbuilder: prefix C API with SC 4 months ago
Alice Akaki 341369f203 detect: add email.x_mailer keyword
email.x_mailer matches on MIME EMAIL X-Mailer
This keyword maps to the EVE field email.x_mailer
It is a sticky buffer
Supports prefiltering

Ticket: #7598
4 months ago
Alice Akaki 52e12410ed detect: add email.message_id keyword
email.message_id matches on MIME EMAIL Message-Id
This keyword maps to the EVE field email.message_id
It is a sticky buffer
Supports prefiltering

Ticket: #7593
4 months ago
Alice Akaki 2dfd2a752f mime/email: remove unnecessary logs
fields 'date' and 'subject' are logged by enabling extended logging mode
4 months ago
Victor Julien f3abee85af detect/flowbits: implement prefilter support
Allow for more efficient rules that 'prefilter' on flowbits with 'isset' logic.

This prefilter is enabled by default, which means that if no mpm is present or
no explicit prefilter is used, the flowbits prefilter will be set up for a rule.

flowbits 'isset' prefilter

For rules that have a 'flowbits:isset,<bit>' statement, a "regular" prefilter
facility is created. It means that the rules are removed from the normal
match list(s) and added to a prefilter engine that runs prior to the individual
rule inspection stage.

Implementation: the prefilter is implemented as an RB_TREE of flowbits, with the
rule id's they "enable" stored per tree node. The matching logic is walking the
list of bits set in the flow and looking each of them up in the RB_TREE, adding
the rule ids of each of the matching bits to the list of rule candidates.

The 'isset' prefilter has one important corner case, which is that bits can in
fact be set during the rule evaluation stage. This is different from all other
prefilter engines, that evaluate an immutable state (for the lifetime of the
packet inspection).

flowbits 'set' post-match prefilter

For flowbits 'set' action, special post-match 'prefilter' facilities deal with
this corner case. The high level logic is that these track which 'isset' sigs
depend on them, and add these dependencies to the candidates list when a 'set'
action occurs.

This is implemented in a few steps:

1. flowbits 'set' is flagged
2. when 'set' action occurs the flowbit is added to a "post rule
   match work queue"
3. when the rule evaluation ends, the post-match "prefilter" engine is run
   on each of the flowbits in the "post rule match work queue"
4. these engines ammend the candidates list with the rule id dependencies
   for the flowbit
5. the candidates list is sorted to make sure within the execution for that
   packet the inspection order is maintained

Ticket: #2486.
4 months ago
Victor Julien 52c071b14a detect/prefilter: add post-match 'prefilter' engine
Add support for special post-match engines. This allows a rule to enable
other rules when it matches.

Implementation is similar to prefilter engines, however prefilter
engines run before individual rules while this post-match engine runs
after and individual rule match. It will then add the new rules to the
existing rule list.
4 months ago
Victor Julien 22526d3f69 detect/prefilter: fix pointer check 4 months ago
Victor Julien 062e58103e flowbits: allow setter to know if set is new 4 months ago
Victor Julien 2921d07b1b flowbits: toggle returns state of the bit 4 months ago
Philippe Antoine 1851030010 detect: generic callback for md5-like keywords
Ticket: 5634
4 months ago
Philippe Antoine 5ae215605c detect: use buffer ptr in validate callback api
Ticket: 5634

Allows to share the same validator functions when only the buffer
id is changing like for urilen, while still accessing the buffer
name for error logs
4 months ago
Victor Julien 4da69a52fe detect/sdp: minor style fixup 4 months ago
Giuseppe Longo 330241b162 doc: add sdp sticky buffers 4 months ago
Giuseppe Longo 300889a30b sdp: add sdp.media.encryption_key sticky buffer
This adds a sticky (multi) buffer to match the "Encryption key" subfield
of the "Media description" field in both requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo b4e24742dd sdp: add sdp.media.connection_data sticky buffer
This adds a sticky (multi) buffer to match the "Connection data"
subfield of the "Media description" field in both requests and
responses.

Ticket #7291
4 months ago
Giuseppe Longo ccd2407a47 sdp: add sdp.media.media_info sticky buffer
This adds a stick (multi) buffer to match the "Session information"
subfield of the "Media description" field in both requests and
responses.

Ticket #7291
4 months ago
Giuseppe Longo ae7301cce3 sdp: add sdp.media.media sticky buffer
This adds a sticky (multi) buffer to match the "Media" subfield of the
"Media description" field in both requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo cee6f670d5 sdp: add sdp.attribute sticky buffer
This adds a sticky (multi) buffer to match the "Attribute" field in both
requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo 038dac7ebe sdp: add sdp.encryption_key sticky buffer
This adds a sticky buffer to match the "Encryption key" field in both
requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo 5f841179db sdp: add sdp.timezone sticky buffer
This adds a sticky bufffer to match the "Timezone" field in both
requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo d9df3a3a5a sdp: add sdp.repeat_time sticky buffer
This adds a sticky buffer to match the "Repeat time" field in both
requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo 38d9e8a628 sdp: add sdp.time sticky buffer
This adds a sticky buffer to match the "Time" field in both requests and
responses.

Ticket #7291
4 months ago
Giuseppe Longo 086345f30b sdp: add sdp.bandwidth sticky buffer
This adds a sticky (multi) buffer to match the "Bandwidth" field in both
requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo 47d7024b8a sdp: add sdp.connection_data sticky buffer
This adds a sticky buffer to match the "Connection data" field in both
requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo 6fef5db5f7 sdp: add sdp.phone_number sticky buffer
This adds a sticky buffer to match the "Phone number" field in both
requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo 24f1da27b5 sdp: add sdp.email sticky buffer
This adds a sticky buffer to match the "Email" field in both requests
and responses.

Ticket #7291
4 months ago
Giuseppe Longo 82af560a54 sdp: add sdp.uri sticky buffer
This adds a sticky buffer to match the "Uri" field in both requests and
responses.

Ticket #7291
4 months ago
Giuseppe Longo 38cfe97ddc sdp: add sdp.origin sticky buffer
This adds a sticky buffer to match the "Origin" field in both requests
and responses.

Ticket #7291
4 months ago
Giuseppe Longo 2390f21033 sdp: add sdp.session_info sticky buffer
This adds a sticky buffer to match the "Session information" field in
both requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo 2f24f49dba sdp: add sdp.session_name sticky buffer
This adds a sticky buffer to match the "Session name" field in both
requests and responses.

Ticket #7291
4 months ago
Giuseppe Longo a7b38ccae3 sdp: parse time and repeat_time multiple times
As defined in RFC4566, the time and repeat_time fields can be present
multiple times but they are currently parsed only once.

Ticket #7325
4 months ago
Giuseppe Longo b481705ff8 sdp: stringify structured fields
The current parser implementations take a field, such as connection data, and
split it into subfields for a specific structure (e.g., struct ConnectionData).
However, following this approach requires several sticky buffers to match the
whole field, which can make a rule a bit verbose and doesn't offer any advantage
for matching specific parts of a field.

With this patch, a single line is still split into pieces if it makes sense for
parsing purposes, but these pieces are then reassembled into a single string.
This way, only one sticky buffer is needed to match the entire field.

Ticket #7291
4 months ago
Giuseppe Longo 891da0fa4a sdp: log media's encryption key
The encryption key subfield of the media description field is not
logged when it should be.

Ticket #7305
4 months ago
dependabot[bot] b536dee9cd github-actions: bump actions/upload-artifact from 4.6.1 to 4.6.2
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.1 to 4.6.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](4cec3d8aa0...ea165f8d65)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 4.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
4 months ago
dependabot[bot] f2a9203558 github-actions: bump actions/download-artifact from 4.1.9 to 4.2.1
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.9 to 4.2.1.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](cc20338598...95815c38cf)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 4.2.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
4 months ago
dependabot[bot] d2705aa052 github-actions: bump github/codeql-action from 3.28.10 to 3.28.13
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.10 to 3.28.13.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.10...v3.28.13)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
4 months ago
Philippe Antoine af084c11ba detect: remove unneeded NULL check
As spotted by cppcheck

fd is set only once, and DetectFlowSetup bails early if it is NULL

Fixes: c272a646c5 ("detect: SigMatchAppendSMToList can fail")
4 months ago
Jason Ish 640dd7c582 rust/conf: rust format 4 months ago
Jason Ish 813eb27b95 rust/conf: use generated bindings to SCConf API 4 months ago
Jason Ish 22b77b0c56 conf: prefix conf API with SC 4 months ago
Jason Ish be111d4d4c threads/lib: fix coverity check for unchecked return code
In thread startup, return error of TmThreadsWaitForUnpause() fails.
Fixed coverity check as in all other places the return value of this
function is checked and acted on.
4 months ago
Jason Ish b67917489d rust/rdp: namespace and visibility cleanups
Ticket: #7498
4 months ago
Jason Ish 018e46bfcf rust/smb: namespace and visibility cleanups
Ticket: #7498
4 months ago
Jeff Lucovsky ed2a81dc05 doc/entropy: Add documentation for the entropy keyword
This commits adds documentation for the entropy keyword.
The entropy keyword calculates the Shannon entropy value for content
with the calculated value used to determine whether an alert occurs.
4 months ago
Jeff Lucovsky b93c70fbd8 detect/entropy: Use entropy matching when needed
This commit causes the content inspection engine to recognize and
invoke the entropy "match" function when the entropy keyword is used.

Issue: 4162
4 months ago
Jeff Lucovsky fdc0ac590e detect/entropy: Add entropy keyword
This commit adds keyword/build support for the entropy keyword. The
entropy keyword compares an entropy value with a value calculated
according to the Shannon entropy on the available content.

Issue: 4162
4 months ago
Jeff Lucovsky c92f0f6d27 rust/detect: Add entropy support
This commit adds
- Parser for the entropy keyword
- Calculation of content the Shannon entropy value

Issue: 4162

The entropy keyword syntax is the keyword entropy followed by options
and the entropy value for comparison.

The minimum entropy keyword specification is:
entropy: value <entropy-spec>

This results in the calculated entropy value being compared with
<entropy-spec> with the equality operator.

Calculated entropy values are between 0.0 and 8.0, inclusive.

A match occurs when the values and operator agree. This example matches
if the calculated and entropy value are the same.

When entropy keyword options are specified, all options and "value" must
be comma-separated. Options and value may be specified in any order.

Options have default values:
- bytes is equal to the current content length
- offset is 0
- comparison with value is equality

entropy: [bytes <byteval>] [offset <offsetval>] value <entropy-spec>

Using default values:
entropy: bytes 0, offset 0, value =<entropy-spec>

<entropy-spec> is: <operator> (see below) and a value, e.g., "< 4.1"

The following operators are available from the float crate:
    - =  (default): Match when calculated entropy value equals specified entropy value
    - <  Match when calculated entropy value is strictly less than specified entropy value
    - <= Match when calculated entropy value is less than or equal to specified entropy value
    - >  Match when calculated entropy value is strictly greater than specified entropy value
    - >= Match when calculated entropy value is greater than or equal to specified entropy value
    - != Match when calculated entropy value is not equal to specified entropy value
    - x-y Match when calculated entropy value is in the range, exclusive
    - !x-y Match when calculated entropy value is not in the range, exclusive
4 months ago
Jeff Lucovsky d527021234 float: General purpose floating point functions
Issue: 4162

This commit adds a floating-point analog to `uint.rs` targeted
initially to be used by the forthcoming entropy keyword.
4 months ago
Shivani Bhardwaj 65349442f8 doc: add http library supported fns
Task 7604
4 months ago
Shivani Bhardwaj 5ba0ccaf4b doc: remove http cookie ua from list of buffers
as they are available via library using the tx
- tx:request_header("Cookie")
- tx:response_header("Cookie")
- tx:request_header("User-Agent")
4 months ago