Commit Graph

14910 Commits (b12a35c3cf90cb900335cf28dc5c366955088a6b)
 

Author SHA1 Message Date
Jason Ish 4a97461f9a doc/userguide: notes about Lua rules being disabled by default 2 years ago
Jason Ish f119b29701 lua: disable lua rules by default
To protect against possible supply chain attacks, disable Lua rules by
default. They can be enabled under the "security" section of
suricata.yaml.

Ticket: #6122
2 years ago
Philippe Antoine 0d0f6cde6e fuzz: fuzz HTTP1 target
As we use the name taken from list-app-layer-protos output,
we want http to translate to HTTP1
2 years ago
Philippe Antoine d40dca5e55 dcerpc: maximum number of live transactions also for UDP
Ticket: #6129

Avoids that quadratic complexity gets too bad
2 years ago
Shivani Bhardwaj 3aaf37b749 smtp: handle long lines per direction
Issue:
Currently, while handling of long lines, if the line exceeded the limit,
we'd set a variable state->discard_till_lf which will be reset in the
later stages based on the data that arrives. However, because there was
one variable per state, this meant that a later stage in the other
direction could also modify it which is incorrect.

Fix:
Use separate variables for each direction.

Bug 6053
2 years ago
Shivani Bhardwaj 046a192c1f smtp: handle following cmd if LF was found in long line
If a long line had LF post the limit, it should be considered complete
and not wait for the next line to complete it. However, currently, any
following lines were skipped which could sometimes also be important
commands for the entire transaction.

Fix this by setting a flag in case we're truncating a long line but
after having found the LF character.

Bug 5989
2 years ago
Shivani Bhardwaj d83a34397b smtp: add function docs 2 years ago
Shivani Bhardwaj 073f616feb smtp: handle DATA mode in middle of input parsing
Before:
If the input was such that we'd enter DATA mode in the middle, the
entire data would be passed through SMTPGetLine fn and be processed with
line limits etc in place.

After:
Since we don't want any limits to be enforced on DATA, we pass it to
SMTPPreProcessCommands fn to take care of it differently from the
commands.

Bug 5981
2 years ago
Victor Julien 6b5da30d9d streaming/buffer: set errno in allocators
Add wrappers for the default allocators to set SC_ENOMEM.

The stream reassembly wrappers can set both SC_ENOMEM (alloc failed)
and SC_ELIMIT (memcap reached).
2 years ago
Victor Julien 55c6c45ea7 streaming/buffer: turn BUG_ON's into validate checks 2 years ago
Victor Julien db1cb2a032 stream: update insert error checking 2 years ago
Victor Julien 06419cecbc streaming: use error codes to indicate error reason 2 years ago
Victor Julien c3ee3d513f error: SC_ELIMIT for when a limit is reached 2 years ago
Victor Julien 376ebda36c exception/policy: fix midstream default handling 2 years ago
Victor Julien 479fa609fa exception/policy: minor code cleanup 2 years ago
Juliana Fajardini 106b885d88 stream/tcp: don't accept pass-packet policy
This is no longer valid for midstream exception policies.

Part of
Bug #5825
2 years ago
Juliana Fajardini 69d3750aaf stream/tcp: re-enable midstream-policy usage
We were always setting it to ignore, due to bug 5825.

The engine will now issue an initialization error if an invalid value
is passed in the configuration file for midstream exception policy.

'pass-packet' or 'drop-packet' are never valid, as the midstream policy
concerns the whole flow, not making sense for just a packet.

If midstream is enabled, only two actual config values are allowed:
'ignore' and 'pass-flow', both in IDS and in IPS mode. In default mode
('auto' or if no policy is defined), midstream-policy is set to
'ignore'. All other values will lead to initialization error.

In IDS mode, 'drop-flow' will also lead to initialization error.

Part of
Bug #5825
2 years ago
Juliana Fajardini e849afbda1 exceptions: extract 'auto' check to function
Part of
Bug #5825
2 years ago
Juliana Fajardini 69311ab02f exceptions: use mix of logconfig/info/warning
Use a mix of SCLogConfig, Warning and Info.
This mix works as follows: when something unnexpected for the user
happens - for instance, the engine ignoring an invalid config value, we
use warning. For indicating the value for the master switch, which
happens only once, we use Info. For all the other cases, we use
SCLogConfig.

It is possible that SCLogConfig isn't showing at the moment, this is a
possible bug to investigate further.

Related to
Bug #5825
2 years ago
Juliana Fajardini 7f8536b81c exceptions: parse config values, don't post process
Get the enum values from the config file. Update the new extracted
functions. Post-process the config values based on runmode and policy.
Also handle 'auto' enum value in these.

Related to
Bug #5825
2 years ago
Juliana Fajardini f97af0c0b1 exceptions/midstream: parse midstream policy alone
As the midstream exception policy has its own specific scenarios, have a
dedicated function to parse and process its config values, and check for
midstream enabled when needed.

Related to
Bug #5825
2 years ago
Juliana Fajardini bf22129a0f exceptions: refactor exception policy parse fn
Split up ExceptionPolicyParse to try to improve readability.

Related to
Bug #5825
2 years ago
Juliana Fajardini c0db25d055 userguide: update exception policy behaviors table
Some exception policies can only be applied to the triggering packet or
only make sense considering the whole flow. Highlight such cases in the
table showing each exception policy.

