Commit Graph

19464 Commits (928ac012156fb8d393ce5ac4a496fde3c2e87b00)
 

Author SHA1 Message Date
Jason Ish 1b289daea3 ftp: support nlst on the data channel
Ticket: #8664
3 months ago
Jason Ish 6bc2969b8d ftp: mark ftpdata_command as firewall supported 3 months ago
Jason Ish f93268e531 ftp: mark ftp.dynamic_port as firewall supported
Ticket: #8392
3 months ago
Jason Ish 41cad78506 ftp: register ftp.dynamic_port at response completion
Register ftp.dynamic_port at the FTP transaction completion progress
instead of progress 0. This allows ftp.dynamic_port to be used in
ftp:response_complete.

Ticket: #8392
3 months ago
Jason Ish 0d566f90ce ftp: mark ftp.command as firewall supported
Ticket: #8392
3 months ago
Jason Ish a6ce31d50d ftp: register ftp.command_data at request completion
Register ftp.command_data with the FTP request completion progress so it
can be used by firewall rules on the ftp:request_complete hook.

Ticket: #8392
3 months ago
Jason Ish bf63c574d3 ftp: register ftp.command buffer at request completion
Register ftp.command with the FTP request completion progress so it can
be used by firewall rules on the ftp:request_complete hook.

Ticket: #8392
3 months ago
Philippe Antoine f56501215f detect/file: reorder struct fields to reduce padding
and make scan-build happy
3 months ago
Philippe Antoine 89dbce1b46 detect: convert tx_progress to uint8_t 3 months ago
Jeff Lucovsky 30d4edf9eb detect: revert 2eede11195
Revert issue 8619 fix in favor of a more general change that
sets INSPECTED_T{S,C} correctly on passed flows. This makes clean no
longer need the FLOW_ACTION_PASS special case to free those
transactions.

Issue: 8621
3 months ago
Jeff Lucovsky 006e21c1cc app-layer: fix inverted tx inspected flag check
Issue: 8628

AppLayerParserSetTransactionInspectId() had an inverted guard when
tagging completed transactions as inspected: it set the INSPECTED flag
only on txs that already had it, so a finished tx was never newly
marked.

On a normal flow DetectRunTx() sets the same flag and masks the
mistake. On a passed flow -- a `pass` rule or a pass-the-flow exception
policy -- detection is skipped and this function is the only thing that
marks txs inspected. With the inverted guard the transactions are never
flagged, AppLayerParserTransactionsCleanup() never frees them, and the
per-flow transaction list grows without bound while each packet
re-scans it, giving O(n^2) cleanup cost.

This is an unintended regression from 834378ff88.
3 months ago
Juliana Fajardini 9cd778b33a doc: requirements for rtd aren't changed
Python's naming conflict shouldn't affect the read the docs requirements
file, so don't rename that one.
3 months ago
Philippe Antoine d9fae18432 swf: prevents overflow with bad config value
Ticket: 8642

Do not allocate too much by using the config value, when the flash
file does not require that much data anyways
3 months ago
Philippe Antoine 52490b8c26 ftp: do not error the flow on file before port
Ticket: 8659

If a client sends a SOTR/RETR command before doing a PASV/PORT
command, ther server may reply
425 Use PORT or PASV first.\r\n
and allow the client to continue sendinf other commands

So, Suricata should not put the whole flow into error, it just
sets an event, and continues to parse further
3 months ago
Jason Ish 26cf56bf54 github-ci: consolidate new authors check into a single workflow
Replace the two-workflow pattern (authors.yml + authors-done.yml) with a
single pull_request_target workflow.

