Commit graph

17145 commits

Author SHA1 Message Date
Vern Paxson
286c4dc776 ZAM fix for inlining empty function bodies as the sole elements of an if-else 2024-11-04 15:45:27 -08:00
Arne Welzel
a3a0155825 Merge remote-tracking branch 'origin/topic/awelzel/sqli-test-followup'
* origin/topic/awelzel/sqli-test-followup:
  btest: Add detect-sqli test script
2024-11-04 19:35:34 +01:00
Arne Welzel
c171d9e8c2 Merge remote-tracking branch 'origin/topic/vern/canonicalize-std-string'
* origin/topic/vern/canonicalize-std-string:
  switched CPPCompile::Canonicalize() to take std::string instead of const char*
2024-11-04 18:47:18 +01:00
Arne Welzel
b69222d5f6 btest: Add detect-sqli test script
...I added the baselines during the merge, just not the test itself.
2024-11-04 18:42:55 +01:00
Vern Paxson
519fec2592 switched CPPCompile::Canonicalize() to take std::string instead of const char* 2024-11-04 08:22:37 -08:00
Arne Welzel
8935dc9ed4 Merge remote-tracking branch 'origin/topic/vern/script-opt-fnv1a64'
* origin/topic/vern/script-opt-fnv1a64:
  minor ZAM BTest updates for recently added fnv1a64 BiF
2024-11-04 16:33:21 +01:00
Arne Welzel
db497d1da7 Merge remote-tracking branch 'origin/topic/awelzel/pattern-matches-rework'
* origin/topic/awelzel/pattern-matches-rework:
  RuleMatcher: Use a single list for tracking pattern_matches
  ZeekString: Implement move constructor
2024-11-04 16:32:48 +01:00
Arne Welzel
e443624c32 RuleMatcher: Use a single list for tracking pattern_matches 2024-11-04 16:17:49 +01:00
Arne Welzel
0ecbd4435e ZeekString: Implement move constructor 2024-11-04 16:17:47 +01:00
Benjamin Bannier
8fc5b7fcda Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy-format' 2024-11-04 09:43:28 +01:00
Benjamin Bannier
b829b2165e Bump and reenable spicy-format pre-commit hook 2024-11-04 07:25:44 +01:00
Vern Paxson
d5c820d2c5 minor ZAM BTest updates for recently added fnv1a64 BiF 2024-11-03 14:05:19 -08:00
Johanna Amann
84d8e74884 Merge remote-tracking branch 'origin/topic/johanna/snap-tcp-test'
* origin/topic/johanna/snap-tcp-test:
  Add test for TCP over 802.3/SNAP
2024-10-31 16:17:31 +00:00
Johanna Amann
807bb142a7 Add test for TCP over 802.3/SNAP
This admittedly is a quite esoteric combination of protocols. But - as
we do correctly support them, it seems nice to have a slightly more
complete testcase that covers this.
2024-10-31 14:37:44 +00:00
zeek-bot
56514d98d6 Update doc submodule [nomail] [skip ci] 2024-10-31 00:14:49 +00:00
Arne Welzel
7b3bc891f4 Merge remote-tracking branch 'origin/topic/etyp/ubuntu-clang-ci'
Modified ubuntu24_clang_libcpp_task to be skipped on PRs.

* origin/topic/etyp/ubuntu-clang-ci:
  CI: Upgrade FreeBSD 14 to 14.1
  CI: Add Ubuntu Clang task
  Fix up minor warnings in touched files
  Fix Clang 19 deprecation failure
2024-10-30 14:54:08 +01:00
Arne Welzel
9fa4d6f5ed pre-commit-config: Disable spicy-format
This fails to install currently: bbannier/spicy-format#157
2024-10-30 14:43:42 +01:00
Arne Welzel
fd0181c2cb Merge branch 'modbus-fc-fixes' of https://github.com/zambo99/zeek
* 'modbus-fc-fixes' of https://github.com/zambo99/zeek:
  Fix issues with Modbus message logging
2024-10-30 14:38:53 +01:00
Arne Welzel
00a0f9c920 Merge remote-tracking branch 'origin/topic/awelzel/data-end-offset-v1'
* origin/topic/awelzel/data-end-offset-v1:
  signatures: Add data_end_offset to signature_match() and custom events
  Add pattern_end_offset to signature_state
2024-10-30 14:34:08 +01:00
Evan Typanski
8b64d12167 CI: Upgrade FreeBSD 14 to 14.1 2024-10-30 09:04:24 -04:00
Evan Typanski
04c3c2ec72 CI: Add Ubuntu Clang task
This feels more like a band-aid solution - it still requires very manual
intervention to get the next builds, but at least this way we don't rely
on whatever Clang/libc++ happens to ship with FreeBSD for the only
libc++ testing. It seems like sanitizer builds don't use libc++, but I'd
rather a dedicated Linux/Clang/libc++ task at least.
2024-10-30 09:04:24 -04:00
Evan Typanski
36af0591a6 Fix up minor warnings in touched files 2024-10-30 08:47:57 -04:00
Evan Typanski
985f4f7c72 Fix Clang 19 deprecation failure
Fixes #3994

