Commit graph

982 commits

Author SHA1 Message Date
Tim Wojtulewicz
9033018509 Drop support for subscribing to bro/ topics 2024-01-16 16:16:01 -07:00
Arne Welzel
2182ec03b3 Merge remote-tracking branch 'origin/topic/awelzel/3264-smtp-bdat'
* origin/topic/awelzel/3264-smtp-bdat:
  btest/smtp: Test with smtp-bdat-pipeline-8bitmime.pcap
  SMTP: Add BDAT support
2024-01-12 10:49:28 +01:00
Arne Welzel
28b33b5c0d Merge remote-tracking branch 'origin/topic/neverlord/backward-compatibility'
* origin/topic/neverlord/backward-compatibility:
  Document upcoming breaking change for OpaqueVal
  Integrate review feedback
  Fix formatting
  Backward compatibility for OpaqueVal serialization
2024-01-11 12:38:39 +01:00
Arne Welzel
040068f390 NEWS: Update news for tunnel depth changes 2024-01-11 10:22:46 +01:00
Dominik Charousset
717799f45b Document upcoming breaking change for OpaqueVal 2024-01-11 09:02:49 +01:00
Arne Welzel
bddd74dcc1 Merge remote-tracking branch 'origin/topic/awelzel/quic-draft-mvfst-versions'
* origin/topic/awelzel/quic-draft-mvfst-versions:
  quic: Handle and log unhandled_version
  quic: Support decryption of a few more versions
2024-01-10 14:08:01 +01:00
Arne Welzel
f3cbfa9c25 parse: Support @if conditionals in record definitions
Closes #3531
2024-01-08 15:21:48 +01:00
Arne Welzel
fe0f981f87 Merge remote-tracking branch 'origin/topic/awelzel/3503-quic-v2'
* origin/topic/awelzel/3503-quic-v2:
  quic: tests: Require have-spicy
  quic: analyzer: Recognize and report unknown versions better
  quic: tests: Add QUIC v2 test cases
  quic: analyzer: Support QUIC v2
  quic: decrypt_crypto: Support QUIC v2
2024-01-05 14:44:20 +01:00
Arne Welzel
4ebd81fb23 Merge remote-tracking branch 'origin/topic/awelzel/3504-ldap-logs-scalars'
* origin/topic/awelzel/3504-ldap-logs-scalars:
  Update external baselines
  ldap: Use scalar values in logs where appropriate
  ldap: Rename LDAP::search_result to LDAP::search_result_entry
2024-01-03 12:35:51 +01:00
Arne Welzel
d01b0bafdb Merge remote-tracking branch 'origin/topic/awelzel/no-more-segment-profiler'
* origin/topic/awelzel/no-more-segment-profiler:
  segment_profiling: Remove SegmentProfiler and load_sample event
2024-01-03 12:25:20 +01:00
Arne Welzel
242db4981d ldap: Use scalar values in logs where appropriate
Skimming through the RFC, the previous approach of having containers for most
fields seems unfounded for normal protocol operation. The new weirds could just
as well be considered protocol violations. Outside of duplicated or missed data
they just shouldn't happen for well-behaved client/server behavior.
Additionally, with non-conformant traffic it would be trivial to cause
unbounded state growth and immense log record sizes.

Unfortunately, things have become a bit clunky now.

Closes #3504
2024-01-03 11:57:31 +01:00
Arne Welzel
3f7881a57b segment_profiling: Remove SegmentProfiler and load_sample event
While it seems interesting functionality, this hasn't been documented,
maintained or knowingly leveraged for many years.

There are various other approaches today, too:

* We track the number of event handler invocations regardless of
  profiling. It's possible to approximate a load_sample event by
  comparing the result of two get_event_stats() calls. Or, visualize
  the corresponding counters in a Prometheus setup to get an idea of
  event/s broken down by event names.

* HookCallFunction() allows to intercept script execution, including
  measuring the time execution takes.

* The global call_stack and g_frame_stack can be used from plugins
  (and even external processes) to walk the Zeek script stack at certain
  points to implement a sampling profiler.

* USDT probes or more plugin hooks will likely be preferred over Zeek
  builtin functionality in the future.

Relates to #3458
2024-01-03 11:55:54 +01:00
Arne Welzel
f3470843d6 rule-parse: Remove [event_name] syntax, deprecate msg as identifier
As suggested by Robin. Thanks.
2023-12-14 10:16:35 +01:00
Arne Welzel
a7b077aa17 signatures: Support custom event via [event_name] syntax
This change allows to specify a per signature specific event, overriding
the default signature_match event. It further removes the message
parameter from such events if not provided in the signature.

