Commit graph

15268 commits

Author SHA1 Message Date
Arne Welzel
6941e44aba packet_analysis/TCP: Do not use untrusted len for DeliverPacket()
We should not be passing the untrusted TCP header length into
DeliverPacket(). Also, DeliverPacket() cap len parameter should
be the capture length of the packet, not remaining data.
2023-05-24 16:41:52 +02:00
Arne Welzel
a41dfb28d5 Add regression test using pcap from GH-2683 2023-05-24 16:34:25 +02:00
Tim Wojtulewicz
d9718342ac Add btest to test Geneve->VXLAN->Truncated inner packet 2023-05-24 16:34:25 +02:00
Arne Welzel
568946ec18 IP: Update packet->len with accumulated fragment size
With packet->len representing the wire length and other places
relying on it, ensure it's updated for fragments as well. This
assumes non-truncated fragments right now. Otherwise we'd need
to teach the FragmentReassembler to somehow track this independently
but it would be a mess.
2023-05-24 16:34:22 +02:00
Arne Welzel
2b9de839b0 UDP: Forward any remaining data (also empty) to session-analysis
The protocol analyzers are prepared to receive truncated data and
this way we give analyzers a chance to look at data. We previously
allowed empty data being passed: When len ended up 0 and remaining
was 0 too.
2023-05-24 16:31:11 +02:00
Arne Welzel
5654f81dee IPTunnel: Compute inner wire length based on cap_len differences. 2023-05-24 16:31:08 +02:00
Tim Wojtulewicz
18a30a7a53 IP: fix weird name to not be ipv6 specific 2023-05-24 16:29:29 +02:00
Tim Wojtulewicz
47ff5a4f61 UDP: don't validate checksum if caplen < len
This may happen with truncated packets and will cause asan builds to bail out
before the packet can be forwarded along. The TCP analyzer already has this
check, but it's missing for UDP.
2023-05-24 16:01:08 +02:00
Tim Wojtulewicz
b8313c2487 PIA: Modernize how struct initialization is done 2023-05-24 16:01:08 +02:00
Arne Welzel
3efb27c963 Add NEWS entry about negative vector index 2023-05-24 10:51:37 +02:00
Arne Welzel
8967e347df Merge remote-tracking branch 'origin/topic/awelzel/telemetry-net-lag'
* origin/topic/awelzel/telemetry-net-lag:
  stats: Add zeek-net-packet-lag-seconds metric
2023-05-24 09:58:00 +02:00
Arne Welzel
25947f3854 Merge remote-tracking branch 'origin/topic/timw/3060-negative-vector-indices'
* origin/topic/timw/3060-negative-vector-indices:
  GH-3060: Support negative index lookups for vectors
2023-05-24 09:40:05 +02:00
Arne Welzel
f396c2b16e stats: Add zeek-net-packet-lag-seconds metric
While writing documentation about troubleshooting and looking a bit
at the older stats.log, realized we don't have the packet lag metric
exposed as metric/telemetry. Add it.

This is a Zeek instance lagging behind in network time ~6second because
it's very overloaded:

    zeek_net_packet_lag_seconds{endpoint=""} 6.169406 1684848998092
2023-05-24 09:12:01 +02:00
Tim Wojtulewicz
351e68b66a GH-3060: Support negative index lookups for vectors 2023-05-23 13:48:58 -07:00
Tim Wojtulewicz
cdb9c74054 Merge remote-tracking branch 'origin/topic/timw/update-broker'
* origin/topic/timw/update-broker:
  Update broker submodule [nomail]
2023-05-23 12:15:14 -07:00
Tim Wojtulewicz
ee79a88265 Update broker submodule [nomail] 2023-05-23 11:41:15 -07:00
Tim Wojtulewicz
a9f8bd5166 Update binpac and bifcl to released versions [nomail] 2023-05-23 11:00:53 -07:00
Tim Wojtulewicz
cf996a66e6 Updating submodule(s) [nomail] 2023-05-23 10:52:57 -07:00
Arne Welzel
f6fb0aca87 Merge remote-tracking branch 'origin/topic/awelzel/ci-tumbleweed-disable-openh264-repo'
* origin/topic/awelzel/ci-tumbleweed-disable-openh264-repo:
  ci: Disable openh264 repository on tumbleweed
