Commit Graph

18440 Commits (f8ad6904bc68e62d756c3f3cbf2f6ad31a089a91)
 

Author SHA1 Message Date
Shivani Bhardwaj 1d7b0d9b7a tls/subjectaltname: use byte arr instead of string
TLS parsers use x509-parser crate which parses X.509 certificates that
use ASN.1 DER encoding that can allow arbitrary byte sequences. An
attacker could inject null byte in a certificate anywhere to stump the
common language parsers terminating the string at a null byte leading to
a bypass of a possibly malicious certificate.

So far, the rust TLS parser for "subjectaltname" used a pattern that involved:
-> Get ASN.1 DER encoded raw data from the x509-parser crate
-> Convert this raw data to a decoded string (Rust)
-> Convert the Rust string to CString
-- The problem lies here. CString only accepts proper strings/byte
buffers and converts it into an owned C-compatible, null-terminated
string. However, if any null byte occurs in the string passed to the
CString then it panics.
In the rust TLS parser, this panic is handled by returning NULL.

This means that the parser will error out during the decoding of the
certificate. However, Suricata must be able to detect the null byte
injection attack being an IDS/IPS.

Hence, replace all such string patterns w.r.t. TLS SAN with a byte
array.

Bug 7887
7 months ago
Shivani Bhardwaj 9c3ed7d31c tls/sni: use byte array instead of string
Bug 7887
7 months ago
Shivani Bhardwaj 24f5b7dab2 tls/serial: use byte array instead of string
Bug 7887
7 months ago
Shivani Bhardwaj f025e07191 tls/issuerdn: use byte array instead of string
TLS parsers use x509-parser crate which parses X.509 certificates that
use ASN.1 DER encoding that can allow arbitrary byte sequences. An
attacker could inject null byte in a certificate anywhere to stump the
common language parsers terminating the string at a null byte leading to
a bypass of a possibly malicious certificate.

So far, the rust TLS parser for "issuerdn" used a pattern that involved:
-> Get ASN.1 DER encoded raw data from the x509-parser crate
-> Convert this raw data to a decoded string (Rust)
-> Convert the Rust string to CString
-- The problem lies here. CString only accepts proper strings/byte
buffers and converts it into an owned C-compatible, null-terminated
string. However, if any null byte occurs in the string passed to the
CString then it panics.
In the rust TLS parser, this panic is handled by returning NULL.

This means that the parser will error out during the decoding of the
certificate. However, Suricata must be able to detect the null byte
injection attack being an IDS/IPS.

Hence, replace all such string patterns w.r.t. TLS IssuerDN with a byte
array.

Bug 7887
7 months ago
Shivani Bhardwaj 77c21b05d2 tls/subject: use byte array instead of string
TLS parsers use x509-parser crate which parses X.509 certificates that
use ASN.1 DER encoding that can allow arbitrary byte sequences. An
attacker could inject null byte in a certificate anywhere to stump the
common language parsers terminating the string at a null byte leading to
a bypass of a possibly malicious certificate.

So far, the rust TLS parser for "Subject" used a pattern that involved:
-> Get ASN.1 DER encoded raw data from the x509-parser crate
-> Convert this raw data to a decoded string (Rust)
-> Convert the Rust string to CString
-- The problem lies here. CString only accepts proper strings/byte
buffers and converts it into an owned C-compatible, null-terminated
string. However, if any null byte occurs in the string passed to the
CString then it panics.
In the rust TLS parser, this panic is handled by returning NULL.

This means that the parser will error out during the decoding of the
certificate. However, Suricata must be able to detect the null byte
injection attack being an IDS/IPS.

Hence, replace all such string patterns w.r.t. TLS Subject with a byte
array.

Bug 7887
7 months ago
Shivani Bhardwaj c312896be4 tls: remove deprecated tls-log
tls-log was deprecated in Suricata 8. Remove all associated files and fn
calls.

Task 7233
7 months ago
Victor Julien 4cdf0a0549 eve/tls: log client version if no server hello seen
Bug: #5713.
7 months ago
Victor Julien 9075d73e6d tls: delay handshake structure init 7 months ago
Victor Julien 4d9c0bdb19 tls: minor optimization
No need to 0/memset after SCCalloc.
7 months ago
Shivani Bhardwaj 926ef4c49a detect/xbits: parse keywords w strtok_r
Ticket: 4820

Forward ported by Victor Julien from
2c5eead479 ("detect/xbits: parse keywords w strtok_r")
7 months ago
Victor Julien 7ac5d7428e frames: add --list-app-layer-frames option
Lists frames per ip proto and app-layer proto.

Ticket: #8174.
7 months ago
Philippe Antoine df812b7a90 detect: do not exit on allocation failure during rule (re)load
Ticket: 6187
7 months ago
dependabot[bot] a0c91aa9f0 github-actions: bump actions/upload-artifact from 5.0.0 to 6.0.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

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

Signed-off-by: dependabot[bot] <support@github.com>
7 months ago
dependabot[bot] 2deb1d25c4 github-actions: bump actions/cache from 4 to 5
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months ago
dependabot[bot] 03ee55c99f github-actions: bump actions/checkout from 6.0.0 to 6.0.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v6...v6.0.1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months ago
dependabot[bot] 1f28880ba1 github-actions: bump codecov/codecov-action from 5.5.1 to 5.5.2
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.5.1 to 5.5.2.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](5a1091511a...671740ac38)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 5.5.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months ago
dependabot[bot] b4ed2da8ff github-actions: bump actions/download-artifact from 6.0.0 to 7.0.0
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](018cc2cf5b...37930b1c2a)

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

