Commit graph

4477 commits

Author SHA1 Message Date
Arne Welzel
75ef9ac233 Merge branch 'fix-http-password-capture' of https://github.com/p-l-/zeek
* 'fix-http-password-capture' of https://github.com/p-l-/zeek:
  http: fix password capture when enabled

(cherry picked from commit c27e18631c)
2024-08-30 14:45:25 -07:00
Arne Welzel
c55a57a449 btest: Fixup baseline for plugins.hooks 2024-07-24 10:15:13 +02:00
Tim Wojtulewicz
d1e9cfe8e4 Update baseline for plugins.hooks btest 2024-05-15 10:49:26 -07:00
Christian Kreibich
1f04e5d545 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

(cherry picked from commit d09584e52e)
2024-05-14 16:09:58 -07:00
Tim Wojtulewicz
848b597416 Merge remote-tracking branch 'pbcullen/topic/pbcullen/remove_exclude'
* pbcullen/topic/pbcullen/remove_exclude:
  Update core.pcap.filter-warning baseline
  Add PacketFilter::remove_exclude function

(cherry picked from commit d566961da5)
2024-05-14 14:52:34 -07:00
Tim Wojtulewicz
10fd5682e1 Merge remote-tracking branch 'origin/topic/johanna/update-tls-ca-stuff'
* origin/topic/johanna/update-tls-ca-stuff:
  Update Mozilla CA and Google CT list and related tests.

(cherry picked from commit c315202ece)
2024-05-14 14:38:31 -07:00
Tim Wojtulewicz
8932781b0c Bump commit hash for zeek-testing-cluster 2024-05-14 13:49:31 -07:00
Jan Grashoefer
a69a584d25 Make worker restart in cluster btest race-proof
(cherry picked from commit 08daef8d42)
2024-05-14 10:52:28 -07:00
Arne Welzel
5659cf18f8 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

(cherry picked from commit 4e5849fe82c6097df5d25cd1a74d69ab4fa50f46)
2024-01-19 08:22:19 -07:00
Benjamin Bannier
b169f56098 Fix tests so they work both with GNU and BSD tools
The GNU and BSD versions of `touch` and `truncate` allow slightly
different arguments, change the tests so they work in both versions.

(cherry picked from commit caaffd0324)
2024-01-18 14:09:51 -08:00
Arne Welzel
ce0410f283 OCSP: Open-code unknown revoke reason strings
OpenSSL 3.2.0 knows about more reasons. Add some backwards compatibility.

Reference: 1c8a7f5091
(cherry picked from commit 02d00a1984)
2024-01-12 14:40:52 -07:00
Tim Wojtulewicz
ed40e2e0f9 Revert update to scripts.base.protocols.ssl.ocsp-revoked btest baseline 2024-01-12 13:52:41 -07:00
Arne Welzel
af5b6b8c13 Merge remote-tracking branch 'origin/topic/awelzel/3523-expiration-iteration-at-termination'
* origin/topic/awelzel/3523-expiration-iteration-at-termination:
  Dict: Invalidate iterators during Clear()

(cherry picked from commit f1e94594f9)
2024-01-12 12:14:45 -07:00
Arne Welzel
a2af53cbf9 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

(cherry picked from commit a5a79d3f3a)
2024-01-12 11:34:51 -07:00
Johanna Amann
2b5ac7ce19 Merge remote-tracking branch 'origin/topic/johanna/its-time-to-add-more-tls-extension-types'
* origin/topic/johanna/its-time-to-add-more-tls-extension-types:
  SSL: Add new extension types and ECH test

(cherry picked from commit 3257c0e216)
2024-01-12 11:34:51 -07:00
Arne Welzel
8ff101273f Merge branch 'topic/xb-anssi/http_signature_body_end_match' of https://github.com/xb-anssi/zeek
* 'topic/xb-anssi/http_signature_body_end_match' of https://github.com/xb-anssi/zeek:
  Let signature framework match HTTP body end
  Test how the signature framework matches HTTP body

