Commit Graph

16983 Commits (dfd9ef57849bb3fe7789228c3bd9d2b92adf2af9)
 

Author SHA1 Message Date
Alfredo Cardigliano dfd9ef5784 ndpi: initial implementation of nDPI plugin
Ticket: #7231
10 months ago
Alice Akaki ce2e7aed74 detect: add email.date keyword
email.date matches on MIME EMAIL DATE
This keyword maps to the EVE field email.date
It is a sticky buffer
Supports prefiltering

Ticket: #7591
10 months ago
Alice Akaki 7750129c65 mime/email: log date and subject fields 10 months ago
Victor Julien 834378ff88 detect: per tx detect flags to a u8 progress value
Reduce per tx space for tracking detection/prefilter progress. Instead
of a per direction u64 of flags, where each bit reflected a progress
value, use a simple u8 to track the linear progression through the
progress values. Use an offset to allow 0 to mean no value.

Add flags field as well to track "skip detect" and "inspect complete".
10 months ago
Victor Julien 1542bcdc67 app-layer: add helper for AppLayerTxData cleanup 10 months ago
Victor Julien 8c9dfafc6d doc/tls: add more detail on tls.random 10 months ago
Victor Julien 682f1aac84 detect: reorder struct 10 months ago
Lukas Sismis 4a20baa6a8 landlock: add read/write permission to MPM cache directory 10 months ago
Lukas Sismis 7dc65c2f8a hyperscan: add caching mechanism for hyperscan contexts
Cache Hyperscan serialized databases to disk to prevent compilation
of the same databases when Suricata is run again with the same
ruleset.
Hyperscan binary files are stored per rulegroup in the designated
folder, by default in the cached library folder.
Since caching is per signature group heads,
some chunk of the ruleset can change and it still can reuse part of
the unchanged signature groups.

Loading *fresh* ET Open ruleset:  19 seconds
Loading *cached* ET Open ruleset: 07 seconds

Ticket: 7170
10 months ago
Lukas Sismis 59c3b8912b util-mpm: prepare MPM codebase for ruleset caching 10 months ago
Lukas Sismis 65cfc6d926 util-mpm-hs: refactor Hyperscan Pattern DB initialization to smaller functions 10 months ago
Lukas Sismis 939e16b12c detect-engine: remove commented out code 10 months ago
Lukas Sismis a5027e41e9 util-path: remove dead code 10 months ago
Lukas Sismis 2188cfca24 util-hash: add iterator for hash function 10 months ago
Lukas Sismis bd1885c71a hashlittle: add a safe variant of hashlittle2 function
This variant of hashlittle2() ensures that it avoids
accesses beyond the last byte of the string, which will
cause warnings from tools like Valgrind or Address
Sanitizer.
10 months ago
Philippe Antoine 879a733c12 doc/http2: explicit behavior for some http keywords
HTTP/2 does not define a way to carry the version or reason phrase
that is included in an HTTP/1.1 status line.

Ticket: 6548
10 months ago
Philippe Antoine 91389a40ce ci: test cargo fmt for some subdirs
The ones that respect it as new
10 months ago
Philippe Antoine c164cfcf6b plugins: check version for all plugins 10 months ago
Philippe Antoine 5742df3783 plugins: bind constant SC_PLUGIN_API_VERSION 10 months ago
Philippe Antoine 52862e50be plugin: constify some fields
including the tx parameter to the logger function
10 months ago
Philippe Antoine 1db49487a1 rust/detect: extend visibility of SIGMATH_NOOPT
so that it can be used by plugins

Avoid export by cbindgen as this constant is also defined in C
10 months ago
Philippe Antoine 2fa3a9fe62 template: rustfmt
and use generic logger callback prototype with later cast

and do some other small modifications so that the plugin
has less diff
10 months ago
Shivani Bhardwaj a4b8c5319c stream: make counter fns static 10 months ago
Shivani Bhardwaj 6aea48e8a6 util/stream: remove duplicate nested statement 10 months ago
Shivani Bhardwaj 7f98683d45 stream: use max-region setting from suricata.yaml
1. Add key (commented) to suricata.yaml
2. Give the configured/default key preference, save a check
10 months ago
Shivani Bhardwaj 22d05c289c stream: replace explicit logic w pre-existing fn 10 months ago
Shivani Bhardwaj 6d05e603cd stream: combine statements w same outcome 10 months ago
Shivani Bhardwaj 863c96f30d stream: fix minor typos 10 months ago
Shivani Bhardwaj 32d6fb9403 stream: use bool wherever possible 10 months ago
Shivani Bhardwaj d096b989c8 stream: add defensive checks and comments 10 months ago
Shivani Bhardwaj ce027af269 stream: remove unneeded else 10 months ago
Jeff Lucovsky a654ad9c9a output/buffer: Change buffer-size default value
The buffer-size value that controls file output buffering defaults to
8k. To be consistent with previous logic, the default is being changed
to 0 (e.g., needed if there are old config files that don't specifically
enable the new value).
10 months ago
Philippe Antoine ed5aed3f52 detect/ja: use multi-protocol support
instead of hardcoding list : removes usage of ALPROTO_QUIC and
ALPROTO_TLS in generic SigValidate

Ticket: 7304
10 months ago
Philippe Antoine f97767043f detect: clean support for multi-protocol keywords
such as ja4.

Why ?

We do not want to see hard-coded protocol constants such as
ALPROTO_QUIC directly used in generic code in detect-parse.c