Signed-off-by: dependabot[bot] <support@github.com>
7 months ago
Lukas Sismis b596073a79 src: doc: remove double-space typos 7 months ago
Victor Julien 66e595fb10 detect/ssl_state: minor code cleanups 7 months ago
Victor Julien 5b790f607f detect/ssl_version: minor code cleanups 7 months ago
Victor Julien f17254ab8f detect/tls.version: minor code cleanups 7 months ago
Giuseppe Longo f1b9669ed5 flow: swap MACs when flow direction is swapped
When FlowSwap() reverses the direction of a flow, the MAC address sets
stored in the flow also need to be swapped to maintain consistency with
the new direction. Previously, MAC addresses were not swapped along with
other flow properties like packet/byte counters.

Ticket #8172
8 months ago
Giuseppe Longo 8050738fea util/macset: fix code style
Code style fixed using clang-format.

Ticket #8172
8 months ago
Victor Julien da87bd61d0 detect/luaxform: fix allowed lua rules check
Meant to be enabled by default, but wasn't.
8 months ago
Victor Julien d7866495c2 detect/lua: exclude script setup from the max-bytes limit
Make sure the script can use all bytes configured. So exclude setup like
input buffers that are put on the lua state before script is executed.

Bug #8173.
8 months ago
Victor Julien 1f58bc1a07 detect/luaxform: disable bytes limit during setup
During per inspection setup the buffer could already use up all the budget.

Bug #8173.
8 months ago
Victor Julien 7bc4b7d713 lua/sandbox: allow disabling the bytes limit
Meant for setting up from C, where we may use more bytes than expected.

Bug: #8173.
8 months ago
Shivani Bhardwaj 30bdaa44e1 doc: add elephant.flow usage section 8 months ago
Shivani Bhardwaj 33a3448f45 detect/flow: add support for elephant flow detection
Expose elephant flow flags on a flow via rule language. The rule keyword
is defined as "flow.elephant: <dir>;" where the <dir> can expand to:
- toserver
- toclient
- either
- both

Feature 8117
8 months ago
Shivani Bhardwaj 0f92583702 flow: split elephant flow detection per dir
The tracking for elephant flow is done per direction however, the flag
was set on the flow whenever either of the directions crossed the
rate-limit defined in the settings. Given that the tracking was already
split, it makes sense to split the detection tracking per direction as
well and allow user to have a better control via rule language.
8 months ago
Shivani Bhardwaj 06eafb79d6 detect/flow-pkts: check for both dir
The functionality of "both" can already be easily achieved by using both
"toclient" and "toserver" in a rule. This just adds the ease of
expression in rule. As it is added now, check the direction for the
pre-existing users of direction as well.
8 months ago
Shivani Bhardwaj 77abcde9ee rust/flow: add public wrapper for dir
in order to be able to use it on the C side for elephant flow detection.
8 months ago
Victor Julien cc2287beb4 tcp/tfo: set PKT_STREAM_EST flag
Detection and logging skip a lot of work if PKT_STREAM_EST is not set. When
a TFO packet with data comes in the TCP state is not yet established, but
the data still needs to be considered.

So for this case set the PKT_STREAM_EST flag.

Bug #6744.
8 months ago
Victor Julien 8247ec65b5 features: use strcmp instead of memcmp 8 months ago
Victor Julien 4a58c84862 string-hash: use strcmp instead of memcmp 8 months ago
Victor Julien c226626a7f counters: use strcmp instead of memcmp 8 months ago
Victor Julien 7a794945c6 proto: use strcmp instead of memcmp 8 months ago
Victor Julien 8f655c7d8d reference: use strcmp instead of memcmp 8 months ago
Victor Julien 3fbce40def classification: use strcmp instead of memcmp 8 months ago
Victor Julien 5a12096dd9 spm: minor unittest cleanup 8 months ago
Victor Julien a16c6ff6a5 memcpy: rename memcpy_tolower
Rename to match coding style. Update callers.

Minor loop cleanup.
8 months ago
Ali Saidi c4360cd515 util: add timing assembly for arm64 8 months ago
Jason Ish b3d45e5507 profiling: log rule profiling as json by default
We've been forcing JSON logging in our default configuration for some
time now, just make it the actual default.
8 months ago
Jason Ish d89b35db56 conf: add SCConfNodeChildValueIsFalse to check for false value
New function to check is a value is actually set to a false value.
8 months ago
Jason Ish 6eda4b9f59 configure: remove @e_enable_evelog@
Jansson/JSON has been mandatory for a long time now, so this value has
evaluated to yes for many years now.
8 months ago
Jason Ish e895cbbf58 profiling: don't enable rule profiling by default
Update the suricata.yaml rule profiling section to not turn on rule
profiling by default, as its not on by default when commented out.

Also update the comments.
8 months ago
Jason Ish aa7091f927 ebpf: ignore *.bpf
Add the compiled .bpf programs to .gitignore.
8 months ago
Philippe Antoine af246ae7ab http: do not use a loop to find the tx count
As we want the last tx

Ticket: 8156

The generic function AppLayerParserGetTxCnt calls for HTTP1
Transactions.size()

This function has some specific code, as we may have pre-created
a tx that we do not want to count.
This used to get the last tx by iterating over all the transactions
waiting to find the one with max index.
So, instead of using the Transactions.get function, we get the last
tx out of the VecDeque and check its index.
8 months ago
Jeff Lucovsky 5c0f95faec gen: Fix typos 8 months ago
Jeff Lucovsky 9c81f817e8 rust: bindgen update
Issue: 7389

Update bindgen with `make update-bindgen`
8 months ago