(cherry picked from commit 8a13155a41)
2024-01-12 11:19:58 -07:00
Arne Welzel
b745556d36 ftp: Do not base seq on number of pending commands
Previously, seq was computed as the result of |pending_commands|+1. This
opened the possibility to override queued commands, as well as logging
the same pending ftp reply multiple times.

For example, when commands 1, 2, 3 are pending, command 1 may be dequeued,
but the incoming command then receives seq 3 and overrides the already
pending command 3. The second scenario happens when ftp_reply() selected
command 3 as pending for logging, but is then followed by many ftp_request()
events. This resulted in command 3's response being logged for every
following ftp_request() over and over again.

Avoid both scenarios by tracking the command sequence as an absolute counter.
2023-10-25 10:05:09 -07:00
Arne Welzel
f6615753f1 ssl: Prevent unbounded ssl_history growth
The previous fix also made it clear that the ssl_history field may grow
unbounded via the ssl_alert event. Prevent by capping using a configurable
limit (default 100) and raise a weird once reached.
2023-10-25 10:05:09 -07:00
Arne Welzel
65f8222b92 Merge remote-tracking branch 'origin/topic/awelzel/mmdb-fix-and-tests'
* origin/topic/awelzel/mmdb-fix-and-tests:
  base/frameworks/spicy: Do not load base/misc/version
  btest/core/mmdb: Basic lookup_autonomous_system / lookup_location tests
  btest/files: Add mmdb testing databases and generator code
  zeek.bif: Switch mmdb stale check to network_time
  Fix mmdb pointer destruction

(cherry picked from commit 44b67894ac)
2023-10-24 13:49:25 -07:00
Arne Welzel
651b208937 Merge remote-tracking branch 'origin/topic/bbannier/issue-3279'
* origin/topic/bbannier/issue-3279:
  Fix handling of module scope when checking exported Spicy types for collisions

(cherry picked from commit 30dc6af831)
2023-10-16 13:15:40 -07:00
Tim Wojtulewicz
f0bf803dd2 Update dump_events test baseline after fseek changes 2023-09-12 09:41:10 -07:00
Johanna Amann
3c3a3c92ea Add extract_limit_includes_missing option for file extraction
Setting this option to false does not count missing bytes in files towards the
extraction limits, and allows to extract data up to the desired limit,
even when partial files are written.

When missing bytes are encountered, files are now written as sparse
files.

Using this option requires the underlying storage and utilities to support
sparse files.

(cherry picked from commit afa6f3a0d3b8db1ec5b5e82d26225504c2891089)
2023-09-12 09:41:03 -07:00
Arne Welzel
a96bcef839 ftp: Do not log non-pending commands
OSS Fuzz generated a CWD request and reply followed by very many EPRT
requests. This caused Zeek to re-log the CWD request and invoke `build_url_ftp()`
over and over again resulting in long processing times.

Avoid this scenario by not logging commands that aren't pending anymore.

(cherry picked from commit b05dd31667ff634ec7d017f09d122f05878fdf65)
2023-09-12 09:40:51 -07:00
Arne Welzel
fe9c7d4191 Merge remote-tracking branch 'origin/topic/jazoff/gh-3268t '
* origin/topic/jazoff/gh-3268:
  Fix check for emailed notices

Changes: Added a test-case printing email_delay_tokens to compare email vs
non-email notice types. Previously, both notice types would have email
delay tokens at that point in the flow.

(cherry picked from commit 7e11501d3c)
2023-09-08 11:09:56 -07:00
Arne Welzel
c413c6d71a Merge remote-tracking branch 'origin/topic/awelzel/3278-spicy-fix-port-range-off-by-one'
* origin/topic/awelzel/3278-spicy-fix-port-range-off-by-one:
  spicy: Do not register port N+1 for port N in .evt file

(cherry picked from commit 6e6a2bee8a)
2023-09-07 18:13:48 -07:00
Johanna Amann
ab2b241c3f 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

(cherry picked from commit 70c76977cf)
2023-08-23 10:16:45 -07:00
Tim Wojtulewicz
c7cfeeb572 Update scripts.policy.misc.dump-events baseline for connection flipping PR 2023-08-16 11:05:34 -07:00
Arne Welzel
bde9c7070e 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

