Commit graph

16905 commits

Author SHA1 Message Date
Johanna Amann
d89c0d1ef7 Merge remote-tracking branch 'origin/topic/johanna/fix-ssl2-client-hello-version-parsing'
* origin/topic/johanna/fix-ssl2-client-hello-version-parsing:
  Fix parsing of version field in SSLv2 client hello
2024-08-27 13:31:12 +01:00
zeek-bot
617faa1d33 Update doc submodule [nomail] [skip ci] 2024-08-24 00:20:43 +00:00
Arne Welzel
45b33bf5c1 Merge remote-tracking branch 'origin/topic/awelzel/no-child-analyzer-on-finished-connections'
* origin/topic/awelzel/no-child-analyzer-on-finished-connections:
  Analyzer: Do not add child analyzers when finished
2024-08-23 14:19:00 +02:00
Arne Welzel
be9f170561 Analyzer: Do not add child analyzers when finished
Depending on an analyzer's implementation, its Done() method may
attempt to access analyzer or connection state when executing.
When this happens in the destructor of the parent analyzer during
the process of destructing a connection, this state may have been
deleted, resulting in use-after-free crashes or worse memory
corruption.

The following cases have been observed in the wild for when this happens.

  * PIA matching during Done() for undelivered TCP data enables a Spicy
    based analyzer which in turn attempts to raise an analyzer violation
    during Done()->EndOfData().

  * Spicy analyzers attaching new analyzers during their Done() processing
    which in turn attempt to use TCP() (to call FindChild()) during Done()
    while the analyzer tree / connection is being destructed.

The second scenario was previously found to happen in the HTTP analyzer
and fixed with 6ef9423f3c.

Plug these scenarios by short-circuiting AddChildAnalyzer() if the analyzer
or connection have finished or are being finished.
2024-08-23 09:57:20 +02:00
Arne Welzel
4a4cbf2576 Merge remote-tracking branch 'origin/topic/awelzel/tcp-reassembler-undelivered-data-match-bool-bool-bool-confusion'
* origin/topic/awelzel/tcp-reassembler-undelivered-data-match-bool-bool-bool-confusion:
  TCP_Reassembler: Fix IsOrig() position in Match() call
2024-08-23 09:41:07 +02:00
Robin Sommer
a2079bcda6
Merge remote-tracking branch 'origin/topic/robin/gh-3881-spicy-ports'
* origin/topic/robin/gh-3881-spicy-ports:
  Spicy: Register well-known ports through an event handler.
  Revert "Remove deprecated port/ports fields for spicy analyzers"
2024-08-23 08:10:02 +02:00
Johanna Amann
a6edbf8bcd Fix parsing of version field in SSLv2 client hello
It turns out that, for probably a long time, we have reported an
incorrect version when parsing an SSLv2 client hello. We always reported
this as SSLv2, no matter which version the client hello actually
contained.

This bug probably went unnoticed for a long time, as SSLv2 is
essentially unused nowadays, and as this field does not show up in the
default logs.

This was found due to a baseline difference when writing the Spicy SSL
analyzer.
2024-08-22 13:14:24 +01:00
Arne Welzel
4576741fe4 TCP_Reassembler: Fix IsOrig() position in Match() call
Found during a debug session with @rsmmr. Undelivered TCP data
would only be matched for the responder and eol set to IsOrig().
2024-08-22 13:43:44 +02:00
Robin Sommer
0d3296590d
Spicy: Register well-known ports through an event handler.
This avoids the earlier problem of not tracking ports correctly in
scriptland, while still supporting `port` in EVT files and `%port` in
Spicy files.

As it turns out we are already following the same approach for file
analyzers' MIME types, so I'm applying the same pattern: it's one
event per port, without further customization points. That leaves the
patch pretty small after all while fixing the original issue.
2024-08-22 10:24:55 +02:00
zeek-bot
4b369bad2d Update doc submodule [nomail] [skip ci] 2024-08-21 00:14:27 +00:00
Johanna Amann
2f07ca9e7f Merge remote-tracking branch 'origin/topic/johanna/ssl-history-also-for-sslv2-not-only-for-things-that-use-the-more-modern-handshake'
* origin/topic/johanna/ssl-history-also-for-sslv2-not-only-for-things-that-use-the-more-modern-handshake:
  Make ssl_history work for SSLv2 handshakes/connections
