Commit Graph

16826 Commits (master)
 

Author SHA1 Message Date
Philippe Antoine c00e13772e fuzz: better init for signature parsing target
Fixes https://issues.oss-fuzz.com/u/1/issues/391975646
4 weeks ago
Shivani Bhardwaj c73299a298 dcerpc/tcp: add frames support
Frames of the following types have been added for toserver direction:
1. Pdu: The entire Protocol Data Unit
2. Hdr: Header of the request
3. Data: PDU data

Feature 4904
4 weeks ago
Shivani Bhardwaj d3551393f0 applayer: remove complex unittest
as it is now covered by the suricata-verify test
dcerpc-request-http-response.
4 weeks ago
Shivani Bhardwaj 9daf8528b7 dcerpc: tidy up code
- remove unneeded variables
- remove unnecessary tracking of bytes in state
- modify calculations as indicated by failing tests
4 weeks ago
Shivani Bhardwaj 4790da1825 dcerpc: remove fragmented data tests
With the introduction of AppLayerResult::incomplete API, fragmented data
is no longer handled fully in the dcerpc code. Given that these code
paths are already covered by the following s-v tests, these tests can now be
safely removed.
- dce-gap-handling
- dcerpc-dce-iface-*

Ticket 5699
4 weeks ago
Shivani Bhardwaj 74de1042a9 dcerpc: use AppLayerResult::incomplete API
Instead of own internal mechanism of buffering in case of fragmented
data, use AppLayerResult::incomplete API to let the AppLayer Parser take
care of it. This makes the memory use more efficient.
Remove any unneeded variables and code with the introduction of this
API.

Ticket 5699
4 weeks ago
Shivani Bhardwaj fc88e61c7f dcerpc: save version info in tx
to make it available for logging.
4 weeks ago
Shivani Bhardwaj 0d6017d174 dcerpc: do not assume an upper bound on data
TCP data can be presented to the protocol parser in any way e.g. one
byte at a time, single complete PDU, fragmented PDU, multiple PDUs at
once. A limit of 1MB can be easily reached in some of such scenarios.
Remove the check that rejects data that is more than 1MB.
4 weeks ago
Shivani Bhardwaj 84d7055056 app-layer: update flow counter if an alproto is detected
If alproto for the current direction was not detected but the opposite
side was successfully detected, if the Pattern Matching and Pattern
Probing on the flow was also successfully done and the current
direction's alproto is still unknown, a decoder event is set to indicate
that the protocol detection only happened in one direction.

This event is set after having sent the current data to the applayer
parser. Now, the respective applayer parser may or may not successfully
parse the data. However, the alproto on flow is already set from the
other direction so there will be a flow event generated by Suricata. In
order to keep this consistent with the stats, also make sure to
increment the flow counter when the decode event is set so that the flow
counter is incremented irrespective of the parsing status reported by
the applayer parser.

This patch makes stats for several specific applayer flow count equal to
the number of flow events logged for those specific applayer protocols.

Bug 7238
4 weeks ago
Jeff Lucovsky cfbf8fda94 doc/csum: Stream checksum validation change
Describe the change of behavior between the stream.checksum-validation
setting and checksum-based rule keywords.
1 month ago
Jeff Lucovsky 758da982f0 detect/csum: rm interaction btw stream setting/csum
Issue: 7467

Stream checksum validation no longer has a side effect of setting
PKT_IGNORE_CHECKSUM and thus, no longer affects csum keyword checks.
1 month ago
Victor Julien 3f3964555e detect/iponly: use flow first flags
Instead of ip-only specific flags, reuse the FLOW_PKT_TOSERVER_FIRST and
FLOW_PKT_TOCLIENT_FIRST flags.

Fixes false positives on one sided streams that trigger a opposing flow
timeout packet at the flow's end. That pseudo packet would trigger a
match even though it shouldn't.

Ticket: #7521.
1 month ago
Eric Leblond 8230cb5672 util/debug: increase max length of message
When a signature is incorrect, its full content is logged in a
message with some other information such as rules file name. As
a result, the log message must be longer than a maximum signature
length which is 8192.