2023-05-23 19:32:32 +02:00
Arne Welzel
9f5ef553d5 ci: Disable openh264 repository on tumbleweed
zypper refresh failed on it and we should not be needing packages
either.
2023-05-23 18:39:57 +02:00
Arne Welzel
af00ffec24 Merge remote-tracking branch 'origin/topic/robin/cmake-spicy-link-fix'
* origin/topic/robin/cmake-spicy-link-fix:
  Bump cmake to fix build of multiple Spicy analyzers in a package.
2023-05-23 17:35:48 +02:00
Arne Welzel
b2c22f0dcf Merge remote-tracking branch 'origin/topic/bbannier/issue-3071'
* origin/topic/bbannier/issue-3071:
  Fix crashing when disable_analyzer() called on root analyzers
2023-05-23 15:45:48 +02:00
Arne Welzel
e9cd849843 Fix crashing when disable_analyzer() called on root analyzers
Closes #3071.
2023-05-23 15:44:14 +02:00
Robin Sommer
1859a34726
Bump cmake to fix build of multiple Spicy analyzers in a package. 2023-05-23 12:05:31 +02:00
Tim Wojtulewicz
614f1a9e5f Merge remote-tracking branch 'origin/topic/timw/further-cmake-fixes'
* origin/topic/timw/further-cmake-fixes:
  Revert part of previous CMake debug type fix
2023-05-22 16:39:07 -07:00
Tim Wojtulewicz
120ea779cb Merge remote-tracking branch 'origin/topic/awelzel/3053-fix-raw-reread-mode'
* origin/topic/awelzel/3053-fix-raw-reread-mode:
  btest/input/raw: Fix reread test
  input/Raw: Avoid reading file twice in MODE_REREAD
2023-05-22 16:34:17 -07:00
Tim Wojtulewicz
ef2473564e Revert part of previous CMake debug type fix 2023-05-22 16:11:58 -07:00
Arne Welzel
09b956562e btest/input/raw: Fix reread test
This seems to have relied on the reading file twice behavior simply
testing that 16 lines are observed. Switch to using two separate
files and doing a system("mv ...") to trigger the REREAD logic, there's
not force_update() needed and it wouldn't do anything if the file
hadn't changed anyway.
2023-05-22 11:06:54 +02:00
Arne Welzel
d8b5bdf758 input/Raw: Avoid reading file twice in MODE_REREAD
Found while writing documentation and being confused why
all lines and end_of_data() arrive twice during startup.

The test is a bit fuzzy, but does fail reliably without
the changes to Raw.cc

Also fix not checking dev in the MODE_REREAD path.

Closes #3053
2023-05-22 11:06:25 +02:00
Arne Welzel
3b28f59c3b Merge remote-tracking branch 'origin/topic/christian/gh-3061-fix-cmake-build-type-lower'
* origin/topic/christian/gh-3061-fix-cmake-build-type-lower:
  Fix CMAKE_BUILD_TYPE_LOWER definition-vs-use ordering problem
2023-05-22 10:14:52 +02:00
zeek-bot
2e586b506d Update doc submodule [nomail] [skip ci] 2023-05-20 00:33:41 +00:00
Christian Kreibich
3a55cf3911 Fix CMAKE_BUILD_TYPE_LOWER definition-vs-use ordering problem
It needs to be defined by the time we create zeek-config, which happens before
its current definition. To avoid a redundant TOLOWER when we check for presence
of --enable-debug at the beginning, this also switches this to a case-unadjusted
comparison to "Debug", which we use elsewhere in the file too.
2023-05-19 17:08:10 -07:00
Vern Paxson
890010915a change base scripts to use run-time if's or @if ... &analyze 2023-05-19 13:26:27 -07:00
Vern Paxson
e749638380 a number of BTests updated with @if ... &analyze 2023-05-19 13:13:26 -07:00
Vern Paxson
8e375d34b7 update for scripting coverage BTest demonstrating utility of @if ... &analyze 2023-05-19 13:04:03 -07:00
Vern Paxson
be87f9f6ec BTests for new @if ... &analyze functionality 2023-05-19 13:02:37 -07:00
Vern Paxson
9f4da24644 "if ( ... ) &analyze" language feature 2023-05-19 12:46:01 -07:00
Vern Paxson
052cda9df0 classes for tracking "@if (...) &analyze" notion of code being/not being "activated" 2023-05-19 12:43:12 -07:00
Vern Paxson
9aff0287f0 RemoveGlobal() method for Scope class + simplifying interfaces 2023-05-19 12:41:32 -07:00
Tim Wojtulewicz
222f604452 Merge remote-tracking branch 'origin/topic/neverlord/allow-find-zeek-in-plugins'
* origin/topic/neverlord/allow-find-zeek-in-plugins:
  Allow plugins to call find_package(Zeek)