Clang 19 with libc++ started failing to compile because the default
implementation of `std::char_traits` was removed, making uses of
`std::char_traits<unsigned char>` invalid. This was more of used for
convenience before, but it should be roughly the same behavior with
`char`.

See relevant LLVM commits:

aeecef08c3

08a0faf4cd
2024-10-30 08:47:15 -04:00
Arne Welzel
04872d4e78 signatures: Add data_end_offset to signature_match() and custom events
This change tracks the current offset (number of bytes fed into matchers)
on the top-level RuleEndpointState such that we can compute the relative ending
for matched texts individually.

Additionally, it adds the data_end_offset as a new optional parameter to
signature_match().
2024-10-30 13:29:58 +01:00
Emmanuele Zambon
792aacc8e5 Fix issues with Modbus message logging
This commit fixes three issues with Zeek's Modbus message logging:

1 - Some exception responses (e.g., READ_COILS_EXCEPTION) are logged
    twice: once without and once with the exception message.
2 - Some exception responses (e.g., PROGRAM_484_EXCEPTION) are not
    logged.
3 - Some known but reserved function codes (e.g., PROGRAM_UNITY) are
    logged as unk-xxx (e.g., unk-90), while it would be possible to
    log their known name.

To address these inconsistencies, the modbus parser has been updated
to parse all exception responses (i.e., all responses where the MSB
of the function code is set) using the already defined Exception
message.
Also, the Modbus main.zeek script has been updated to consistently
demand logging exception responses to the specialized
modbus_exception event, rather than logging some exception responses
in the modbus_message event and others in the modbus_exception event.
Finally, the main.zeek script has been updated to make sure that
for every known function code, the corresponding exception code was
also present, and the enumeration of known function codes in
consts.zeek has been expanded.

Closes #3984
2024-10-30 13:12:27 +01:00
Johanna Amann
681fd37a6d Merge remote-tracking branch 'origin/topic/awelzel/skip-modbus-when-spicy-ssl-enabled'
* origin/topic/awelzel/skip-modbus-when-spicy-ssl-enabled:
  modbus: Skip non-modbus traffic testing with Spicy SSL
  testing: Add have-spicy-ssl helper and update tests
2024-10-30 11:48:15 +00:00
Johanna Amann
eb74790d90 Merge branch 'improvement/fnv1a_hashing_algorithm_improvements' of https://github.com/martinvanhensbergen/zeek
Fixes indentation.

Fixes GH-3970
2024-10-30 11:46:26 +00:00
ronny8360988
5859e23198 Add pattern_end_offset to signature_state
Add pattern_end_offset to signature_state

Update init-bare.zeek

Update RuleMatcher.cc

Update RuleMatcher.h

Update init-bare.zeek

clang format

clang format

clang format

Using Match Offsets List

Temp commit
2024-10-30 12:32:00 +01:00
zeek-bot
ab4d8744b6 Update doc submodule [nomail] [skip ci] 2024-10-30 00:10:54 +00:00
Arne Welzel
5200b84fb3 Merge branch 'sqli-spaces-encode-to-plus' of https://github.com/cooper-grill/zeek
* 'sqli-spaces-encode-to-plus' of https://github.com/cooper-grill/zeek:
  account for spaces encoding to plus signs in sqli regex detection
2024-10-29 14:08:39 +01:00
Arne Welzel
821218e7b2 Merge remote-tracking branch 'origin/topic/vern/CPP-when-capture-naming'
* origin/topic/vern/CPP-when-capture-naming:
  fixed "-O gen-C++" naming of "when" captures to avoid ambiguities due to inlining
  Simplified & made more robust maintenance helper script for "-O gen-C++" testing
  "-a cpp" baseline updates to reflect recent BTest changes
2024-10-29 13:50:56 +01:00
Cooper Grill
ec6bf7bebc account for spaces encoding to plus signs in sqli regex detection
remove instance of plus sign to account for real plus in sql

account for spaces encoding to plus signs in sqli regex detection

add test cases for sqli space to plus

account for spaces encoding to plus signs in sqli regex detection

forgot semicolon