2024-08-20 11:40:20 +01:00
Arne Welzel
5ac5f5f24f Merge remote-tracking branch 'origin/topic/awelzel/broker-deprecate-valp-list-interface'
* origin/topic/awelzel/broker-deprecate-valp-list-interface:
  broker: Deprecate MakeEvent(ValPList*)
  Span: Remove deduction guideline for Iter, Iter, include cleanup
2024-08-20 10:11:11 +02:00
Arne Welzel
8920637397 Merge remote-tracking branch 'origin/topic/awelzel/global-stmts-scope-fixup'
* origin/topic/awelzel/global-stmts-scope-fixup:
  ScriptOpt: Ensure global statements have non-null scope
2024-08-20 10:10:27 +02:00
Tim Wojtulewicz
b26c44ae72 Update gen-zam submodule [nomail] [skip ci] 2024-08-19 14:15:18 -07:00
Robin Sommer
547144d07e
Revert "Remove deprecated port/ports fields for spicy analyzers"
This reverts commit 15d404dd19.
2024-08-19 09:57:04 +02:00
zeek-bot
9ea316e9a4 Update doc submodule [nomail] [skip ci] 2024-08-17 00:23:21 +00:00
Tim Wojtulewicz
00c2e9afce Merge remote-tracking branch 'J-Gras/topic/jgras/remove-wrapper-analyzer'
* J-Gras/topic/jgras/remove-wrapper-analyzer:
  Remove unused wrapper packet analyzer
2024-08-16 09:06:51 -07:00
Arne Welzel
f21da04c3e Merge remote-tracking branch 'origin/topic/etyp/dns-tkey'
* origin/topic/etyp/dns-tkey:
  Add DNS TKEY event
2024-08-16 16:51:58 +02:00
Jan Grashoefer
64bc852fbe Remove unused wrapper packet analyzer
This is a leftover from the migration to the packet analysis framework.
The analyzer wrapped the original packet analysis code for comparison.
2024-08-16 16:49:12 +02:00
Evan Typanski
170276807b Add DNS TKEY event 2024-08-16 10:20:42 -04:00
Arne Welzel
9d1d4e28b3 ScriptOpt: Ensure global statements have non-null scope
The ProfileFunc() logic assumed that GetScope() returned a non-nullptr.
This holds except for the synthetic global statements function.

Fix the latter and add an assert, also add a name to the type so it's
easier to recognize in a debugger what's going on, otherwise the name
is "".

This was found by UBSAN due to it seeing the ->OrderedVars() call on a
nullptr. Elsewhere, num_params == 0 shielded from that access and so
didn't lead to crashes.
2024-08-16 13:59:24 +02:00
Arne Welzel
ec1088c3ef Merge remote-tracking branch 'origin/topic/vern/zam-regularization'
* origin/topic/vern/zam-regularization: (33 commits)
  simpler and more robust identification of function parameters for AST profiling
  fixes to limit AST traversal in the face of recursive types
  address some script optimization compiler warnings under Linux
  fix for -O C++ construction of variable names that use multiple module namespaces
  fix for script optimization of "opaque" values that are run-time constants
  fix for script optimization of nested switch statements
  script optimization fix for complex "in" expressions in conditionals
  updates to typos allow-list reflecting ZAM regularization changes
  BTest updates for ZAM regularization changes
  convert new ZAM operations to use typed operands
  complete migration of ZAM to use only public ZVal methods
  "-O validate-ZAM" option to validate generated ZAM instructions
  internal option to suppress control-flow optimization
  exposing some functionality for greater flexibility in structuring run-time execution
  rework ZAM compilation of type switches to leverage value switches
  add tracking of control flow information
  factoring of ZAM operation specifications into separate files
  updates to ZAM operations / gen-zam regularization, other than the operations themselves
  type-checking fix for vector-of-string operations
  ZVal constructor for booleans
  ...