This also tracks the message as StringValPtr directly to avoid
allocating the same StringVal for every DoAction() call.

Closes #3403
2023-12-05 15:28:21 +01:00
Arne Welzel
dc487f04e4 NEWS: Entry for delayed log writes 2023-11-29 12:36:27 +01:00
Arne Welzel
e0cf206732 Merge remote-tracking branch 'origin/topic/neverlord/avoid-openssl-header-deps'
* origin/topic/neverlord/avoid-openssl-header-deps:
  Integrate review feedback
  Avoid OpenSSL header dependencies

Added NEWS during merge and removed never set OPENSSL_INCLUDE_DIR reference
in main CMakeLists.txt.
2023-11-22 10:35:27 +01:00
Arne Welzel
f95ec84d77 Merge remote-tracking branch 'origin/topic/awelzel/pattern-tables-reuse-compile-set'
* origin/topic/awelzel/pattern-tables-reuse-compile-set:
  TableVal: Replace raw subnets/pattern_matcher with unique_ptr
  TablePatternMatcher: Drop Insert()/Remove(), use Clear()
  TableType: Simplify and inline Is...Index tests
  NEWS: Add small table[pattern] section
  Expr/Val: Add support for in set[pattern]
  zeek.bif: Implement table_pattern_matcher_stats() bif for introspection
  DFA: Extract inner Stats struct from DFA_State_Cache
  Expr: Implement string in table[pattern] of X
  RE: Remove RE_DisjunctiveMatcher and re-use MatchAll()
  TablePatternMatcher: Use const StringValPtr& instead of const StringVal*
  Val: Move TablePatternMatcher into detail namespace
  TablePatternMatcher: Use unique_ptr
  IndexType: Add IsPatternIndex(), like IsSubNetIndex()
  btest: Add test for pattern tables and when
  Reuse CompileSet() instead of || string formatting
  script optimization support for using strings to index table[pattern] values
  BTests for indexing "table[pattern] of T" with strings
  support for indexing "table[pattern] of T" with strings to get multi-matches
2023-11-21 12:00:51 +01:00
Arne Welzel
96a0312ad2 NEWS: Add small table[pattern] section 2023-11-21 10:34:17 +01:00
Arne Welzel
a5a79d3f3a Merge remote-tracking branch 'origin/topic/awelzel/3453-dnssec-ed448-ed25519'
* origin/topic/awelzel/3453-dnssec-ed448-ed25519:
  DNS: Add Ed25519 and Ed448 enum values to parser
2023-11-21 10:08:34 +01:00
Arne Welzel
e339e93e69 strings.bif/sub,gsub: Respect anchors in pattern
Anchors within pattern passed to sub() or gsub() were previously ignored,
replacing any occurrence of '<text>' even when '^<text>' was used as a
pattern.

This is a pretty user-visible change (and we even have anchored patterns
within the base scripts), but seems "the right thing to do".

Relates to #3455
2023-11-17 14:37:25 +01:00
Arne Welzel
d9b8154c4e Merge remote-tracking branch 'origin/topic/awelzel/3455-do-split-string-2'
* origin/topic/awelzel/3455-do-split-string-2:
  strings.bif/do_split_string: Pass bol and eol to MatchPrefix()
  RE_Matcher: Add MatchPrefix with bol/eol control
2023-11-17 13:01:47 +01:00
Arne Welzel
de5fa1087a Add deprecations to NEWS [nomail] [skipci] 2023-11-08 11:27:53 +01:00
Arne Welzel
e56ef0fd9b packet_analysis: Avoid shared_ptr copying for analyzer lookups
For deeply encapsulated connections (think AWS traffic mirroring format
like IP,UDP,GENEVE,IP,UDP,VXLAN,ETH,IP,TCP), the Dispatcher::Lookup()
method is fairly visible in profiles when running in bare mode.

This changes the Analyzer::Lookup() and Dispatcher::Lookup() return value
breaking the API in favor of the performance improvement.

Relates to zeek/zeek#3379.
2023-11-01 12:03:02 +01:00
Arne Welzel
560f8a4a84 ssl: Prevent unbounded ssl_history growth
The ssl_history field may grow unbounded (e.g., ssl_alert event). Prevent this
by capping using a configurable limit (default 100) and raise a weird once reached.
2023-10-25 09:35:45 +02:00
Arne Welzel
c960d279a2 ssl: Cap number of alerts parsed from SSL record
Limit the number of events raised from an SSL record with content_type
alert (21) to a configurable maximum number (default 10). For TLS 1.3,
the limit is set to 1 as specified in the RFC. Add a new weird cases
where the limit is exceeded.