Ticket: 7419
1 month ago
Juliana Fajardini a2905ae5d4 userguide: explain rule types and categorization
Add documentation about the rule types introduced by commit
2696fda041.

Add doc tags around code definitions that are referenced in the docs.

Task #https://redmine.openinfosecfoundation.org/issues/7031
1 month ago
Philippe Antoine 72c08cb94e http: htp_headers_t alias for htp_table_t
In preparation of libhtp rust
1 month ago
Philippe Antoine 439d3766d7 http: minor cleanups for detect
In preparation of libhtp rust

Mainly adding some const
1 month ago
Philippe Antoine 46c054da3f http: minor cleanups for output-json-http
In preparation of libhtp rust

Mainly using htp_header_value_ptr and htp_header_value_len
when possible
1 month ago
Philippe Antoine 9f99bde1f9 http: minor cleanups for htp-xff.c
In preparation of libhtp rust
1 month ago
Philippe Antoine 5f84114958 http: minor cleanups for htp-file.c
In preparation of libhtp rust
1 month ago
Philippe Antoine 42ed59aa21 http: aliases for htp opaque htp_headers_t
In preparation of libhtp rust
1 month ago
Philippe Antoine 4478c94395 http: use const http_header_t in stub
In preparation of libhtp rust
1 month ago
Philippe Antoine 18dc86f50a http: constify some function arguments
In preparation of libhtp rust
1 month ago
Cole Dishington c46308957f flow: optionally use pkt recursion for hash
If a Suricata inline IPS device is routing traffic over a
non-encrypted tunnel, like IPv6 tunnels, packets in a flow
will be dropped and not be matched. e.g.

The following example is a Suricata inline IPS with an IPv6 tunnel:
request: IPv4]ICMP] -> |IPS| -> IPv6]IPv4]ICMP]
reply:              <- |IPS| <- IPv6]IPv4]ICMP]
Both the IPv4 request and IPv6 reply will be seen by Suricata on
ingress. The flows will not be matched due to flow recursion level.

Optionally use pkt recursion level in flow hash. Excluding recursion
level in flow hash allows matching of packet flows and defrag on an
inline IPS Suricata scenario where the IPS device is a tunnel
terminator.

Feature: 6260
1 month ago
Jeff Lucovsky 53abe1e5d7 doc: Add ftp.command sticky buffer
Issue: 7502

This commit documents the new FTP sticky buffer "ftp.command".
1 month ago
Jeff Lucovsky b662feb162 detect/ftp.command: Add sticky buffer
Issue: 7502

Add a sticky buffer for "ftp.command" for matching on FTP command names.
1 month ago
Philippe Antoine c5f3d33e51 detect/smtp: smtp.rcpt_to keyword
Ticket: 7516

It is a sticky buffer mapping to the smtp.rcpt_to[] log field
It is a multi-buffer
1 month ago
Philippe Antoine 32594766b7 detect/smtp: smtp.mail_from keyword
Ticket: 7517

It is a sticky buffer mapping to the smtp.mail_from log field
1 month ago
Philippe Antoine 3d3b1ade9d detect/smtp: smtp.helo keyword
Ticket: 7515

It is a sticky buffer mapping to the smtp.helo log field
1 month ago
Jason Ish 99096699c0 rust/logging: fix logging from plugins
Commit 2bcc66da58 broke logging from
plugins:

- debug visibility was reduced making it unusable from an external crate
- the plugins view of the log level was broken

To fix:
- make debug pub
- minor change to initialization of the log LEVEL as seen by the plugin
  so its seen by the plugin. I'm not really sure why the previous
  version wasn't working though, but this one does
1 month ago
Jason Ish d63ad75d91 lua: add "builtins" file to consolidate registration
Use a single array of built-ins and provide 2 functions for
registering them:

- SCLuaLoadBuiltIn: for loading built-in modules in sandboxed
  environments.