2024-08-16 12:10:33 +02:00
Vern Paxson
2477213619 simpler and more robust identification of function parameters for AST profiling 2024-08-16 11:19:02 +02:00
Vern Paxson
691a4003b7 fixes to limit AST traversal in the face of recursive types 2024-08-16 11:19:02 +02:00
Vern Paxson
910a2f6c59 address some script optimization compiler warnings under Linux 2024-08-16 11:19:02 +02:00
Vern Paxson
202c405a1e fix for -O C++ construction of variable names that use multiple module namespaces 2024-08-16 11:19:02 +02:00
Vern Paxson
6faad5e5ca fix for script optimization of "opaque" values that are run-time constants 2024-08-16 11:19:02 +02:00
Vern Paxson
3f52cbcbc7 fix for script optimization of nested switch statements 2024-08-16 11:19:02 +02:00
Vern Paxson
a947d96160 script optimization fix for complex "in" expressions in conditionals 2024-08-16 11:19:02 +02:00
Vern Paxson
42bf164dc4 updates to typos allow-list reflecting ZAM regularization changes 2024-08-16 11:19:02 +02:00
Vern Paxson
bf3cf9da48 BTest updates for ZAM regularization changes 2024-08-16 11:18:58 +02:00
Vern Paxson
3b6df1ab7f convert new ZAM operations to use typed operands 2024-08-16 11:18:58 +02:00
Vern Paxson
3e1b536810 complete migration of ZAM to use only public ZVal methods 2024-08-16 11:18:58 +02:00
Vern Paxson
1457099df3 "-O validate-ZAM" option to validate generated ZAM instructions 2024-08-16 11:18:58 +02:00
Vern Paxson
db22448270 internal option to suppress control-flow optimization 2024-08-16 11:18:58 +02:00
Vern Paxson
63f76c7f84 exposing some functionality for greater flexibility in structuring run-time execution 2024-08-16 11:18:58 +02:00
Vern Paxson
65e713e6ea rework ZAM compilation of type switches to leverage value switches 2024-08-16 11:18:58 +02:00
Vern Paxson
a1185ee6bb add tracking of control flow information 2024-08-16 11:18:58 +02:00
Vern Paxson
e94764982d factoring of ZAM operation specifications into separate files 2024-08-16 11:18:58 +02:00
Vern Paxson
5fc2c601b4 updates to ZAM operations / gen-zam regularization, other than the operations themselves 2024-08-16 11:18:58 +02:00
Vern Paxson
1d7e71b499 type-checking fix for vector-of-string operations 2024-08-16 11:18:57 +02:00
Vern Paxson
3cf3cc3c5e ZVal constructor for booleans 2024-08-16 11:18:57 +02:00
Vern Paxson
88740acffe fix for nit in base/protocols/krb/main.zeek 2024-08-16 11:18:57 +02:00
Vern Paxson
1253af42f9 mark functions skipped by ZAM compilation as such 2024-08-16 11:18:57 +02:00
Vern Paxson
11e9135f80 fix for avoiding inadvertent interpreter errors in CallExpr::IsPure() 2024-08-16 11:18:57 +02:00
Vern Paxson
37fcb231fa support for traversing ZAM code similar to AST traversal 2024-08-16 11:18:57 +02:00
Vern Paxson
85a8f0739c run-time warnings for scripts compiled to C++ 2024-08-16 11:18:57 +02:00
Vern Paxson
b333d24e0e allow C++ script compiler access to type internals 2024-08-16 11:18:57 +02:00
Vern Paxson
e93db75f78 fixes for script optimization of coerce-to-any expressions 2024-08-16 11:18:57 +02:00
Vern Paxson
cfb068a922 fix to correctly track whether a capture needs deep-copying 2024-08-16 11:18:57 +02:00