Commit graph

1000 commits

Author SHA1 Message Date
Christian Kreibich
d09584e52e Merge branch 'topic/christian/localversion'
* topic/christian/localversion:
  Parse and store localversion string
  Remove commented-out code
  Check ZEEK_VERSION_LOCAL for dashes
  Update version string btests for localversion
  Modify version parsing for localversion
  Update version used by spicyz
  Update build script
  Support for configurable localversion
2024-04-17 15:00:11 -07:00
Christian Kreibich
af83f1f1a3 Add community contributions for the 6.2 timeframe to NEWS. [skip ci] 2024-03-12 20:19:52 -07:00
Arne Welzel
d728981b77 Merge remote-tracking branch 'origin/topic/awelzel/move-iso-9660-sig-to-policy'
* origin/topic/awelzel/move-iso-9660-sig-to-policy:
  signatures/iso-9660: Add \x01 suffix to CD001
  test-all-policy: Do not load iso-9660.zeek
  signatures: Move ISO 9660 signature to policy
2024-02-26 21:16:48 +01:00
Arne Welzel
e87272f5a7 Merge remote-tracking branch 'origin/topic/awelzel/3490-global-ids-type-name-change'
* origin/topic/awelzel/3490-global-ids-type-name-change:
  global_ids: Align script_id$type_name field with type_name()
2024-02-26 21:15:25 +01:00
Arne Welzel
77d57fccfd Merge remote-tracking branch 'origin/topic/awelzel/find-in-zeekpath'
* origin/topic/awelzel/find-in-zeekpath:
  NEWS: Mention can_load() and find_in_zeekpath()
  utils: Introduce packages.zeek with can_load() helper
  zeek.bif: Add find_in_zeekpath() helper
2024-02-26 21:14:59 +01:00
Arne Welzel
1a5ce65e3d signatures: Move ISO 9660 signature to policy
The previous "fix" caused significant performance degradation without
the signature ever having a chance to trigger. Moving it to policy
seems the best compromise, the alternative being outright removing it.
2024-02-26 13:35:23 +01:00
Arne Welzel
1c2d1b3717 global_ids: Align script_id$type_name field with type_name()
Populate script_id$type_name with what the type_name() bif
would produce for the same identifier.

Closes #3490
2024-02-23 17:26:56 +01:00
Arne Welzel
036bcfe919 Merge remote-tracking branch 'origin/topic/awelzel/ftp-clear-fuid-after-logging'
* origin/topic/awelzel/ftp-clear-fuid-after-logging:
  testing: Update zeek-testing-private commit hash
  ftp: Reset fuid after logging
2024-02-22 12:23:21 +01:00
Arne Welzel
83bbcc1269 NEWS: Mention can_load() and find_in_zeekpath() 2024-02-22 11:41:54 +01:00
Arne Welzel
2f1893bc58 Allow delete statement for tables, sets and vectors
Relates to #3472. This allow "delete tbl" as an alternative for
clear_table(tbl). Also works for vectors.
2024-02-21 18:00:00 +01:00
Tim Wojtulewicz
6d86a48a6a Start of 7.0.0 development 2024-02-20 11:51:06 -07:00
Christian Kreibich
2e66faba76 Some NEWS updates for 6.2 [skip ci] 2024-02-06 17:38:07 -08:00
Johanna Amann
160ccda45f Merge remote-tracking branch 'origin/topic/johanna/netcontrol-updates'
* origin/topic/johanna/netcontrol-updates:
  Netcontrol: add rule_added_policy
  Netcontrol: more logging in catch-and-release
  Netcontrol: allow supplying explicit name to Debug plugin
2024-02-06 11:54:26 +00:00
Arne Welzel
62e0dc94db Intel: Introduce Intel::seen_policy() hook
This introduces a new hook into the Intel::seen() function that allows
users to directly interact with the result of a find() call via external
scripts.

This should solve the use-case brought up by @chrisanag1985 in
discussion #3256: Recording and acting on "no intel match found".

@Canon88 was recently asking on Slack about enabling HTTP logging for a
given connection only when an Intel match occurred and found that the
Intel::match() event would only occur on the manager. The
Intel::match_remote() event might be a workaround, but possibly running a
bit too late and also it's just an internal "detail" event that might not
be stable.

Another internal use case revolved around enabling packet recording
based on Intel matches which necessarily needs to happen on the worker
where the match happened. The proposed workaround is similar to the above
using Intel::match_remote().

This hook also provides an opportunity to rate-limit heavy hitter intel
items locally on the worker nodes, or even replacing the event approach
currently used with a customized approach.
2024-01-25 12:22:47 +01:00
Arne Welzel
822ca99e80 Merge remote-tracking branch 'origin/topic/awelzel/3424-http-upgrade-websocket-v1'
* origin/topic/awelzel/3424-http-upgrade-websocket-v1:
  websocket: Handle breaking from WebSocket::configure_analyzer()
  websocket: Address review feedback for BinPac code
  fuzzers: Add WebSocket fuzzer
  websocket: Fix crash for fragmented messages
  websocket: Verify Sec-WebSocket-Key/Accept headers and review feedback
  btest/websocket: Test for coalesced reply-ping
  HTTP/CONNECT: Also weird on extra data in reply
  HTTP/Upgrade: Weird when more data is available
  ContentLine: Add GetDeliverStreamRemainingLength() accessor
  HTTP: Drain event queue after instantiating upgrade analyzer
  btest/http: Explain switching-protocols test change as comment
  WebSocket: Introduce new analyzer and log
  HTTP: Add mechanism to instantiate Upgrade analyzer
2024-01-23 18:17:50 +01:00
Tim Wojtulewicz
2aaaab4dad Make BIFs just return ValPtr directly instead of BifReturnVal 2024-01-22 10:35:34 -07:00
Tim Wojtulewicz
5602546f2e Merge remote-tracking branch 'origin/topic/timw/stop-supporting-bro-topics'
* origin/topic/timw/stop-supporting-bro-topics:
  Drop support for subscribing to bro/ topics
2024-01-22 10:01:23 -07:00
Arne Welzel
2a858d252e MIME: Cap nested MIME analysis depth to 100
OSS-Fuzz managed to produce a MIME multipart message construction with
thousands of nested entities (or that's what Zeek makes out of it anyhow).
Prevent such deep analysis by capping at a nesting depth of 100,
preventing unnecessary resource usage. A new weird named exceeded_mime_max_depth
is reported when this limit is reached.

This change reduces the runtime of the OSS-Fuzz reproducer from ~45 seconds
to ~2.5 seconds.

The test PCAP was produced from a Python script using the email package
and sending the rendered version via POST to a HTTP server.

Closes #208
2024-01-17 10:18:13 -07:00
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