Commit Graph

1058 Commits (23323a961facb4975e057669e04e91283abe0774)

Author SHA1 Message Date
Victor Julien db0f9ddc69 files/tx: inspection, logging and loop optimizations
Introduce AppLayerTxData::file_tx as direction(s) indicator for transactions.
When set to 0, its not a file tx and it will not be considered for file
inspection, logging and housekeeping tasks.

Various tx loop optimizations in housekeeping and output.

Update the "file capable" app-layers to set the fields based on their
directional file support as well as on the traffic.
2 years ago
Victor Julien 79499e4769 app-layer: move files into transactions
Update APIs to store files in transactions instead of the per flow state.

Goal is to avoid the overhead of matching up files and transactions in
cases where there are many of both.

Update all protocol implementations to support this.

Update file logging logic to account for having files in transactions. Instead
of it acting separately on file containers, it is now tied into the
transaction logging.

Update the filestore keyword to consider a match if filestore output not
enabled.
2 years ago
Victor Julien 01e64d80da app-layer: trunc parser per direction 2 years ago
Victor Julien ff9d1807f9 app-layer: parser flags to u16 2 years ago
Victor Julien c27df6304d app-layer: introduce common AppLayerStateData API
Add per state structure for storing flags and other variables.
2 years ago
Victor Julien 879a46f085 rust: lock to time 0.3.13 to avoid MSRV bump to 1.59
Indirect dependency through x509-parser.
2 years ago
Pierre Chifflier 16db04c1a7 rust: remove nom 5 dependency 2 years ago
Pierre Chifflier 0acf75bff7 rust/applayertemplate: convert to nom7 2 years ago
Pierre Chifflier 378e915846 rust/asn1: convert parsers to nom7 2 years ago
Pierre Chifflier 0ba0572c4a rust/x509: finish transition to nom7 2 years ago
Pierre Chifflier 3ef5121ab0 rust/telnet: convert parsers to nom7 2 years ago
Pierre Chifflier d98b386f36 rust/conf: convert parser to nom7 2 years ago
Pierre Chifflier db9a1e17b6 rust/ssh: finish transition to nom7 2 years ago
Pierre Chifflier b31c72c06a rust/rdp: convert parsers to nom7 2 years ago
Pierre Chifflier 49520b2143 rust/rdp: upgrade dependency on tls-parser 2 years ago
Pierre Chifflier beadd090b8 rust: upgrade versions of BER/DER, Kerberos and SNMP parsers 2 years ago
Jason Ish baab1de735 rust: update x509-parser to 0.14.0
Resolves RustSec issues in time and chrono:
- https://rustsec.org/advisories/RUSTSEC-2020-0071
- https://rustsec.org/advisories/RUSTSEC-2020-0159

Ticket: #5259.

Ammended by Victor Julien to bump to 0.14 instead of 0.13.
2 years ago
Pierre Chifflier 3aace49649 rust/x509: update dependency on x509-parser 2 years ago
Jeff Lucovsky ab4d0f7f4a detect/stream_size: Rename detect.rs to stream_size.rs
This commit renames detect.rs to stream_size.rs to reflect its content.
2 years ago
Jeff Lucovsky 2386f2614f detect/iprep: Move iprep logic into a separate module 2 years ago
Jeff Lucovsky c957882d1c detect/uri: Move uri logic into a separate module 2 years ago
Jeff Lucovsky 484c34bc60 detect/uint: Move uint logic into a separate module
This commit moves the uint logic into its own module.
2 years ago
Jeff Lucovsky 8bfe427a74 rust/detect: Create detect module for rule parsing
This commit creates a module named "detect" for rule parsing logic. As
part of this commit, detect.rs is moved from its toplevel position into
the new module. Thus, use crate::detect::detect to refer to items within
detect.rs (instead of create::detect).

Ticket: 5077
2 years ago
Jeff Lucovsky ccd1063e43 detect/bytemath: convert parser to Rust
Issue: 5077

This commit
- Converts the PCRE based parser to Rust.
- Adds unit tests to the new Rust modules
- Removes the PCRE parser from detect-bytemath.c
- Adjusts the C source modules to refer to the Rust definitions
- Includes the multiply operator (missing from the C parser)
2 years ago
Philippe Antoine af40873127 pgsql: config limit maximum number of live transactions
As is done for other protocols