(cherry picked from commit a2214ad611)
2023-08-16 09:57:33 -07:00
Johanna Amann
483f7a0322 Merge remote-tracking branch 'origin/topic/johanna/tcp-padding'
* origin/topic/johanna/tcp-padding:
  Do not forward padding to downstream TCP packet analyzer

(cherry picked from commit 81ce83590d)
2023-08-08 13:36:16 -07:00
Tim Wojtulewicz
a99231d956 Merge remote-tracking branch 'origin/topic/johanna/3205-do-not-parse-udp-padding'
* origin/topic/johanna/3205-do-not-parse-udp-padding:
  Do not forward more than the remaining data to downstream UDP analyzer

(cherry picked from commit 3c7a52d0a7)
2023-08-08 13:22:18 -07:00
Tim Wojtulewicz
5811e58139 Merge remote-tracking branch 'origin/topic/awelzel/3145-dcerpc-state-clean'
* origin/topic/awelzel/3145-dcerpc-state-clean:
  dce-rpc: Test cases for unbounded state growth
  dce-rpc: Handle smb2_close_request() in scripts
  smb/dce-rpc: Cleanup DCE-RPC analyzers when fid is closed and limit them
  dce-rpc: Do not repeatedly register removal hooks

(cherry picked from commit f9904511ab)
2023-08-08 12:55:21 -07:00
Robin Sommer
ddaa553418 Merge remote-tracking branch 'origin/topic/robin/gh-3157-export-switch'
* origin/topic/robin/gh-3157-export-switch:
  [Spicy] Support `switch` fields when exporting Spicy types to Zeek.

(cherry picked from commit cd2c193cb2)
2023-08-08 12:54:21 -07:00
Arne Welzel
4ae02b7973 Merge branch 'master' of https://github.com/progmboy/zeek
* 'master' of https://github.com/progmboy/zeek:
  fix http AUTHORIZATION base64 decode failed

Added a test during merge.

(cherry picked from commit b18122da08)
2023-08-08 12:51:51 -07:00
Tim Wojtulewicz
36fb655caa Merge remote-tracking branch 'origin/topic/awelzel/no-metrics-centralization'
* origin/topic/awelzel/no-metrics-centralization:
  telemetry: Disable metrics centralization by default

(cherry picked from commit 0fbfaeb996)
2023-06-21 15:42:10 -07:00
Tim Wojtulewicz
965d1de3f6 Merge remote-tracking branch 'origin/topic/awelzel/3112-log-suffix-left-over-log-rotation-fixup'
* origin/topic/awelzel/3112-log-suffix-left-over-log-rotation-fixup:
  tests: Do not use archiver_rotation_format_func as postprocessor

(cherry picked from commit 9e2e6d0174)
2023-06-15 15:56:24 -07:00
Arne Welzel
7e2d9aa7be Merge branch 'topic/awelzel/3112-log-suffix-left-over-log-rotation'
* topic/awelzel/3112-log-suffix-left-over-log-rotation:
  cluster/logger: Fix leftover-log-rotation in multi-logger setups
  cluster/logger: Fix global var reference

(cherry picked from commit f53aefdd5b)
2023-06-15 15:21:02 -07:00
Tim Wojtulewicz
d2b534e6b2 Merge remote-tracking branch 'origin/topic/awelzel/cluster-at-if-removal'
* origin/topic/awelzel/cluster-at-if-removal:
  test-all-policy: Do not load nodes-experimental/manager.zeek
  cluster/main: Remove extra @if ( Cluster::is_enabled() )

(cherry picked from commit 98e44ee14f)
2023-06-12 11:23:01 -07:00
Tim Wojtulewicz
b34e70e6cd Merge remote-tracking branch 'origin/topic/awelzel/3099-fix-and-extend-socks5-sig'
* origin/topic/awelzel/3099-fix-and-extend-socks5-sig:
  socks/dpd: Add newer auth methods
  socks/dpd: Fix socks5_server side signature

