Commit Graph

16826 Commits (master)
 

Author SHA1 Message Date
Victor Julien ada2bfe009 flow/worker: improve flow timeout time accuracy
When timing out flows, use the timestamp from the "owning" thread. This
avoids problems with threads being out of sync with each other.

Ticket: #7455.
2 months ago
Victor Julien abe8dfc56b flow: fix flow bucket timestamp optimization
Flow Manager skips rows based on a minimized tracker that tracks the
next second at which the first flow may time out.

If seconds match a flow can still be timing out.
2 months ago
Victor Julien 0da83b05cf threads: use sleeping threads for minimum time a bit longer
If a thread doesn't receive packets for a while the packet timestamp
will no longer be used to determine a reasonable minimum timestamp for
flow timeout handling.

To avoid issues with the minimum timestamp to be set a bit too
aggressively, increase the time a thread can be inactive.
2 months ago
Victor Julien c587e90ebc time: thread time update after flow update
The flow worker needs to get the opportunity to run the flow update
before globally making it's current timestamp available. This is to
avoid another thread using the time to evict the flow that is about to
get a legitimate update.

Ticket: #7455.
2 months ago
Victor Julien 48301bf28c flow: exact flow timeout
Use a more precise calculation for timing out flows, using both the
seconds and the micro seconds.

Ticket: #7455.
2 months ago
Victor Julien 677c0fd41c time: getter for SCTime_t timestamp of a thread 2 months ago
Victor Julien dbebd89de2 stream: rename tcp reuse flag
Rename to be consistent with other naming:

STREAM_PKT_FLAG_TCP_PORT_REUSE -> STREAM_PKT_FLAG_TCP_SESSION_REUSE
2 months ago
Victor Julien deece44eaa eve/stream: add tcp-session-reuse trigger
Can be used to log when the tcp session reuse logic triggers.
2 months ago
Victor Julien 7b8214302c flow: improve thread safety during timeout checks
Timeout checks would access certain fields w/o locking, which could lead
to thread safety issues.
2 months ago
Victor Julien bc374b8e40 eve/flow: log tcp reuse as 'reason'
Ticket: #7482.
2 months ago
Victor Julien aab50e8ad0 unix/socket: cleanup start up logic
No longer init then deinit part of the engine at startup of the unix
socket mode.
2 months ago
Victor Julien b9423602b4 threads: include name in error message
When a thread fails to spawn, include the thread name in the error
message.
2 months ago
Philippe Antoine 6291e220e4 dns: improved handling of corrupt additionals
Ticket: 7228

That means log the rest of queries and answers, even if the
final field additionals is corrupt.
Set an event in this case.
2 months ago
Philippe Antoine 494d7bfe99 ldap: truly enforce max-tx
Ticket: 7465

If a bug chunk of data is parsed in one go, we could create many
transactions even if marking them as complete, and have
quadratic complexity calling find_request.

Proposed solution is to fail on creating a new transaction if too
many already exist.
2 months ago
Philippe Antoine 3b76c78cb9 profiling: use dynamic number of app-layer protos
Ticket: 5053
2 months ago
Philippe Antoine 41dc90776a app-layer/parser: use dynamic number of app-layer protos
Ticket: 5053
2 months ago
Philippe Antoine f8136eff9a fuzz: use dynamic number of app-layer protos
Ticket: 5053

delay after initialization so that StringToAppProto works
2 months ago
Philippe Antoine def6e1c719 app-layer/stats: use dynamic number of app-layer protos
Ticket: 5053
2 months ago
Philippe Antoine 2bd73b2761 util: parenthesis for macro
so that we can use safely EXCEPTION_POLICY_MAX*sizeof(x)
2 months ago
Philippe Antoine 911cd628fc frames: use dynamic number of app-layer protos
Ticket: 5053
2 months ago
Philippe Antoine 9e9333b7d0 protodetect: use dynamic number of app-layer protos
for alproto_names

Ticket: 5053
2 months ago
Philippe Antoine 61657c8ec6 protodetect: use dynamic number of app-layer protos
for expectation_proto

