Commit Graph

17076 Commits (5ae215605c3e81a5f8fecc2a67e4aaafb10d23d5)
 

Author SHA1 Message Date
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
Shivani Bhardwaj eca7936390 lua: convert http fns into suricata.http lib
Expose the existing lua fns through the library as suricata.http module.
All existing fns are accessible like before with a transaction.

Task 7604
4 months ago
Shivani Bhardwaj 04c9e16348 util/lua: change arg name to reflect correctness
lua fns do not care about the argument count, they work with the index of
the item in the stack. Before library, there was just one item on the stack
so it worked out, however, with the library, the first item in the stack is
the library userdata, so, the fn would fail with the existing hard coded
setting of 1 for argc which can easily be confused with the number of
arguments passed to the fn.
4 months ago
Jason Ish 455aef7a22 github-ci: add test for custom lib example
Ticket: #7240
4 months ago
Jason Ish de91a23b18 examples/lib: include cleanup
Requires tm-threads.h.

Ticket: #7240
4 months ago
Jason Ish 461e9110b6 examples/lib: use packet setter functions
Instead of direct field access.

Ticket: #7240
4 months ago
Jason Ish a8ad7b1d28 packet: add set functions for some packet fields
- SCPacketSetReleasePacket
- SCPacketSetLiveDevice
- SCPacketSetDatalink
- SCPacketSetTime
- SCPacketSetSource

Prevents direct access by library users and provides more ABI
stability.

Ticket: #7240
4 months ago
Jason Ish 5679ecc6d8 lib: remove TmModuleLibHandlePacket
This is better handled directly in the library user program so the
user has more control of the Packet structure, before and after
handling.

Ticket: #7240
4 months ago
Jason Ish b46e3ebeab examples/lib: use a main loop to wait for exit
Instead of immediately entering shutdown, use SuricataMainLoop to wait
for the end of the pcap.

Ticket: #7240
4 months ago
Jason Ish 897e7cdd6a lib: remove SCRunModeLibDestroyWorker
This was a one line wrapper around SCTmThreadsSlotPktAcqLoopFinish, so
library users can call that directly instead.

Ticket: #7240
4 months ago
Jason Ish 04161155ec examples/lib: create threadvars from main thread
This also allows us to remove the sleep, as the ThreadVars are now
guaranteed to be created before PostInit.

Ticket: #7240
4 months ago