Commit Graph

19047 Commits (372cb8c692133bf3cd2104b7419d25b6b83cfe9f)
 

Author SHA1 Message Date
Victor Julien 32afba47dd packet: store livedev by id 3 months ago
Victor Julien 293662fc2e flow: store livedev by id
In prep for storing both directions for IPS.
3 months ago
Victor Julien 10367750f1 device: add get id func
Most code uses an opague type for LiveDevice, so add an id getter.
3 months ago
Victor Julien 4a7ded0eea device: start id space at 1
So a value of 0 means no device.
3 months ago
Victor Julien a7ee12c921 device: add O(1) lookup by id 3 months ago
Victor Julien 943fa5f453 respond/reject: use livedev in bridge mode
Clean up host mode tracking, which is used by reject to control how
rejects are sent. Before this patch there were 2 modes: sniffer only
and router. This patch introduces a bridge mode that is automatically
set by the bridge modes. In bridge mode the `Packet::livedev` is used.

Ticket: #8390.
3 months ago
Juliana Fajardini 3c46e36930 detect/tcp: opt-in tcp.flags for firewall mode
The firewall enabling flag for tcp.flags was being overwritten by
another line of code.

Related to
Ticket #8387
3 months ago
Juliana Fajardini d442c3544c detect: opt-in keywords for firewall mode
- tls.cert_chain_len
- datarep
- dataset
- dns.opcode

Part of
Ticket #8387
3 months ago
Lukas Sismis 7b0afb3bbd github-ci: add FreeBSD build test
Expand the Github-CI build coverage by adding another OS that
Suricata targets.

Ticket: 8487
3 months ago
Urval Kheni 121d736560 decode/tcp: avoid unaligned 16-bit option reads
Use a byte-wise helper for 16-bit TCP option parsing instead of
casting option data to uint16_t *.

Ticket: 8543
3 months ago
Philippe Antoine cb62d6d73d frames: do not free on log+flush packet
As we expect a second log+flush packet in the other direction

Ticket: 8336
3 months ago
Philippe Antoine cefd134461 stream: log flush packets in the other order
Ticket: 8336

At the end of a TLS handshake, in IDS mode, the client acks,
and we parse the server hello and use tls.encryption-handling
to know what to do next (for example bypass)

Everything is parsed, but we have not run detection yet on neither
side.

So, in IDS mode, we need to first flush the client side, as the
comment on the function already stated.
3 months ago
Philippe Antoine 1ba411458c detect: do not wait for more in log_flush
Ticket: 8336

When a packet has flag PKT_PSEUDO_DETECTLOG_FLUSH, we do not
expect to rerun detection on the same tx and direction again

So, do not set mpm_in_progress whose purpose is to not store
the state as we will run again.

Allows transactional bidirectional signatures to work on
thse log+flush pair of packets
3 months ago
Sergey Pinaev bb4e79c4f7 reputation: deduplicate skipping empty lines/comments 3 months ago
Sergey Pinaev 2e22ba65e7 reputation: remove unused code
Remove useless while() that led to buffer underflow

Ticket: #8500
3 months ago
Jason Ish 029fd1be59 eve: add rule generation source to alert record
When an alert is generated from firewall context, add an engine value of
"fw", otherwise "td" (for threat detect).

The engine field is only added when firewall mode is enabled.

Ticket: #8456
3 months ago
Philippe Antoine f0e246de34 detect/mqtt: reason_code keyword is now a multi-integer
Ticket: 7929

