Commit Graph

15717 Commits (9aff8afc62ae2bc6ee03fe0c1f6f9595bc6fe85f)
 

Author SHA1 Message Date
Victor Julien 9aff8afc62 util/file: add validation check for extreme data chunk sizes 2 years ago
Victor Julien cf6278f95a streaming/buffer: improve integer handling safety
Unsafe handling of buffer offset and to be inserted data's length
could lead to a integer overflow. This in turn would skip growing
the target buffer, which then would be memcpy'd into, leading to
an out of bounds write.

This issue shouldn't be reachable through any of the consumers of
the API, but to be sure some debug validation checks have been
added.

Bug: #6903.
2 years ago
Philippe Antoine e6895b835a detect/http-server-body: avoid FP on toserver direction
Ticket: 6948

http.response_body keyword did not enforce a direction, and thus
could match on files sent with POST requests
2 years ago
Victor Julien 08841f27ff ips: check for livedev.use-for-tracking
For the capture methods that support livedev and IPS,
livedev.use-for-tracking is not supported.

This setting causes major flow tracking issues, as both sides of
a flow would be tracked in different flows.

This patch disables the livedev.use-for-tracking setting if it
is set to true. A warning will be issued.

Ticket: #6726.
2 years ago
Victor Julien 2d625cd78e capture: block IDS + IPS combination
In general, improve IPS setup error checking.

Ticket: #5588.
2 years ago
Victor Julien 58bff9b855 capture: improve IDS + IPS check
Improve it for af-packet, dpdk, netmap. Check would not consider
an interface IDS if the `default` section contained a copy-mode
field.
2 years ago
Juliana Fajardini bb59124063 yaml: unify 0 stats counter config option terms
When we added feature #5976 (72146b969), we overlook that we also have
a config stats option for the human-readable stats logs to output
0 counters.
Due to not seeing this before, we now have two different setting names
for basically the same thing, but in different logs:
- zero-valued-counters for EVE
- null-values for stats.log

This ensures we use the same terminology, and change the recently added
one to `null-values`, as this one has been around for longer.

Task #6962
2 years ago
Juliana Fajardini d3354555af yaml/eve/stats: remove mention exception policy
The stats config for EVE logs have a comment about exception policy
stats counters. This went in with 72146b969c, but shouldn't have,
as there are no options there.
2 years ago
Philippe Antoine 2b4e10224e output/alert: check flag before logging app-layer
Ticket: 6846
2 years ago
Philippe Antoine 910f6af54f output: do not use tx id 0 when there is no tx
Ticket: 6846

This led to packet rules logging irrelevant app-layer data
2 years ago
Jeff Lucovsky d7026b7b11 detect/ipopts: Handle multiple ip options
Issue: 6864

Multiple IP options were not handled properly as the value being OR'd
into the packet's ip option variable were enum values instead of bit
values.
2 years ago
Jeff Lucovsky ee942391f7 detect/ipopts: Remove unneeded PCRE logic
Issue: 6864

Reduce complexity by eliminating the PCRE logic and adding a unittest to
validate null/empty string handling
2 years ago
Jeff Lucovsky c27dee7a9b detect/ipopt: Misc. cleanup
Minor changes to improve readability, remove extraneous include files.
2 years ago
Philippe Antoine 0291d37009 websocket: configurable logging of payload in alerts 2 years ago
Philippe Antoine 44b6aa5e4b app-layer: websockets protocol support
Ticket: 2695
2 years ago
Philippe Antoine 78b766048e protodetect: run expected probing parser
When there is a protocol change, and a specific protocol is
expected, like WebSeocket, always run it, no matter the port.
2 years ago
Philippe Antoine 155d671b26 protodetect: allows not port-based probing parsers
As for WebSocket which is detected only by protocol change.
2 years ago
Philippe Antoine 97d94b1067 protodetect: remove unused field
port is used in AppLayerProtoDetectProbingParserPort
and not in AppLayerProtoDetectProbingParserElement
2 years ago
Philippe Antoine f83ec543e3 http2: add settings from newer RFCs
Including the one for websocket over HTTP/2
2 years ago
Philippe Antoine 9075e58973 enip: register on default 44818/tcp port
if no config option is found,
as is done for udp