How ?
From the keyword point of view, this commit adds the function
DetectSignatureSetMultiAppProto which is similar to
DetectSignatureSetAppProto but takes multiple alprotos.
It restricts the signature alprotos to a set of possible alprotos
and errors out if the interstion gets empty.

The data structure SignatureInitData gets extended with
a fixed-length array, as the use case is a sparse number of protocols

Ticket: 7304
10 months ago
Philippe Antoine 4a82bb7866 app-layer: improve limits on number of probing parsers
There was an implicit limit of 32 app-layer protocols
used by probing parsers through a mask, meaning that
Suricata should not support more than 32 app-layer protocols
in total.

This limit is relaxed to each flow not being able to
run more than 32 probing parsers, meaning that for each source
and destination port combination, the sum of registered
probing parsers should not exceed 32, even if there are more
than 32 in total.

Also sets probing parsers done sooner in the case the other
side of the connection was detected first.

Ticket: 7437
10 months ago
Juliana Fajardini cd69955d7f doc/userguide: add lua flowlib docs
Task #7489
10 months ago
Juliana Fajardini 9480272509 doc: remove old lua flow methods
Task #7489
10 months ago
Juliana Fajardini 61d47da359 lua: remove old lua flow calls
Moving forward, the flowlib is to be used.

Task #7489
10 months ago
Juliana Fajardini b03d1aed81 lua: add initial suricata.flow lib
Methods:
`get` creates the flow object.
`id`  returns the flow id.
`has_alerts` returns a boolean indicating if the flow triggered alerts.
`app_layer_proto` returns various app-layer related fields as 5 strings:
  alproto, alproto_ts, alproto_tc, alproto_orig, alproto_expect.
`stats` returns cnts for bytes and packets to sever and to client, as 4
  numbers.
`tuple` -- returns various fields: srcip, dstip, proto, sp, dp.
`timestamps` returns time as 4 numbers: seconds and microseconds, for
  first and last packet of the flow.
`timestring_legacy` returns the first packet from the flow's timestring
  as a string (like fastlog).
`timestring_iso8601` returns the first packet from the flow's
  timestring as an iso8601 compat timestring (like eve).

Example:

```
name = "lua-scflowstats.log"

local flow = require("suricata.flow")

function init(args)
    local needs = {}
    needs["type"] = "flow"
    return needs
end

function setup(args)
    filename = SCLogPath() .. "/" .. name
    file = assert(io.open(filename, "a"))
    SCLogInfo("lua SCFlowStats Log Filename " .. filename)
end

function log(args)
    local f = flow.get()
    timestring = f:timestring_legacy()
    tscnt, tsbytes, tccnt, tcbytes = f:stats()

   file:write ("[**] " .. timestring .. "\nSCFlowStats is\nPacket count to server:  " .. tscnt .. "\nByte count to server: " .. tsbytes .. "\nPacket count to client: " .. tccnt .. "\nByte count to client: " .. tcbytes .. "\n[**]")
    file:flush()
end

function deinit(args)
    file:close(file)
end
```

Task #7489
10 months ago
Juliana Fajardini 5e86c662ef lua: fix typos 10 months ago
Jason Ish 29db2e4bbe lua/dnp3: convert done and complete to boolean
These were integers, 1 of true, 0 for false. Convert to boolean as
that is how they are in eve, and Lua has boolean types.

Ticket: #7601
10 months ago
Jason Ish c69dfc5792 lua/dnp3: add is_request boolean
A DNP3 message can be a request or response, but not both. This is how
the transaction is structured.

Instead of having 2 values, "has_request" and "has_response", just
provide one field, "is_request" as a boolean.

Ticket: #7601
10 months ago
Jason Ish 9b7cab1f21 lua: convert dnp3 to suricata.dnp3 lib
This is an initial 1:1 conversion which is rather simple, as DNP3 only
had one function which converted the whole transaction to a DNP3
table.

Ticket: #7601
10 months ago
Jason Ish 4b8ef41df8 lua: remove buffer type dns.rrname, not needed
DNS is transaction based, Lua scripts need only express interest in
the request or the response.
10 months ago
Jason Ish 7b3763ecad lua: allow for real booleans in "needs" expression
In addition to

    function init (args)
        local needs = {}
        needs["dnp3"] = tostring(true)
        return needs
    end

allow for

    function init (args)
        return {dnp3=true}
    end

with the idea that the former will be completely removed for 8.0.

This works with all existing SV tests and as a string value, any value
is considered "truthy".
10 months ago
Jason Ish 640e4b343d script/dnp3_gen.py: use current clang style 10 months ago
Jason Ish bb7089df93 script/dnp3-gen.py: update for newer versions of Python
More recent yaml loaders require the loader as an argument.
10 months ago
Alice Akaki 7ba4ebdc2c detect: add email.cc keyword
email.cc matches on MIME EMAIL Carbon Copy
This keyword maps to the EVE field email.cc[]
It is a sticky buffer
Supports prefiltering

Ticket: #7588
10 months ago
Alice Akaki 9c3c6cf4cc detect-email.c: don't return NULL for empty buffer
Just return NULL if tx->mime_state is NULL or if SCDetectMimeEmailGetData return 0

Fixes:
09db7c7 ("detect: add mime email.subject keyword")
90aab0d ("detect: add email.from")
10 months ago
Alice Akaki 9e7d23d73f doc: add keywords to the multi-buffer-matching list 10 months ago