Ticket: #5527
2 years ago
Philippe Antoine e160917bcf mqtt: remove quadratic time complexity
When having many transactions in a single parsing call...

Fix has overhead of having one more field in the mqtt state.

Completes commit a8079dc978

Ticket: #5399
2 years ago
Philippe Antoine 5ef259722b dhcp: adds renewal-time keyword
Ticket: #5507
3 years ago
Philippe Antoine 6faf6299e0 dhcp: adds rebinding-time keyword
Ticket: #5506
3 years ago
Philippe Antoine 95f0424423 nfs4: fix write record handling
Ticket: #5280
3 years ago
Philippe Antoine bf43011a43 dcerpc: convert transaction list to vecdeque for UDP
As was done for TCP in dfe76bb90 and d745d28d4

Ticket: #5518
3 years ago
Eric Leblond 2cc9152fc9 rust/smb: log uuid of interface in dcerpc
When doing a DCERPC request, we can use the context id to log the
interface that is used. Doing that we can see in one single event
what is the DCERPC interface and opnum that are used. This allows
to have all the information needed to resolve the request to a
function call.

Feature #5413.
3 years ago
Eric Leblond b6f1cf255c rust/smb/dcerpc: parse context id
As context id is used to know to which variant of the endpoint the
request is done, it is interesting to parse it.

Feature #5413.
3 years ago
Philippe Antoine 11f849c3ee protocol-change: sets event in case of failure
Protocol change can fail if one protocol change is already
occuring.

Ticket: #5509
3 years ago
Philippe Antoine e94920b49f smb: do not use tree id to match create request and response
As an SMB2 async response does not have a tree id, even if
the request has it.

Per spec, MessageId should be enough to identifiy a message request
and response uniquely across all messages that are sent on the same
SMB2 Protocol transport connection.
So, the tree id is redundant anyways.

Ticket: #5508
3 years ago
Philippe Antoine 461725a9bf dhcp: adds leasetime keyword
As it is logged

Ticket: #5435
3 years ago
Philippe Antoine 9b4a133777 http2: remove to_vec for comparisons
Ticket: #5454
3 years ago
Philippe Antoine d011b468da http2: fix clippy warning about &Vec<u8>
Using &[u8] instead in function prototype
3 years ago
Philippe Antoine 3de735ae70 ike: log ikev1 tx fields instead of state ones
As state fields can grow abitrarily, and this can lead to DOS
by quadratic complexity (CPU time and disk space)

Adds a direction field to retain all the information in the
transaction.

Also checks array vendor_ids had at least one element before
logging it.

Ticket: #5455
3 years ago
Philippe Antoine d0171d7418 ike: rustfmt 3 years ago
Philippe Antoine 5c7b5c5fb5 krb: detection for ticket encryption
As is done for logging.

Ticket: #5442
3 years ago
Philippe Antoine 64b2385c64 krb: log for ticket encryption
Also logs if the ticket encryption is weak.
It is different from the encryption used for the rest of the
packet, and this allows to detect kerberoasting attack.

Ticket: #5442
3 years ago
Philippe Antoine 7fcc6696cb krb: rustfmt kerberos.rs 3 years ago
Philippe Antoine 675de33405 krb: bump up crate version
kerberos parser crate is also used by other procotols : nfs and
smb. These protocols use an older der_parser crate version.
Upgrading der_parser will simplify the code further.
3 years ago
Philippe Antoine 783dff2c38 krb: rustfmt detect.rs 3 years ago
Jason Ish c862e84c01 rust/frames: cleanups
- Implement the Display trait on Direction to print "toserver" or
  "toclient" which used in a format string.

- Use Direction struct inside Frame instead of a u32.  Requires a helper
  method as there are two representation in C for direction, and the C
  methods for frames don't use the internal representation of the
  Direction enum (some sweeping changes could help here)
3 years ago
Jason Ish f92708b8ca rust/frames: derive direction from StreamSlice
On the Rust side, a Frame requires a StreamSlice to be created. We can
derive the direction from the StreamSlice removing the need for callers
to provide the direction when operating on the frame.
3 years ago
Jason Ish b39d7f46e7 dns/tests: fix StreamSlice to satisfy debug validation 3 years ago
Philippe Antoine f3b6fd3329 quic: update to nom7 3 years ago
Philippe Antoine 95125811b8 quic: reassemble crypto frames and parse it 3 years ago
Philippe Antoine f242fb7f22 quic: events and rules on them 3 years ago