Ticket: 5053
2 months ago
Philippe Antoine 6b7349dbc1 protodetect: make expectation_proto part of AppLayerProtoDetectCtx
instead of a global variable.

For easier initialization with dynamic number of protocols
2 months ago
Philippe Antoine 7750226e43 fuzz: use lower pcre limits
to avoid timeouts

instead of forbidding pcre signatures on stream

Ticket: 4858
2 months ago
Philippe Antoine 5cec270598 detect: move fields around to fill memory holes
to make scan-build happy avoiding its warning :

Excessive padding in 'struct DetectEngineThreadCtx_'
(33 padding bytes, where 1 is optimal)
2 months ago
Philippe Antoine b967fcaf8f stats: remove unused pseudo_failed stat 2 months ago
Philippe Antoine 954553f1ae src: remove unused struct fields
Even if they get defined
2 months ago
Victor Julien c56b741088 github-ci: update Fedora 39 jobs to 41 2 months ago
Philippe Antoine bdcb593738 detect: improve tx_id guessing for unidirectional protocols
So we get:
1. request arrives - buffered due to not ackd
2. response arrives, acks request - request is now parsed, response isn't
3. ack for response, response parsed. Then detect runs for request,
generates alert. We now have 2 txs. txid will be 0 from AppLayerParserGetTransactionInspectId

But txid 1 is unidirectional in the other way, so we can use txid 0
metadata for logging

Ticket: 7449
2 months ago
Philippe Antoine a499529477 doc: improve documentation about guess-applayer-tx
Ticket: 7199
2 months ago
Jeff Lucovsky 2d9df5a1ae flow/var: Release key storage
Issue: 7466

This commit releases the memory for the flow variable "key" when
the flow variable is of type string. The key is allocated in the Lua
extension logic.
2 months ago
dependabot[bot] def22fab6c github-actions: bump actions/upload-artifact from 4.4.3 to 4.5.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.4.3 to 4.5.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](b4b15b8c7c...6f51ac03b9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
dependabot[bot] e16f29e459 github-actions: bump github/codeql-action from 3.27.5 to 3.28.0
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.5 to 3.28.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.27.5...v3.28.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
dependabot[bot] 8e4b18f4e4 github-actions: bump codecov/codecov-action from 5.0.7 to 5.1.2
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.7 to 5.1.2.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](015f24e681...1e68e06f1d)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
Jeff Lucovsky d853972c74 output/log: Remove extraneous error message
Issue: 7447

When the output file can't be opened, 2 error messages are displayed
for the same problem. The second message doesn't add value and lacks
context (error reason, e.g., "Permission denied").

Retaining the second message as a debug message.

Without this commit:

Error: logopenfile: Error opening file: "/home/jlucovsky/src/jal/suricata-verify/tests/bug-5198/output/noperms/eve.1.json": Permission denied [SCLogOpenFileFp:util-logopenfile.c:428]
Error: logopenfile: Unable to open slot 1 for file /home/jlucovsky/src/jal/suricata-verify/tests/bug-5198/output/noperms/eve.json [LogFileEnsureExists:util-logopenfile.c:737]
Error: runmodes: unable to initialize sub-module eve-log.stats [RunModeInitializeEveOutput:runmodes.c:692]

With commit:

Error: logopenfile: Error opening file: "/home/jlucovsky/src/jal/suricata-verify/tests/bug-5198/output/noperms/eve.1.json": Permission denied [SCLogOpenFileFp:util-logopenfile.c:428]
Error: runmodes: unable to initialize sub-module eve-log.stats [RunModeInitializeEveOutput:runmodes.c:692]
2 months ago
Jeff Lucovsky e72fc39f83 output/log: Improve error handling
This commit improves error handling for cases when file(s) cannot be
opened.
- Return NULL if file object can't be opened
- checks whether the file object has been opened before
  dereferencing the per-file context.