I'm not sure this was possible when this job was originally created, but
apparently it is now.
3 months ago
Philippe Antoine f092d07f6d decode/sctp: chunk_cnt can be a u16
Ticket: 8661
3 months ago
Philippe Antoine 3ca2ed25a3 detect/datajson: check json objects are string as expected
Ticket: 8624
3 months ago
Jeff Lucovsky 2eefb1910d doc/fixup: Fixup usages of container-example
There are several places where transform-related container-example helper wasn't
formatting rules properly.
3 months ago
Jeff Lucovsky d2e3bf1d34 doc: document xor transform variable key and offset syntax
Add user-facing documentation for the xor transform's 'extract <nbytes>
<offset>' syntax and offset parameter in rules/transforms.rst.

Add a devguide section (devguide/extending/detect/transforms.rst)
covering the detection pipeline execution order, how transforms run
before detection-time keywords, and how xor reads key bytes directly
from the raw buffer at a specified position and width. Explains how
the engine deduplicates inspection buffers for rules with variable
keys at different buffer positions.

Issue: 8671
3 months ago
Jeff Lucovsky 5d007ef25e detect/xor: add inline variable key syntax
Extend the xor transform to accept a variable-position key using
the 'extract <nbytes> <offset>' syntax. The engine reads <nbytes> bytes
at buffer position <offset> at transform time.

The optional 'offset' parameter specifies where XOR decoding
starts in the buffer; bytes before that position are left unchanged.

Syntax:
  xor:"<hex_key>"
  xor:extract <nbytes> <offset>
  xor:offset <N>,"<hex_key>"
  xor:offset <N>,extract <nbytes> <offset>

Variable-key helpers (VariableKeyLocation, variable_key_bytes,
parse_key_location, strip_keyword_prefix) are imported from the new
varkey module.

The variable key bytes are copied out of the inspection buffer before
decoding, so an in-place transform cannot corrupt the key when the key
region overlaps the decoded range.

Issue: 8671
3 months ago
Jeff Lucovsky 385bd4416b detect/transforms: add varkey module for variable-key helpers
Introduce rust/src/detect/transforms/varkey.rs to centralise helpers
used by transforms that read key material directly from the inspection
buffer at transform time.

Exported items:
  VariableKeyLocation  { offset: u16, nbytes: u8 }
  variable_key_bytes   bounds-checked slice into an inspection buffer
  strip_keyword_prefix strip 'keyword<ws>' from option strings
  parse_key_location   parse '<nbytes> <offset>' into VariableKeyLocation

All four items are pub so any transform can import them. Unit tests
are included in the module.

Issue: 8671
3 months ago
Philippe Antoine 72e9314402 ci: check cargo fmt for whole suricata 3 months ago
Philippe Antoine e6ee69c7da rust: format all files
except the ones with #[rustfmt::skip]

Ticket: 3836
3 months ago
Shivani Bhardwaj 3adb975032 misc: rename requirements.txt to bundle.txt
Do not use Python's standard file name to define external packages that
need to be installed. This confuses Dependabot.
3 months ago
Victor Julien 2b19f86ee6 Revert "af-packet: speed up thread sync during startup"
This reverts commit 923ad6af77.

Several issues have been reported:

1. non-deterministic thread to queue mapping (privately reported)

2. race condition causing IPS mode to loose packets, or get stuck
   completely, ticket 8667.

Ticket: #8667.
3 months ago
Philippe Antoine ac1b3cc1ef windows: always quote path for windows functions needing it
Ticket: 8600

CreateServiceA doc states for example :

> If the path contains a space, it must be quoted so that it is
  correctly interpreted.

Also fixes strlcat usage and check return value to error out on
truncated path
3 months ago
Philippe Antoine 114c80099c suricata: make FUZZING a feature
so as to skip SV tests that would fail when we are building in unsafe
fuzzing mode
3 months ago
Philippe Antoine 5a03fbfc61 detect/engine-analyzer: add note for pcre with \X
Ticket: 8634
3 months ago
Maxime FORJA a4841e60cb docs: fix typos in Basic_Setup.txt
- Fixed a typo where 'change' was used instead of 'chance'.

- Removed trailing spaces before commas.