Ticket: 6304
2 years ago
Philippe Antoine 240e068b81 conf: avoid quadratic complexity
Ticket: 6878

Follow up on 15649424a7

When adding many sequence nodes, either from start or scalar event

We add "sequence nodes" whose name is an integer cf sequence_node_name
and then run ConfNodeLookupChild to see if it had been already set
(from the command line cf comment in the code)
And ConfNodeLookupChild iterates the whole linked list...

1. We add node 1
2. To add node 2, we check if node 1 equals this new node
3. To add node 3, we check if nodes 1, or 2 equals this new node's name
And so on...

This commits avoids these checks ig the list is empty at the beginning
2 years ago
Andreas Herz 1f9600e487 dataset: cleanup datasets that hit the memcap while loading
Datasets that hit the memcap limit need to be discarded if the memcap is
hit or otherwise the datasets are still loaded with partial data while
the signature is not loaded due to the memcap error.

Ticket: #6678
2 years ago
Victor Julien dc5b78ec71 decode/ppp: fix iplen check int handling
** CID 1596376:    (CONSTANT_EXPRESSION_RESULT)
/src/decode-ppp.c: 64 in DecodePPPCompressedProto()
/src/decode-ppp.c: 55 in DecodePPPCompressedProto()

________________________________________________________________________________________________________
*** CID 1596376:    (CONSTANT_EXPRESSION_RESULT)
/src/decode-ppp.c: 64 in DecodePPPCompressedProto()
58             case 0x57: { /* PPP_IPV6 */
59                 if (unlikely(len < (data_offset + IPV6_HEADER_LEN))) {
60                     ENGINE_SET_INVALID_EVENT(p, PPPIPV6_PKT_TOO_SMALL);
61                     return TM_ECODE_FAILED;
62                 }
63                 DEBUG_VALIDATE_BUG_ON(len < data_offset);
>>>     CID 1596376:    (CONSTANT_EXPRESSION_RESULT)
>>>     "65535 /* 32767 * 2 + 1 */ < (uint16_t)(len - data_offset)" is always false regardless of the values of its operands. This occurs as the logical first operand of "?:".
64                 uint16_t iplen = MIN(USHRT_MAX, (uint16_t)(len - data_offset));
65                 return DecodeIPV6(tv, dtv, p, pkt + data_offset, iplen);
66             }
67             case 0x2f: /* PPP_VJ_UCOMP */
68                 if (unlikely(len < (data_offset + IPV4_HEADER_LEN))) {
69                     ENGINE_SET_INVALID_EVENT(p, PPPVJU_PKT_TOO_SMALL);
/src/decode-ppp.c: 55 in DecodePPPCompressedProto()
49             case 0x21: { /* PPP_IP */
50                 if (unlikely(len < (data_offset + IPV4_HEADER_LEN))) {
51                     ENGINE_SET_INVALID_EVENT(p, PPPVJU_PKT_TOO_SMALL);
52                     return TM_ECODE_FAILED;
53                 }
54                 DEBUG_VALIDATE_BUG_ON(len < data_offset);
>>>     CID 1596376:    (CONSTANT_EXPRESSION_RESULT)
>>>     "65535 /* 32767 * 2 + 1 */ < (uint16_t)(len - data_offset)" is always false regardless of the values of its operands. This occurs as the logical first operand of "?:".
55                 uint16_t iplen = MIN(USHRT_MAX, (uint16_t)(len - data_offset));
56                 return DecodeIPV4(tv, dtv, p, pkt + data_offset, iplen);
57             }
58             case 0x57: { /* PPP_IPV6 */
59                 if (unlikely(len < (data_offset + IPV6_HEADER_LEN))) {
60                     ENGINE_SET_INVALID_EVENT(p, PPPIPV6_PKT_TOO_SMALL);
2 years ago
Juliana Fajardini ce1556cefd pgsql: check for eol when parsing response
It was brought to my attention by GLongo that Pgsql parser handled eof
diffrently for requests and responses, and apparently there isn't a good
reason for such a difference therefore, apply same logic used for
rs_pgsql_parse_request for checking for eof when parsing a response.
2 years ago
Juliana Fajardini 54ea6c5983 eve/alert: add missing pgsql metadata
Bug #6092
2 years ago
Sascha Steinbiss 120313f4da ja4: implement for TLS and QUIC
Ticket: OISF#6379
2 years ago
Sascha Steinbiss 9d0db71ebf ja3: make feature compile time configurable 2 years ago
Sascha Steinbiss 32f23b6d2f suricata: initialize feature tracking earlier
This gives app layer code a chance to access feature
information.
2 years ago
Jeff Lucovsky c305ed149c flow/inject: Select thread_id by flow flag
Issue: 6957

Rather than selecting the thread_id index by packets traveling to the
server, use the flow flags. If the flow has been reversed, the second
slot is represents the thread id to be used.
2 years ago
Victor Julien 516441b600 decode/ppp: add missing types definitions
Recognize PPP_CCP, PPP_CBCP and PPP_COMP_DGRAM.

Does not implement decoders for these record types, so these
are logged as unsupported types. Was "wrong_type" before.
2 years ago
Victor Julien 7e3f071e49 decode/ppp: clean up ppph pointer use
No users of the pointer anymore, so remove it.
2 years ago
Victor Julien 6067955afd decode/ppp: remove ppph check in favor of flag
As we now support variable size headers, we can't use the old pointer.

Replace with a flag.
2 years ago
Victor Julien 68092ff33c decode/ppp: support different header formats
Support compressed proto and optional HDLC header.

Bug: #6942.
2 years ago
Philippe Antoine bd3bed6c31 detect/analyzer: add more details for tcp_mss
Issue: #6355
2 years ago
Philippe Antoine 49caf005a4 detect/analyzer: create tojson function for generic integers
As will be needed for tcp.mss
2 years ago
Philippe Antoine 784ce30ae1 util: remove unused bloom filter code
Ticket: 4083
2 years ago
Philippe Antoine b113bdd9e3 src: remove unused headers-exported functions
+ remove double definition of IPPairLock

Ticket: #4083
2 years ago
Jeff Lucovsky 2dfa4cecb5 stats: Memcap pressure max relocation
This commit moves the memcap pressure/pressure_max stats from the global
stats namespace into the memcap namespace.

With per-thread stats, they will be within the flow-manager's values.

Issue: 6398
2 years ago
Jeff Lucovsky 7a5a1e2560 doc: Describe noalert keyword
Issue: 6685
2 years ago
Philippe Antoine 3643b6ed4b output: generic simple tx json logger
Ticket: 3827
2 years ago
Philippe Antoine 688efe79f0 output/dns: do not add empty app-layer metadata 2 years ago
Philippe Antoine 74aa80022c output/dnp3: restrict function scope to one file 2 years ago
Victor Julien 76322368ed pcap: support LINKTYPE_IPV6 (229)
This is just another variant of DLT_RAW.

Ticket: #6943.
2 years ago
Victor Julien 49c67b2bb1 defrag: fix wrong datalink being logged
Eve's packet_info.linktype should correctly indicated what the `packet`
field contains. Until now it was using DLT_RAW even if Ethernet or other
L2+ headers were present.

This commit records the datalink of the packet creating the first
fragment, which can include the L2+ header data.

Bug: #6887.
2 years ago
Juliana Fajardini 72146b969c eve/stats: allow hiding counters whose valued is 0
Some stats can be quite verbose if logging all zero valued-counters.
This allows users to disable logging such counters. Default is still
true, as that's the expected behavior for the engine.

Task #5976
2 years ago
Lukas Sismis 10590e6d94 dpdk: support 52 byte long key on ice (E810) cards 2 years ago
Lukas Sismis d4085fceb6 dpdk: enlarge key length to 52 bytes 2 years ago
Philippe Antoine 365a66ac1c ci: clean some disk space to run CIFuzz again 2 years ago
Jason Ish 1657b6ff3c cargo: add description and license
Required for publishing to crates.io.
2 years ago
Jason Ish b9127e8b96 automake/rust: remove path.lib
Remove the path.lib parameter that is substituted into the output
Cargo.toml by autoconf. Instead, as part of the build, "cd" into the
source directory. We already set the Rust target directory to the
external build directory.

This makes the Cargo.toml more generic, and in a format suitable for
publishing to crates.io. It also makes it easier to pull in external
crates without needing to patch up their Cargo.toml, for example, it
might make pulling libhtp-rs easier.
2 years ago