2023-05-19 10:51:45 -07:00
Tim Wojtulewicz
3757a350cd Updating submodule(s) [nomail] 2023-05-19 09:50:22 -07:00
Arne Welzel
d4c99e7c3f files: Warn once for missing get_file_handle()
Repeating the message for every new call to get_file_handle() is not
very useful. It's pretty much an analyzer configuration issue so logging
it once should be enough.
2023-05-19 09:37:51 -07:00
Arne Welzel
9bda48d17c MIME: Re-use cur_entity_id for EndOfFile()
If DataIn() was called and a cur_entity_id (file_id) has been produced
previously, re-use it for calls to EndOfFile(). This avoids a costly
event_mgr.Drain() when we already have that information. It should be safer,
too, as `get_file_handle()` in script may generate a different ID and
thereby de-synchronizing.
2023-05-19 09:37:35 -07:00
Arne Welzel
3cceb7d1c0 zeek-fuzzer-setup: Configure fake DNS
I'm not sure if we somehow set this for oss-fuzz through the environment,
but didn't find anything obvious.

Running oss-fuzz reproducers locally can triggers lookups to malware.hash.cymru.com
and potentially other domains due to loading local.zeek.
2023-05-19 09:37:29 -07:00
Arne Welzel
bbcdb6494e SupportAnalyzer: Stop delivering to disabled parent analyzer
When the parent of a support analyzer has been disabled, short-circuit
delivering stream or packet data to it.

The specific scenario this avoids is the Content-Line analyzer continuing
to feed data lines into an disabled SMTP analyzer in turn creating more
events.

This is primarily useful for our fuzzing setup where data chunks up to 1MB
are generated and fed into the analyzer pipeline. In the real-world, chunk
sizes are usually bounded to packet size. Certain TCP reassembly constellations
may trigger these scenarios, however.

Closes #168
2023-05-19 09:37:23 -07:00
Tim Wojtulewicz
fc78b14cd7 Add length checking to ToRawPktHdrVal for truncated packets 2023-05-19 09:37:18 -07:00
Arne Welzel
64f84aba34 ftp: No unbounded directory command re-use
OSS-Fuzz generated traffic containing a CWD command with a single very large
path argument (427kb) starting with ".___/` \x00\x00...", This is followed
by a large number of ftp replies with code 250. The directory logic in
ftp_reply() would match every incoming reply with the one pending CWD command,
triggering path buildup ending with something 120MB in size.

Protect from re-using a directory command by setting a flag in the
CmdArg record when it was consumed for the path traversal logic.

This doesn't prevent unbounded path build-up generally, but does prevent the
amplification of a single large command with very many small ftp_replies.
Re-using a pending path command seems like a bug as well.
2023-05-19 09:37:12 -07:00
Tim Wojtulewicz
d4eb71ab8f Merge remote-tracking branch 'origin/topic/robin/spicy-search-path-fix'
* origin/topic/robin/spicy-search-path-fix:
  Fix CMake ordering issue leaving configuration paths unset.
2023-05-18 08:54:56 -07:00
Robin Sommer
933bd017f1
Fix CMake ordering issue leaving configuration paths unset. 2023-05-18 10:38:29 +02:00
zeek-bot
0c995c5f70 Update doc submodule [nomail] [skip ci] 2023-05-18 00:43:02 +00:00