Commit Graph

2521 Commits (e16087fab426e1edbc1a3ea8a75ce7e0ee76a4e4)

Author SHA1 Message Date
Shivani Bhardwaj e16087fab4 rust: update clipboard-win
clipboard-win versions 5.2.0 - 5.4.1 were yanked by the author on
crates.io index. Use the latest available version instead.
4 days ago
Shivani Bhardwaj 4e875c80d7 dcerpc: require PFC_LAST_FRAG for completion
DCERPC REQUEST/RESPONSE records can have their stub data fragmented
across multiple PDUs. The flags that convey the state of the current PDU
are as follows:

PFC_FIRST_FRAG: first fragment of (fragmented) data
PFC_LAST_FRAG: last fragment of (fragmented) data
PFC_FIRST_FRAG && PFC_LAST_FRAG: no fragmentation

Consider a REQUEST/RESPONSE complete only when the PFC_LAST_FRAG flag is
found to be set.

Ticket: 9240
4 days ago
Philippe Antoine 0a48101ba0 http2: anomaly event on continuation frame without preceding headers
Ticket: 9217
4 days ago
Philippe Antoine 620dff6759 http2: update progress after continuation frame ended stream
Ticket: 9217
4 days ago
Philippe Antoine ef7184012a http2: do not update progress on END_STREAM without END_HEADERS
As more continuation frames are expected.
Next commit will update progress for those continuation frames.

Ticket: 9217
4 days ago
Jason Ish fc96a9f69e rust: hoist nom 8 dependency into workspace 4 days ago
Jason Ish 773828ce34 rust: hoist flate2 dependency into workspace 4 days ago
Jason Ish 8c9a5590d3 rust: hoist serde_json dependency into workspace 4 days ago
Jason Ish c919b5f7e5 rust: hoist serde dependency into workspace 4 days ago
Jason Ish 1e21db66aa rust: hoist time dependency into workspace 4 days ago
Jason Ish 4f052f8160 rust: hoist libc dependency into workspace 4 days ago
Jason Ish 584ce3a60e rust: hoist lazy_static dependency into workspace 4 days ago
Jason Ish 4ede9e9036 rust: hoist lzma-rs dependency into workspace 4 days ago
Jason Ish 95c081b5e8 rust: hoist base64 dependency into workspace 4 days ago
Jason Ish 31b813fcfe rust: hoist suricata-sys dependency into workspace 4 days ago
Jason Ish d87a53ea17 rust: hoist zstd dependency into workspace 4 days ago
Jason Ish da76bcbe13 rust: hoist regex dependency into workspace 4 days ago
Jason Ish 06441ef392 rust: hoist once_cell dependency into workspace 4 days ago
Jason Ish 065dc02ae6 rust: hoist clap dependency into workspace 4 days ago
Jason Ish 06b70817b2 rust: hoist brotli dependency into workspace 4 days ago
Jason Ish e979f6d523 rust: inherit common package metadata from workspace 4 days ago
Jason Ish df5f3feb1d rust/derive: add Makefile for Cargo.toml regeneration
To automatically update Cargo.toml when Cargo.toml.in is updated.
4 days ago
Philippe Antoine 37cc354809 http1: only disable decompression after too many bombs
Ticket: 9200

And to do so, reinit the content_encoding, so that
we do not try to take a decompressor
1 week ago
Jason Ish b717c481d3 psl: update to 2.1.241
Update the embedded public suffix list for the upcoming release.

Ticket: 9025
1 week ago
Jeff Lucovsky db36f39632 ftp: drop null checks from the response line free
SCFTPFreeResponseLine gated the release of the code buffer on a null
test of the response pointer, so the code buffer had no check of its
own. Neither check could fire: parse_response_line sets both pointers
from Box::into_raw on a boxed slice, which never returns null, and C
code obtains an FTPResponseLine only from SCFTPParseResponseLine. The
comment on the code field claimed the pointer may be null; a line with
no status code gets an empty buffer with code_length 0 instead.

Remove both null checks, note why they are unnecessary, and correct the
field comment.