Issue: 7447
2 months ago
Shivani Bhardwaj 6f937c7545 doc: add guide for ticket title
Explain with examples what a good ticket title looks like and
why is it important to have ticket titles convey the correct issues.
2 months ago
Philippe Antoine b0282f49af http2: complete json schema
git grep js.set_string rust/src/http2/logger.rs | grep '"' |
cut -d'"' -f2 | sort | uniq | while read i;
do echo -n $i; git grep $i etc/schema.json | wc -l; done

shows only has_multiple was missing
2 months ago
Philippe Antoine fd7e2e5e9a doh2: really enforce 65K dns message limit
Ticket: #7464
2 months ago
Jason Ish 604e3c7422 rust/jsonbuilder: make set_uint generic over Into<u64>
Allow `set_uint` to accept any number value that can be converted to a
u64. Prevents callers from having to do `as u64`.

This required fixing up any callers that used `.into()` to just pass in
their value without the into conversion.

Most calls using `as u64` can have that cast removed, with the exception
of `usize` values which must still be cast is conversion can't be
guaranteed to be non-fallible.
2 months ago
Philippe Antoine 146314b0c5 ci: run CodeQL only on python changes
Ticket: 7358
2 months ago
Jeff Lucovsky 91d5b77316 doc/commit
Describe how to use the git commit template. The template helps ensure
that the information needed for evaluation and context is included in
the commit message.

Ticket: <Redmine ticket number>
2 months ago
Jeff Lucovsky 1b88f2189e git: Add commit template
Issue: none

This commit adds a template that identifies commit message elements that
we find important. The Suricata development team requests that
contributions use the template to help improve commit messages. We
reserve the right to strictly enforce adherence to the template in the
future.

Configure git to use this template with:
    git config commit.template ..github/commit-template.txt
2 months ago
Philippe Antoine 5da2b5d7a4 dns/probe: check that a request has at least one query
Ticket: 7279
2 months ago
Philippe Antoine 9b40446bea dns/probe: adds check for 0 records and big size
Ticket: 7279

Make dns probing function stricter to avoid matching on non-DNS
on port 53 and later returning a app-layer error.
2 months ago
Shivani Bhardwaj 2c0d3b83c4 dns: fix clippy lint warnings
Fix vector lint issues:
- same_item_push
- vec_init_then_push
3 months ago
Jeff Lucovsky 89c9cec0bb general/typo: Fix typo in stacksize msg 3 months ago
Victor Julien d11e8a8ee7 doc/userguide: document TCP urgent policy 3 months ago
Victor Julien 779f9d8ba3 eve/flow: add per flow TCP oob urg data counter
If TCP urgent handling is set to the OOB processing, the number of OOB
bytes is tracked for SEQ offset calculations. If this offset is
non-zero, add the field to the flow record.

Ticket: #7411.
3 months ago
Victor Julien 6882bcb3e5 stream: add TCP urgent handling options
TCP urgent handling is a complex topic due to conflicting RFCs and
implementations.

Until now the URG flag and urgent pointer values were simply ignored,
leading to an effective "inline" processing of urgent data. Many
implementations however, do not default to this behavior.

Many actual implementations use the urgent mechanism to send 1 byte of
data out of band to the application.

Complicating the matter is that the way the urgent logic is handled is
generally configurable both of the OS and the app level. So from the
network it is impossible to know with confidence what the settings are.

This patch adds the following policies:

`stream.reassembly.urgent.policy`:

- drop: drop URG packets before they affect the stream engine

- inline: ignore the urgent pointer and process all data inline

- oob (out of band): treat the last byte as out of band

- gap: skip the last byte, but do no adjust sequence offsets, leading to
       gaps in the data

For the `oob` option, tracking of a sequence number offset is required,
as the OOB data does "consume" sequence number space. This is limited to
64k. For this reason, there is a second policy:

`stream.reassembly.urgent.oob-limit-policy`:

- drop: drop URG packets before they affect the stream engine

- inline: ignore the urgent pointer and process all data inline

- gap: skip the last byte, but do no adjust sequence offsets, leading to
       gaps in the data

Bug: #7411.
3 months ago