OSS-Fuzz managed to generate a reproducer that raised ~660k ssl_plaintext
and ssl_alert events given ~810kb of input data. This change prevents this
with hopefully no negative side-effect in the real-world.
2023-10-25 09:35:10 +02:00
Tim Wojtulewicz
738c39379f Start of 6.2.0 development 2023-10-13 10:58:29 -07:00
Tim Wojtulewicz
a4da0c64a1 Add missing NEWS entries for upcoming 6.1 release, reformat slightly 2023-10-13 10:00:34 -07:00
Arne Welzel
007bcefd09 Merge remote-tracking branch 'origin/topic/awelzel/2326-import-quic'
* origin/topic/awelzel/2326-import-quic:
  ci/btest: Remove spicy-quic helper, disable Spicy on CentOS 7
  btest/core/ppp: Run test in bare mode
  btest/quic: Update other tests
  testing/quic: Fixups and simplification after Zeek integration
  quic: Integrate as default analyzer
  quic: Include Copyright lines to the analyzer's source code contributed by Fox-IT
  quic: Squashed follow-ups: quic.log, tests, various fixes, performance
  quic: Initial implementation
2023-10-11 18:05:14 +02:00
Arne Welzel
94a8cf2a09 Merge remote-tracking branch 'origin/topic/awelzel/pcap-reading-configurable-buffer'
* origin/topic/awelzel/pcap-reading-configurable-buffer:
  iosource/pcap: Support configurable buffer size
  util/setvbuf: Respect buf argument
2023-10-11 15:20:17 +02:00
Arne Welzel
72df1a0216 Merge remote-tracking branch 'origin/topic/bbannier/issue-3234'
* origin/topic/bbannier/issue-3234:
  Introduce dedicated `LDAP::Info`
  Remove redundant storing of protocol in LDAP logs
  Use LDAP `RemovalHook` instead of implementing `connection_state_remove`
  Tidy up LDAP code by using local references
  Pluralize container names in LDAP types
  Move LDAP script constants to their own file
  Name `LDAP::Message` and `LDAP::Search` `*Info`
  Make ports for LDAP analyzers fully configurable
  Require have-spicy for tests which log spicy-ldap information
  Fix LDAP analyzer setup for when Spicy analyzers are disabled
  Bump zeek-testing-private
  Integrate spicy-ldap test suite
  Move spicy-ldap into Zeek protocol analyzer tree
  Explicitly use all of spicy-ldap's modules
  Explicitly list `asn1.spicy` as spicy-ldap source
  Remove uses of `zeek` module in spicy-ldap
  Fix typos in spicy-ldap
  Remove project configuration files in spicy-ldap
  Integrate spicy-ldap into build
  Import zeek/spicy-ldap@57b5eff988
2023-10-10 20:07:03 +02:00
Arne Welzel
7fac5837c3 iosource/pcap: Support configurable buffer size
On Linux with a default ext4 or tmpfs filesystem, the default buffer size for
reading a pcap is chosen as 4k (strace/gdb validated). When reading large pcaps
containing raw data transfers, the syscall overhead for read becomes visible
in profiles. Support configurability of the buffer size and default to 128kb.

When processing a ~830M PCAP (16 UDP connections, each transferring ~50MB) in
bare mode, this change improves runtime from 1.39 sec to 1.29 sec. Increasing
the buffer further didn't provide a noticeable boost.
2023-10-10 15:08:51 +02:00
Arne Welzel
51cbdc53f3 NEWS: Polish external plugins message [nomail] [skip ci] 2023-10-09 16:35:11 +02:00
Arne Welzel
2ed89ff84f Bump cmake submodule for 3.15 requirement 2023-10-09 16:23:12 +02:00
Arne Welzel
0630bdbbd5 Merge remote-tracking branch 'origin/topic/awelzel/3314-lambda-redefinition-segfault'
* origin/topic/awelzel/3314-lambda-redefinition-segfault:
  Var/Func: Render function parameters using comma, not semicolon
  Var: Fix null-pointer deref on redefinition of lambdas
2023-10-04 20:16:29 +02:00
Arne Welzel
55475af34c NEWS: Add entry for dot directory changes 2023-09-26 17:46:33 +02:00
Arne Welzel
cca5a8ca5d Merge remote-tracking branch 'origin/topic/awelzel/deferred-default-non-const-v4'
* origin/topic/awelzel/deferred-default-non-const-v4:
  CreationInitsOptimizer: Use PreTypedef() instead of PreType()
  Fix deferred record initialization
  testing/btest: Un-deferred record initalization tests