Related to
Bug #5825
2 years ago
Juliana Fajardini 0c2922f02e doc: add midstream scenarios for exception policy
The different interactions between midstream pick-up sessions and the
exception policy can be quite difficult to visualize. Add a section for
that in the userguide.

Related to
Bug #5825
2 years ago
Juliana Fajardini f511a4ae3f misc: fix typos, doc, update copyright years
Updated FlowGetNew documentation, where it said NULL was only returned
in case of error.
2 years ago
Juliana Fajardini a37a88dcd5 defrag: clean up existing stats counters
7a044a99ee removed the lines that incremented these defrag
counters, but kept the entities themselves. This commit removes counters
that we judge too complex to maintain, given the current state of the
code, and re-adds incrementing max_hit (memcap related).

Related to
Task #5816
2 years ago
Juliana Fajardini 05417407b3 schema: add missing flow event property: emergency 2 years ago
Jason Ish 68d0d6ca24 rust: fix unit test link error on Rust 1.70
Rust 1.70 appears to now link code on both branches of `if cfg!(test)`
now causing Rust unit tests to fail as that pattern was used to
disable functions only available when linked with the Suricata C code.

To work-around this issue, provide two versions of the `new` function,
one for unit tests and one when running as an application.
2 years ago
Victor Julien c90f67ac55 app-layer: improve/fix updates logic
In 23323a961f ("app-layer: reduce app cleanup and output-tx calls"), flag
was set per packet updating the app-layer state. However this was missing a
common pattern: in IDS mode most updates are done in the opposite direction
of the traffic due to updates getting triggered by ACK's. This meant that
file store processing might not happen for a long time, or at all. Also,
app layer cleanup might not be called, which includes file pruning.

This patch sets per flow set of flags to indicate app layer is (potentially)
updated. It sets this per direction, based on how the parsers were invoked.
If an ACK triggers an app update, the flow is tagged for the opposite
direction and the next packet in that direction triggers output and cleanup.

Fixes: 23323a961f ("app-layer: reduce app cleanup and output-tx calls")

Bug: #6120.
2 years ago
Victor Julien 22d7323eee output/tx: minor code cleanup 2 years ago
Philippe Antoine 14ecfebf68 http: htp_table_get_index does not return NULL
if the index is correct
2 years ago
Philippe Antoine 415b036dca http1: implement http.request_header
So that it is generic for HTTP1 and HTTP2

Ticket: #5780
2 years ago
Philippe Antoine 7256ec8a6e detect/http2: do not escape ':' in header name or value
for keywords http.request_header and http.response_header

Ticket: #5780
2 years ago
Philippe Antoine 656554f293 http2: rename http2.header to http.request_header
Or http.response_header based on the direction

http2.header had a different behavior than http.header and this was
confusing.

Ticket: #5780
2 years ago
Cole Dishington 746fb50d58 detect: Fix FTP bounce detection IP address comparison
Fix the FTP bounce IP address comparison by only converting the IP
parsed from the FTP payload to network order.

Bug: #6087
2 years ago
Philippe Antoine 4c466ec5f4 rust/pgsql: remove unused/unconstructed enum variants 2 years ago
Philippe Antoine 0392762daa rust: remove duplicate constants definitions in C 2 years ago
Philippe Antoine f2a18e91c4 rust: define AppLayerEventType only in rust
And detect.h does no longer depend on app-layer-events.h
2 years ago
Philippe Antoine 668501c225 rust: remove unused 2 years ago
Jeff Lucovsky 4edd516250 stream/reassemble: Include pool item count msg
Issue: 5563

This commit adds the segment pool item count in the summary DEBUG
message.
2 years ago
Jeff Lucovsky f8c9390ca3 stream/cache: Return sessions to correct pool
Issue: 5563

This commit fixes the release of TCP resources. The sessions were being
returned to the segment thread pool instead of the sessions pool.
2 years ago
Jeff Lucovsky 0d0c9ea07b pool: Use bool return type
Issue: 5563

This commit changes PoolDataPreAllocated to return a bool instead of an
int.
2 years ago
Jason Ish 6d7923c80b github-ci: check for suricata-update example configuration files
Check that the Suricata-Update example configuration files are
installed.
2 years ago
Jason Ish b8071a9eb0 suricata-update: install sample configuration files
With the move to installing Suricata-Update files from Suricata
Makefile's, the sample configuration files were forgotten.

Ticket: #6132
2 years ago
Philippe Antoine e30f4943ae doc: GitHub PRs workflow 2 years ago
Jeremy MountainJohnson 435d74d744 userguide/install: add info on arch-based installs
Add Arch AUR information for installation on Arch-based distros.
2 years ago
Philippe Antoine 5c419b79b7 doc: upgrade guide for logging http custom headers
Ticket: #5320
2 years ago
Juliana Fajardini f83c67bbb5 doc: add missing rule to engine-analysis section
The first report didn't have an example rule to go with.
2 years ago
Long Doan 6dc486af50 source-pcap-file: include unlink error in warning message 2 years ago
Philippe Antoine 7ca43e7e1f output/snmp: log version from tx
and not the one from state

If a SNMP flow starts with a V2 version transaction,
then there is a V3i version transaction,
we will now log V3 for the second transaction
2 years ago