Ticket: 8803
1 week ago
Jeff Lucovsky 2054e9bfcf ftp: free the response code as a boxed slice
parse_response_line allocates the code buffer with Box::into_raw on a
boxed slice, but SCFTPFreeResponseLine released it by rebuilding a
Vec<u8> with capacity code_length. Vec::from_raw_parts accepts any
global-allocator pointer whose size and alignment match, and both paths
compute the same layout for a byte slice, so the old free was sound. It
differed only from how the response buffer is released.

Release the code buffer through Box::from_raw on a slice pointer, so
both buffers are freed the same way they were allocated.

Ticket: 8803
1 week ago
Philippe Antoine 46aa14f61c datasets: do not accept char devices
Such as /dev/zero

Ticket: 9106
1 week ago
Juliana Fajardini d4aa40df61 detect: allow banning kw from td in firewall mode
In case a keyword should work in firewall mode, with firewall rules
only. The engine errors out if threat detection rules use the given keyword.

Part of
Ticket #9041
3 weeks ago
Jason Ish 5f8d1beddf rust: fail check-bindgen-bindings if bindgen fails
Even on failure before, due to the ';', the make target was still
exiting success.
3 weeks ago
Philippe Antoine b8275da9d0 dns/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine 895347aff2 kerberos/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine dfc42274ab ntp/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine 6abd9e9540 ldap/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine b39514269a rfb/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine fc36553629 mqtt/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine e6231074b2 enip/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine 72afcb301f websocket/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine 8a6359662c nfs/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine 5a5dcdab3e http2/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine c23ff8695b sctp/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine b47bde6cda dnp3/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine f3d8af65cb snmp/doc: list possible values for enum keywords
Ticket: 8675
3 weeks ago
Philippe Antoine 5f068793d3 doc: string enum derive has a function listing the enum values
Ticket: 8675
3 weeks ago
Philippe Antoine 6f57427977 doc: keywords can register a callback for further info
Ticket: 8675

Will be used by enum uint keywords to print the list of possible
enum values
3 weeks ago
Victor Julien 215961d672 http2: do not log an empty settings array
An empty SETTINGS frame (an ACK, or a SETTINGS without entries) opened
the settings array and closed it without items, producing a record the
eve schema rejects (settings has minItems 1). Skip the frame instead; a
tx whose only content is an empty SETTINGS frame is then not logged at
all, matching the empty headers handling.

Exposed by the flow-end flush of IDS-dropped flows: the dropped flow in
the drop-protocol-change test carries such a frame.
3 weeks ago
Victor Julien e6eac91974 detect: unify the transaction end state helper
AppLayerParserGetTxEndState() replaces the remaining copies of the
transaction end state computation in the firewall tx setup, the
app-layer-state and app-layer-event keywords and the completion check.
One tolerated a missing tx data pointer, the others asserted or
dereferenced it, so they could disagree.

Move DetectTxCompleted() above its first use while there, so it no
longer needs a forward declaration, and shorten its comment.

Ticket: #8944.
3 weeks ago
Victor Julien 0e297d26ff detect: honor the P+1 eof rule for generic hook list engines
DetectEngineInspectGenericList returned NO_MATCH for every keyword miss,
also when the tx had moved past the phase the engine is registered at.
Unlike the buffer engines it never produced a terminal no match, so a
firewall LTE rule using such a keyword (tls.version on a hook) stayed
provisional and was accepted for the rest of the session.

Make a miss terminal at P + 1. This engine also backs the lua
on-request/on-response hooks and the tls_cert_*, dnp3/dnp3_ind and
ftpdata/ftp mode keywords, so a plain IDS rule using them keeps its
verdict once the tx has moved past the registered phase.

Export the parser's end state computation as AppLayerParserGetTxEndState()
here, so the version keyword can use it; the remaining call sites are
converted later.

Ticket: #8944.
3 weeks ago
Victor Julien 166841e93f ssh: remove the banner_wait_eol state
banner_wait_eol only recorded that a banner line of 256 bytes or
more had arrived without EOL; it was not an active phase. The
direction kept reparsing the open line in place, so a rule or
firewall policy pointing at the state acted on a parked, not an
active, direction.