Builds a vector of the reason code in a tx to do so,
except if we use the default "any", where we do not append
to the vector, but just run detection while iterating
3 months ago
Juliana Fajardini 376eddbe98 security: minor formatting and re-structuring
For readability.
3 months ago
Philippe Antoine 68c9b63831 doc: security policy
Update security levels to triage less reports as critical.
Improve instructions on how to report issues.
3 months ago
Philippe Antoine 614c48d3c3 ikev2: remove unused field
Ticket: 8415
3 months ago
Victor Julien 2f9573f84c doc: address config conversion note
Message is:
```
Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`.
```
3 months ago
alinse-pltzr c48bb1b26c ftp: add rule for too many transactions
Issue: 8489
3 months ago
alinse-pltzr 86fe20dd48 conf: add comment for ftp.max-tx
Add missing FTP configuration value to suricata.yaml.in showing the
default value.

Issue: 8489
3 months ago
Jeff Lucovsky 5ddd808e9b ftp: don't halt the flow when raising too_many_transactions
The first version of the event set done=true on state->curr_tx and
returned NULL when the limit hit. curr_tx is usually the active
command just received — marking it done mid-request throws off
response matching, and subsequent commands in the flow stop getting
logged.

SMB behavior is mirrored here:
Walk the tx list, find the oldest tx that isn't done, mark
it done and tag it with the event, then fall through and
create the new tx so the flow parsing continues. One stale tx gets
reaped per overflow so memory stays bounded.

Issue: 8489
3 months ago
Jeff Lucovsky 9ea2e29581 ftp: raise too_many_transactions event on overflow
Other parsers (SMB, POP3, ENIP) already raise a too_many_transactions
event when a flow exceeds its per-flow transaction limit. FTP had
the limit wired up through app-layer.protocols.ftp.max-tx but just
dropped the excess transaction on the floor with a "FTP does not set
events yet..." TODO, so no event was raised when the limit was
reached.

Add the FtpEventTooManyTransactions variant, a stock rule at
sid 2232002, and raise the event from FTPTransactionCreate when the
live-tx count goes past ftp_config_maxtx.

Issue: 8489
3 months ago
Jason Ish aa4946547b github-ci: check formatting and clippy on example rust plugin 3 months ago
Jason Ish 5e2a33d080 examples: add flow callbacks to rust plugin example
Ticket: #8446
3 months ago
Jason Ish 91b9dda0bf doc: document flow life cycle callback API
Document for C and Rust, as the C documentation was missing.

Ticket: #8446
3 months ago
Jason Ish cb69fa4e53 rust/ffi: add flow lifecycle callback wrappers
Provide Rust friendly callback registrations for flow init, update and finish events. These
callbacks are implemented as Rust closures.

Ticket: #8446
3 months ago
Jason Ish d4dc8be3b2 rust: bindgen flow lifecycle callbacks
Ticket: #8446
3 months ago
Philippe Antoine e38888810d detect/dcerpc: avoids FP on dcerpc.iface keyword
When we got a bind without the first fragment flag, and did not
set any_frag in the signature, the signature always matched,
whatever the uuid value

Ticket: 8457
3 months ago
Sergey Pinaev 42fbc55aac detect-engine-analyzer: set EngineAnalysisCtx to NULL after free'ing
when engine-analysis is turned off in suricata.yaml
and we run suricata with --engine-analysis
suricata will try to use data from de_ctx->ea wich is
free'd in SetupEngineAnalysis() because fp_analysis and
rule_analysis is turned off and will receive SIGSEGV
with something like:
0x00007ffff7b4ac7b in _IO_new_fclose (fp=0xad96ab1cf5b38042) at ./libio/iofclose.c:48

Ticket: 8505
3 months ago
Jason Ish 8968b1c5a1 psl: update to 2.1.206
Update the public suffix list to latest release.
3 months ago
Philippe Antoine 5ed394b26b rust/ffi: move AppLayerEvent to ffi
Ticket: 7666
3 months ago
Philippe Antoine 5bbe99188b ci: update rust version to 1.95 3 months ago
Philippe Antoine 59b6de8239 rust: fix last collapsible_match warnings
The ones where we need to remove a debug log
3 months ago
Philippe Antoine 1cdff9de8e rust: fix collapsible_match warnings
warning: this `if` can be collapsed into the outer `match`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#collapsible_match
3 months ago
Jason Ish 899e9f045e ntp: expose logged fields to lua
This includes:
- version
- mode
- stratum
- reference_id

Ticket: #8533
3 months ago
Jason Ish 81692dd2c1 rust/lua: add method for pushing bytes
Much like pushstring, but accepts an &[u8] as an argument instead of an &str.

In support of ticket #8533.
3 months ago
Philippe Antoine eec4a44275 rules: SID allocation range is now documented in README.md
directly in the repo, and not in an external wiki
3 months ago
Philippe Antoine 891b17277e ci: check dist rules
So that we catch if we add a typo like
app-layer-event:snmp.version_mismatchZZZ;
3 months ago
Philippe Antoine d84b6789c9 ci: make doc rules validation strict
not finding anymore problems now
3 months ago
Philippe Antoine 42123cc8d9 bittorrent: add bittorrent-events.rules file
Add a file containing rules to match bittorrent protocol events.

Ticket: 8421
3 months ago
Philippe Antoine cff3d6417a snmp: add snmp-events.rules file
Add a file containing rules to match SNMP protocol events.

Ticket: 8421
3 months ago
Victor Julien 72e3d7ad08 util/path: fix compile warning
util-path.c:251:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  251 |     char *final = strrchr(path, DIRECTORY_SEPARATOR);
      |           ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
3 months ago
Victor Julien 0a4685f2ab detect/pcre: fix compile warnings
detect-pcre.c:419:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  419 |     char *fcap = strstr(regexstr, "flow:");
      |           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~
detect-pcre.c:420:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  420 |     char *pcap = strstr(regexstr, "pkt:");
      |           ^      ~~~~~~~~~~~~~~~~~~~~~~~~
detect-pcre.c:421:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  421 |     char *acap = strstr(regexstr, "alert:");
      |           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
3 months ago
Victor Julien 3564f2f928 detect/app-layer-protocol: fix compile warning
detect-app-layer-protocol.c:160:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  160 |     char *sep = strchr(arg, ',');
      |           ^     ~~~~~~~~~~~~~~~~
1 error generated.
3 months ago
Victor Julien a45a70babd decode: fix compile warning
decode.c:767:19: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  767 |             char *dot = strchr(DEvents[i].event_name, '.');
      |                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
3 months ago
Victor Julien 90ce1c54c4 datasets: fix compile warning
datasets.c:159:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  159 |     char *got_colon = strchr(line, ':');
      |           ^           ~~~~~~~~~~~~~~~~~
1 error generated.
3 months ago
Victor Julien 5aee5ff6ed smtp: fix compile warning
app-layer-smtp.c:566:14: error: initializing 'uint8_t *' (aka 'unsigned char *') with an expression of type 'const void *' discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  566 |     uint8_t *lf_idx = memchr(input->buf + input->consumed, 0x0a, input->len);
      |              ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
3 months ago