- SCLuaRequirefBuiltIns: registers built-in modules with the standard
  package tool, allows built-ins to be loaded by output scripts that are
  not restricted

I hope to refactor the sandbox so they can use SCLuaRequirefBuiltIns
as well.
1 month ago
Jason Ish c8b28b1512 doc/userguide: document lua hashlib 1 month ago
Jason Ish d3c556b82d lua: expose hashing functions to lua scripts
Expose md5, sha1, and sha256 to Lua scripts with
`require("suricata.hashing")`.

Ticket: 7073
1 month ago
Jason Ish c4fc2aac3b rust/hashing: add more hex variants
Make all the hasher's have the same variants:
- add hex digest for sha256
- add finalize to hex for sha1
- add hex digest for sha1
1 month ago
Philippe Antoine a0bb260d91 source/pcap-file: remove unused macro warning 1 month ago
Philippe Antoine b09c543d73 detect/base64: remove unused macro warning
when compiling without unit tests
detect-transform-base64.c:47:9: warning: macro is not used [-Wunused-macros]
   47 | #define DETECT_TRANSFORM_FROM_BASE64_MODE_DEFAULT (uint8_t) Base64ModeRFC4648
1 month ago
Philippe Antoine b11381d952 rust: AppLayerRegisterParser out of SuricataContext
Just use a regular compile time rust export, instead of having
a runtime definition through the SuricataContext structure
1 month ago
Philippe Antoine 5c93291565 rust: generated bindings depend on cbindgen.toml
make should rerun cbindgen if cbindgen.toml is modified
1 month ago
Alice Akaki 8416289752 detect: add ldap.responses.count
ldap.responses.count matches on the number of LDAP responses
This keyword maps to the eve field len(ldap.responses[])
It is an unsigned 32-bit integer
Doesn't support prefiltering

Ticket: #7453
1 month ago
Alice Akaki da593abd99 detect: add ldap.responses.operation
ldap.responses.operation matches on Lightweight Directory Access Protocol response operations
This keyword maps to the eve field ldap.responses[].operation
It is an unsigned 8-bit integer
Doesn't support prefiltering

Ticket: #7453
1 month ago
Alice Akaki cdb043810f detect: add ldap.request.operation
ldap.request.operation matches on Lightweight Directory Access Protocol request operations
This keyword maps to the eve field ldap.request.operation
It is an unsigned 8-bit integer
Doesn't support prefiltering

Ticket: #7453
1 month ago
Alice Akaki 824c5d4f06 rustfmt: rust/src/ldap/types.rs 1 month ago
Philippe Antoine b0db4e2dbe http: aliases for htp opaque htp_header_t
In preparation of libhtp rust
1 month ago
Philippe Antoine a0e44ebb17 http: use even more aliases for htp opaque htp_tx_t
For request and response headers

In preparation of libhtp rust
1 month ago
Philippe Antoine 82e31e14c0 http: use alias for htp opaque htp_tx_t
In preparation of libhtp rust

This occurence was missed in 23050d70ed
1 month ago
Philippe Antoine 9a8e377a7a http: include htp-libhtp.h from header
Instead of C files requiring it.
In preparation of libhtp rust, to minimize the final commit.
1 month ago
Victor Julien d6b56929d3 detect: set mpm/prefilter during signature parsing
In preparation of flowbit prefilter work that needs this info
earlier.

Track potential prefilter sm's to avoid unnecessary looping during
setup.
1 month ago
Jason Ish 5d9fad5edf rust/ssh: rustfmt 1 month ago
Jason Ish 9c87ac1b9b ssh: cleanup rust visibility and naming
Remove pub and no_mangle from non-exported functions and rename to
Rust as-needed.

Ticket: 7498
1 month ago
Jason Ish f8d27992f7 rust/ntp: rustfmt 1 month ago
Jason Ish f023b3a6f1 ntp: cleanup visibility and naming
Remove pub and no_mangle from non-exported functions and rename to
Rust as-needed.

Ticket: 7498
1 month ago