(cherry picked from commit c389d9804b)
2023-06-12 11:01:14 -07:00
Tim Wojtulewicz
7ebcbcd174 Update baseline for coverage.test-all-policy-cluster test 2023-05-31 00:40:30 -07:00
Arne Welzel
aceb023301 Add test-all-policy-cluster
After the introduction of @if ... analyze, a lot of warnings were
triggered due to nested @if and @if .. analyze usage.

Add a test for coverage of all policy scripts in cluster mode
for the usual node types so this does not happen again.
2023-05-31 00:37:30 -07:00
Tim Wojtulewicz
5a3abbe364 Revert "Merge remote-tracking branch 'origin/topic/vern/at-if-analyze'"
This reverts commit 4e797ddbbc, reversing
changes made to 3ac28ba5a2.
2023-05-31 09:20:33 +02:00
Robin Sommer
cfbb7eb8ee
Merge remote-tracking branch 'origin/topic/robin/gh-3083-export-fix'
* origin/topic/robin/gh-3083-export-fix:
  Register test analyzer only for required ports.
  Fix disappearing unit fields in Spicy type export.
2023-05-30 14:59:00 +02:00
Benjamin Bannier
0b100c1e1c Register test analyzer only for required ports.
This is a workaround for #3094.
2023-05-28 17:36:06 +02:00
Tim Wojtulewicz
4e797ddbbc Merge remote-tracking branch 'origin/topic/vern/at-if-analyze'
* origin/topic/vern/at-if-analyze:
  updates reflecting review comments
  change base scripts to use run-time if's or @if ... &analyze
  a number of BTests updated with @if ... &analyze
  update for scripting coverage BTest demonstrating utility of @if ... &analyze
  BTests for new @if ... &analyze functionality
  "if ( ... ) &analyze" language feature
  classes for tracking "@if (...) &analyze" notion of code being/not being "activated"
  RemoveGlobal() method for Scope class + simplifying interfaces
2023-05-26 14:56:01 -07:00
Robin Sommer
fd86d8530b
Fix disappearing unit fields in Spicy type export.
When a Spicy unit type was used in an EVT event definition, it could
end up being cleared out at the time the logic for `export` got to see it.

Closes #3083.

Note: This needs backporting to the legacy plugin.
2023-05-26 11:37:23 +02:00
Arne Welzel
c61f0d776f Bump cluster testsuite to latest main 2023-05-26 10:02:46 +02:00
Vern Paxson
e441ba394a updates reflecting review comments 2023-05-25 18:00:13 -07:00
Arne Welzel
3f3df93ac1 Merge remote-tracking branch 'origin/topic/timw/2914-truncated-tunnel-plus-things'
* origin/topic/timw/2914-truncated-tunnel-plus-things:
  Address wire/capture length feedback
  packet_analysis/TCP: Do not use untrusted len for DeliverPacket()
  Add regression test using pcap from GH-2683
  Add btest to test Geneve->VXLAN->Truncated inner packet
  IP: Update packet->len with accumulated fragment size
  UDP: Forward any remaining data (also empty) to session-analysis
  IPTunnel: Compute inner wire length based on cap_len differences.
  IP: fix weird name to not be ipv6 specific
  UDP: don't validate checksum if caplen < len
  PIA: Modernize how struct initialization is done
2023-05-25 20:19:20 +02:00
Tim Wojtulewicz
2bf0ebae32 Merge remote-tracking branch 'origin/topic/awelzel/auto-hilti-cxx-compiler-launcher-in-btest'
* origin/topic/awelzel/auto-hilti-cxx-compiler-launcher-in-btest:
  btest.cfg: Set HILTI_CXX_COMPILER_LAUNCHER based on build/CMakeCache.txt
2023-05-25 09:03:49 -07:00
Benjamin Bannier
8049d3a002 Speed up Spicy-related tests.
This patch changes invocations of `spicyz` and similar Spicy tools in
tests which perform compilation to use debug mode via passing `-d`. This
in turn leads to Spicy compiling generated C++ code in debug as opposed
to release mode which typically seems to require less CPU time and RAM.
For a local test running with `btest -j 16` and no caching via
`HILTI_CXX_COMPILER_LAUNCER` this sped up running of BTests under
`spicy/` by about 40s on my machine (120s vs 160s).
2023-05-25 14:59:10 +02:00