2023-09-12 20:52:17 +02:00
Arne Welzel
14a2c02f9d Merge remote-tracking branch 'origin/topic/awelzel/1705-http-pending-requests'
* origin/topic/awelzel/1705-http-pending-requests:
  http: Prevent request/response de-synchronization and unbounded state growth
2023-09-01 11:54:10 +02:00
Vern Paxson
e8f4e54475 change Trigger constructor to not potentially auto-delete itself 2023-08-28 10:17:26 -07:00
Arne Welzel
ba04f4c31d IPBasedAnalyzer: Don't flip connections when destination is broadcast
Closes #3235
2023-08-28 12:15:55 +02:00
Arne Welzel
de65671a0a Merge remote-tracking branch 'origin/topic/vern/GH-3191'
* origin/topic/vern/GH-3191:
  BTests for any/vector-of-any fixes
  fixes for vector assignments involving "any"/"vector of any" types
2023-08-25 21:43:03 +02:00
Arne Welzel
9bbc3a55d4 Merge remote-tracking branch 'origin/topic/awelzel/serial-ppp-0x9'
* origin/topic/awelzel/serial-ppp-0x9:
  PPP: Add PPP analyzer to handle LINKTYPE_PPP (0x9)
2023-08-24 13:49:33 +02:00
Johanna Amann
70c76977cf Merge remote-tracking branch 'origin/topic/johanna/gh-3242'
* origin/topic/johanna/gh-3242:
  Community-id: load main script in notice script, fix notice script
2023-08-23 12:46:21 +01:00
Tim Wojtulewicz
e8ef169b27 Merge remote-tracking branch 'origin/topic/timw/3059-set-vector-conversion'
* origin/topic/timw/3059-set-vector-conversion:
  Fix conversion with record types
  Add conversion between set and vector using 'as' keyword
  Add std::move for a couple of variables passed by value
2023-08-11 10:35:06 -07:00
Tim Wojtulewicz
af9e852c28 Add conversion between set and vector using 'as' keyword 2023-08-09 14:41:54 -07:00
Arne Welzel
431767d04b Add &default_insert attribute for tables
This is based on the discussion in zeek/zeek#2668. Using &default with tables
can be confusing as the default value is not inserted. The following example
prints an empty table at the end even new Service records was instantiated.

    type Service: record {
        occurrences: count &default=0;
        last_seen: time &default=network_time();
    };

    global services: table[string] of Service &default=Service();

    event zeek_init()
        {
        services["http"]$occurrences += 1;
        services["http"]$last_seen = network_time();

        print services;
        }

Changing above &default to &default_insert will insert the newly created
default value upon a missed lookup and act less surprising.

Other examples that caused confusion previously revolved around table of sets
 or table of vectors and `add` or `+=` not working as expected.

    tbl_of_vector["http"] += 1
    add tbl_of_set["http"][1];
2023-08-04 12:30:36 +02:00
Tim Wojtulewicz
1f415a7775 Rename magic __bro_plugin__ file to __zeek_plugin__ 2023-08-02 10:10:44 -07:00
Arne Welzel
12a5616f4d Support :: prefix to reference global namespace, deprecate GLOBAL::
Closes #2709
2023-07-11 12:51:21 +02:00
Tim Wojtulewicz
d1ed0e577b Merge remote-tracking branch 'origin/topic/awelzel/3028-connection-flipped'
* origin/topic/awelzel/3028-connection-flipped:
  Update dump-events baseline, not running with OpenSSL 3
  Conn: In-place val flip and connection_flipped()
  Conn: Remove is_version_sep()
  Remove icmp_conn leftovers
2023-07-05 13:32:34 -07:00
Arne Welzel
4cde1c3c3f global_ids(): Include module names
Ad-hoc include module names in the global_ids() table. Table values will
have the type_name field set to "module" and their key in the table is
prefixed with "module " to avoid clashes with existing global identifiers
shadowing module names (Management::Node being an existing example).

Closes #3136
2023-07-05 14:09:20 +02:00
Arne Welzel
a2214ad611 Conn: In-place val flip and connection_flipped()
Avoids loosing state on a connection value when a connection is flipped.

Fixes up the NTP baseline as well where this was visible: analyzer_confirmation_info()
was raised for a connection value which was immediately forgotten due to
the subsequent connection flipping.

Closed #3028
2023-07-04 20:01:17 +02:00