Move the condition to the event channel it already had (the
one-shot ssh.long_banner event) and key the continuation off an
explicit banner_published latch (set at the banner publish
sites): a direction with an open line stays in the banner state,
the line is consumed greedily until the EOL arrives, and the line
completion takes the normal banner-to-kex transition.

The state scale becomes dense: banner(0) kex(1) session(2),
completion done(3). request_banner_wait_eol /
response_banner_wait_eol no longer load: aliasing them to banner
would silently turn a long-banner rule into an any-banner rule.
Firewall rules that acted at the removed state must move to the
ssh.long_banner event or the banner state; and since the progress
gap between banner and kex is gone, the default-policy sweep no
longer drops a clean flow at the server banner.

Ticket: #9046.
3 weeks ago
Victor Julien 6792375d62 ssh: expose the parse failure reason and state in the eve ssh log
A flow that hit an unrecoverable ssh parse error (invalid banner
or invalid record) was never visible in the eve ssh output: the
log condition only admitted a successful handshake (both
directions at kex or session), and the tx logger is one-shot, so
the successful-handshake log fired before a later failure could
be reported and the failure was then silent - the reason was
only visible through the app-layer events.

The log condition is now failure-only: the failure latches, so
the object is emitted exactly once - at the failure, carrying
the error field (invalid_banner / invalid_record) and the state
field (the state the failure occurred in - banner, kex, or
session if a later record fails after NewKeys) - and successful
flows are logged at the flow-end flush, where the engine logs
unconditionally. Logging on the success condition mid-flow would
consume the one-shot tx log and drop a later failure, so it is
not done. The state field is emitted only alongside the error.
The object may be error + state only, when no banner was
parsed. A unit test pins the condition for a failed, a
banner-only and a both-at-kex flow (the failure admits the log
on the failing delivery); the user guide and eve reference doc
commits that follow carry the field docs.

That flow-end flush is skipped for flows that end without a
further app-layer update, though: in IPS/firewall mode a drop
disables the app layer (StreamTcpCheckFlowDrops ->
StreamTcpDisableAppLayer), after which no app-layer update
reaches the tx loggers, and a bypassed flow gets no flow-end
packet either. A successful ssh record - e.g. one that only saw
the banners - was therefore never emitted for those flows. The
hook is the app-layer end: on the transition to app-layer EOF,
StreamTcpDisableAppLayer raises FLOW_APP_LAYER_FLUSH_PENDING,
and FlowUpdateState raises it on the transition to a bypassed
state; OutputTxLog runs the tx loggers once for the next packet,
also when that packet itself has no app-layer update and is not
marked established (the disabling packet returns from the
stream engine before that), and flow-worker clears the flag when
it frees the app layer of a bypassed flow. The flush is
deliberately not a flow-end flush: when the flush is the only
reason to run the loggers, eof is not forced, so each logger's
condition decides and no other parser starts logging records it
suppressed; a disabling packet that does carry an app-layer
update keeps the existing EOF behaviour. SSHTxLogCondition
admits an IPS drop or a bypass, so the pending record is emitted
there; an IDS drop does not end the app layer, so the condition
stays failure-only - a later failure still wins, and the success
record is emitted by the flow-end flush, which the flow timeout
path now also runs for IDS-dropped flows. The unrelated
schema-sort ordering of the new state keys is fixed up as well.

Ticket: #9046.
3 weeks ago
Victor Julien 5330a88fb3 ssh: finish parked banners at kex
A banner line that completes while parked in banner_wait_eol now
takes the direction to kex: the banner data was already parsed at
entry, the completion only advances the state. Before, the
direction skipped the kex state entirely and jumped to session at
the newkeys record.

The tx is marked updated at parse entry, as the base parser did,
before the dispatch: every delivery - including the stash and
header-fragment cases that parse_record handles and publish
nothing - is decided by the state rules and the firewall
default-policy sweep (default: drop) rather than left to the
firewall default-accept, as an un-updated tx is not evaluated
mid-flow. The parse entry does not pre-check those cases:
parse_record returns the same AppLayerResult for them, and the
record_left arithmetic must stay in sync in one place only.

Ticket: #9046.
3 weeks ago