account for spaces encoding to plus signs in sqli regex detection
2024-10-29 07:48:36 -04:00
Arne Welzel
54bc3672d8 modbus: Skip non-modbus traffic testing with Spicy SSL
With Spicy SSL, there's no SSL conn.log produced.
2024-10-29 09:30:01 +01:00
Arne Welzel
d18045ee16 testing: Add have-spicy-ssl helper and update tests 2024-10-29 09:30:01 +01:00
zeek-bot
fc42074c7c Update doc submodule [nomail] [skip ci] 2024-10-25 00:22:10 +00:00
Christian Kreibich
66173633f4 Merge branch 'topic/christian/telemetry-make-bifs-primary'
* topic/christian/telemetry-make-bifs-primary:
  Telemetry framework: move BIFs to the primary-bif stage
  Minor comment tweaks for init-frameworks-and-bifs.zeek
2024-10-24 07:09:16 -07:00
Christian Kreibich
f2b4c9d553 Update broker submodule [nomail]
This pulls in zeek/broker#424, zeek/broker#430, zeek/broker#431.
2024-10-23 05:52:07 -07:00
zeek-bot
b65a7d427c Update doc submodule [nomail] [skip ci] 2024-10-23 00:12:55 +00:00
Arne Welzel
daa358c840 Merge remote-tracking branch 'origin/topic/awelzel/3947-telemetry-hook-scrape'
* origin/topic/awelzel/3947-telemetry-hook-scrape:
  btest/telemetry: Fix "Note compilable" typo
  misc/stats: Add zeek_net_timestamp_seconds
  telemetry/Manager: Remove variant include
  telemetry: Invoke Telemetry::sync() only at scrape/collection time
2024-10-22 19:04:51 +02:00
Arne Welzel
3d053a94f7 btest/telemetry: Fix "Note compilable" typo 2024-10-22 18:50:32 +02:00
Arne Welzel
e20aa66eae misc/stats: Add zeek_net_timestamp_seconds
Adding a metric for the network time value itself should make it
possible to observe it stopping or growing slowly as compared to
realtime when Zeek isn't able to keep up.

Also, modify the telemetry/log.zeek test to include misc/stats and
log at a higher frequency with a more interesting pcap.
2024-10-22 18:49:17 +02:00
Arne Welzel
1822f4f6fe telemetry/Manager: Remove variant include 2024-10-22 18:49:16 +02:00
Arne Welzel
70872673a1 telemetry: Invoke Telemetry::sync() only at scrape/collection time
This stops invoking Telemetry::sync() via a scheduled event and instead
only invokes it on-demand. This makes metric collection network time
independent and lazier, too.

With Prometheus scrape requests being processed on Zeek's main thread
now, we can safely invoke the script layer Telemetry::sync() hook.

Closes #3947
2024-10-22 18:49:11 +02:00
Martin van Hensbergen
ee84c0c59a Improvements in FNV1A hash functions
- Add FNV1a64 hash function
- make hash function type aware
- add unit tests
2024-10-22 16:07:12 +02:00
Arne Welzel
d74b073852 Merge remote-tracking branch 'origin/topic/awelzel/3978-zeekjs-0.12.1-bump'
* origin/topic/awelzel/3978-zeekjs-0.12.1-bump:
  Bump zeekjs to 0.12.1
2024-10-22 11:25:05 +02:00
Arne Welzel
ee18b8911c Bump zeekjs to 0.12.1
7ec0953 ci: Bump actions/upload-artifact
    8e5914d ci/docker: Bump distros, update some OBS repos
    129b737 Fix crash during shutdown

Closes #3978
2024-10-22 11:09:35 +02:00
zeek-bot
5428ddbdeb Update doc submodule [nomail] [skip ci] 2024-10-22 00:10:53 +00:00
Arne Welzel
4763282f36 Merge branch 'modbus-fixes' of https://github.com/zambo99/zeek
* 'modbus-fixes' of https://github.com/zambo99/zeek:
  Prevent non-Modbus on port 502 to be reported as Modbus
2024-10-21 15:54:11 +02:00
Emmanuele Zambon
05d92dc2a5 Prevent non-Modbus on port 502 to be reported as Modbus
This commit prevents most non-Modbus TCP traffic on port 502 to be
reported as Modbus in conn.log as well as in modbus.log.
To do so, we have introduced two &enforce checks in the Modbus
protocol definition that checks that some specific fields of the
(supposedly) Modbus header are compatible with values specified in
the specs.

To ensure non-regression, with this commit we also introduce a
new btest.

Closes #3962
2024-10-21 14:40:45 +02:00
Christian Kreibich
2e576b058d Merge branch 'topic/vern/script-opt-headers-factoring'
* topic/vern/script-opt-headers-factoring:
  factored CPP source's main header into collection of per-source-file headers
  renamed script optimization Attrs.h header to prepare for factoring large Compile.h
  factored ZAM source's main header into collection of per-source-file headers
2024-10-18 17:51:19 -07:00