- Corrected 'up-dated' to 'updated'.
3 months ago
Samaresh Kumar Singh decd897eff doc: clarify suricata.yaml location per install
The Quickstart guide installs Suricata from the Ubuntu PPA, where the
config lives at /etc/suricata/suricata.yaml. A source build installs it
under the prefix passed to configure, which defaults to /usr/local, so
the file ends up at /usr/local/etc/suricata/suricata.yaml instead. Add a
note next to the edit step so source-build users are not confused when
the package path does not exist on their system.

Ticket: #8358
Signed-off-by: Samaresh Kumar Singh <ssam3003@gmail.com>
3 months ago
Philippe Antoine ca34fba00c rust: format smb files
Ticket: 3836
3 months ago
Philippe Antoine f8ac56c591 dcerpc: remove obsolete comment 3 months ago
Jason Ish 2fe4bb2872 ftpdata: ignore direction in ftpdata_command
The ftpdata_command would never match a RETR in the to_server direction,
or a STOR in the to_client direction, this effectively makes the
ftpdata_command applicable to passive mode only.

Instead, remove the directionality on the ftpdata_command. Its "meta"
information passed from the control channel and isn't really
directional. I think the idea was to abstract away active/passive from
the rule writer, but unfortunately doesn't allow the ftpdata_command
keyword to work in the more strict firewll mode.

Ticket: #8663
3 months ago
Jason Ish d346e469c5 ftp: skip ts inspection on tc only transactions
In FTP, the first transaction is a banner from the server. Skip TS
inspection on this transaction.

Allows firewall mode to get past this transaction and onto the next.

Ticket: #8662
3 months ago
Philippe Antoine 097975e289 fuzz: forbid usage of pcre with \X
Ticket: 8634
3 months ago
Philippe Antoine aea9fd73b7 rust: format dcerpc files
Ticket: 3836
3 months ago
Abhijeet Singh 28b10fb042 util/log: rotate log file periodically
Fix log file not rotating during zero traffic periods by triggering rotation logic every second

Ticket: https://redmine.openinfosecfoundation.org/issues/8115
3 months ago
Victor Julien 1eff94f2b2 github-ci: add gcc analyzer build
Make sure to not run against lua rust crate build, as it's not clean.
3 months ago
Victor Julien 7cb64cc20f nfq: suppress gcc analyzer warnings 3 months ago
Victor Julien 79ef58be12 mpm/hs: remove useless pointer check
Pointer can't be NULL, so don't check it.

Helps gcc analyzer as well.
3 months ago
Victor Julien f434732c73 util/var-name: help gcc analyzer
Help it understand TAILQ.
3 months ago
Victor Julien 32fc437568 spm/bm: match suff array to pattern size
Avoids gcc -fanalyzer warning about out of bounds write to the array.
3 months ago
Victor Julien 5179af5557 affinity: gcc analyzer warnings
The double strchr confused gcc -fanalyzer.
3 months ago
Victor Julien f9cf9c1de7 output: suppress gcc analyzer warnings
By teaching about TAILQ.
3 months ago
Victor Julien e2f9211727 log-pcap: address gcc analyzer warnings
Reopen file descriptor for lz4 with the init function. This helps
code analyzers understand the handle it's leaked.

Improve flow of profiling dumps to avoid analyzer confusion around the
file descriptor.

Suppress TAILQ related warnings.
3 months ago
Victor Julien 65f1a022f0 detect/ip_proto: clean up parsing function
Helps address a gcc -fanalyzer warning.
3 months ago
Victor Julien ff7fae54d2 detect/flowvar: help gcc -fanalyzer
Add debug validation statement to assert prev pointer is not NULL.
3 months ago
Victor Julien 05eac977f0 detect/sigorder: handle allocation failure
Addresses a gcc -fanalyzer warning.
3 months ago
Victor Julien caa9ddaa26 decode/tcp: only set data ptr for valid option lengths 3 months ago
Victor Julien 32414573a7 conf: assist gcc -fanalyzer
Work around TAILQ false positive.
3 months ago