Commit graph

4120 commits

Author SHA1 Message Date
Tim Wojtulewicz
bfd5b06943 Minor renaming changes to event handler stats bif, plus a test 2022-11-14 09:13:31 -07:00
Tim Wojtulewicz
2739275b88 Merge remote-tracking branch 'jsoref/spelling-src'
* jsoref/spelling-src:
  Spelling src
2022-11-11 12:49:15 -07:00
Tim Wojtulewicz
951250b753 Merge remote-tracking branch 'origin/topic/vern/script-opt-Nov22-maint'
* origin/topic/vern/script-opt-Nov22-maint:
  Script optimization maintenance and updates:   maintenance fixes for variadic run-time checks, '_' placeholder identifier   "-O allow-cond" permits compiling scripts to C++ when influenced by @if conditionals   more robust standalone compile-to-C++ properties   fix for nested "when" statements   test suite updates
2022-11-09 18:24:03 -07:00
Josh Soref
cd201aa24e Spelling src
These are non-functional changes.

* accounting
* activation
* actual
* added
* addresult
* aggregable
* aligned
* alternatively
* ambiguous
* analysis
* analyzer
* anticlimactic
* apparently
* application
* appropriate
* arithmetic
* assignment
* assigns
* associated
* authentication
* authoritative
* barrier
* boundary
* broccoli
* buffering
* caching
* called
* canonicalized
* capturing
* certificates
* ciphersuite
* columns
* communication
* comparison
* comparisons
* compilation
* component
* concatenating
* concatenation
* connection
* convenience
* correctly
* corresponding
* could
* counting
* data
* declared
* decryption
* defining
* dependent
* deprecated
* detached
* dictionary
* directional
* directly
* directory
* discarding
* disconnecting
* distinguishes
* documentation
* elsewhere
* emitted
* empty
* endianness
* endpoint
* enumerator
* essentially
* evaluated
* everything
* exactly
* execute
* explicit
* expressions
* facilitates
* fiddling
* filesystem
* flag
* flagged
* for
* fragments
* guarantee
* guaranteed
* happen
* happening
* hemisphere
* identifier
* identifies
* identify
* implementation
* implemented
* implementing
* including
* inconsistency
* indeterminate
* indices
* individual
* information
* initial
* initialization
* initialize
* initialized
* initializes
* instantiate
* instantiated
* instantiates
* interface
* internal
* interpreted
* interpreter
* into
* it
* iterators
* length
* likely
* log
* longer
* mainly
* mark
* maximum
* message
* minimum
* module
* must
* name
* namespace
* necessary
* nonexistent
* not
* notifications
* notifier
* number
* objects
* occurred
* operations
* original
* otherwise
* output
* overridden
* override
* overriding
* overwriting
* ownership
* parameters
* particular
* payload
* persistent
* potential
* precision
* preexisting
* preservation
* preserved
* primarily
* probably
* procedure
* proceed
* process
* processed
* processes
* processing
* propagate
* propagated
* prototype
* provides
* publishing
* purposes
* queue
* reached
* reason
* reassem
* reassemble
* reassembler
* recommend
* record
* reduction
* reference
* regularly
* representation
* request
* reserved
* retrieve
* returning
* separate
* should
* shouldn't
* significant
* signing
* simplified
* simultaneously
* single
* somebody
* sources
* specific
* specification
* specified
* specifies
* specify
* statement
* subdirectories
* succeeded
* successful
* successfully
* supplied
* synchronization
* tag
* temporarily
* terminating
* that
* the
* transmitted
* true
* truncated
* try
* understand
* unescaped
* unforwarding
* unknown
* unknowndata
* unspecified
* update
* usually
* which
* wildcard

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-11-09 12:08:15 -05:00
Tim Wojtulewicz
b9a4afe9bf Update zeek-testing-private commit hash 2022-11-08 16:53:58 -07:00
Arne Welzel
8b04868de3 {http,smtp}/entities: Align header regexes with extract_filename_from_content_disposition() 2022-11-08 16:45:25 -07:00
Arne Welzel
fa956efa79 file_analysis/Analyzer: Limit maximum number of violations
Just the same as for protocol analyzers, prevent from violation event overload.
2022-11-08 16:44:39 -07:00
Arne Welzel
e688bfcf73 test: Add btest verifying max_analyzer_violations functionality
The pcap has been generated roughly based on the example found on wikipedia
with some added garbled response after the STAT command from the client.
2022-11-08 16:44:34 -07:00
Arne Welzel
c132d140ae ftp: Limit pending commands to FTP::max_pending_commands (default 20) 2022-11-08 16:44:17 -07:00
Arne Welzel
d2689379bc Update baselines after AnalyzePacket changes
Mainly, for bad headers we do not (can not) put addresses into
the log anymore. Some were rather obviously bogus previously
already.
2022-11-08 16:44:15 -07:00
Vern Paxson
ee0a6f6835 Script optimization maintenance and updates:
maintenance fixes for variadic run-time checks, '_' placeholder identifier
  "-O allow-cond" permits compiling scripts to C++ when influenced by @if conditionals
  more robust standalone compile-to-C++ properties
  fix for nested "when" statements
  test suite updates
2022-11-08 11:56:32 -08:00
Robin Sommer
2a36441b8e
Merge remote-tracking branch 'origin/topic/awelzel/2483-builtin-plugin-includes'
* origin/topic/awelzel/2483-builtin-plugin-includes:
  zeek-setup: Load builtin-plugins/__preload__.zeek before initializing bifs
  cmake: Introduce bro_PLUGIN_LINK_LIBS and add to link command.
  cmake: Do not use include_directories() for included plugins
  cmake: Bump submodule
2022-11-07 11:25:03 +01:00
Tim Wojtulewicz
68450eac47 Merge remote-tracking branch 'origin/topic/timw/update-dns-types'
* origin/topic/timw/update-dns-types:
  Update external test hashes
  Update DNS type strings to match correct mappings
2022-11-03 08:57:19 -07:00
Tim Wojtulewicz
d65c75e2ad Merge remote-tracking branch 'jsoref/spelling-scripts'
* jsoref/spelling-scripts:
  Spelling fixes: scripts
2022-11-02 16:56:27 -07:00
Tim Wojtulewicz
66e818e69b Update external test hashes 2022-11-02 16:38:24 -07:00
Josh Soref
21e0d777b3 Spelling fixes: scripts
* accessing
* across
* adding
* additional
* addresses
* afterwards
* analyzer
* ancillary
* answer
* associated
* attempts
* because
* belonging
* buffer
* cleanup
* committed
* connects
* database
* destination
* destroy
* distinguished
* encoded
* entries
* entry
* hopefully
* image
* include
* incorrect
* information
* initial
* initiate
* interval
* into
* java
* negotiation
* nodes
* nonexistent
* ntlm
* occasional
* omitted
* otherwise
* ourselves
* paragraphs
* particular
* perform
* received
* receiver
* referring
* release
* repetitions
* request
* responded
* retrieval
* running
* search
* separate
* separator
* should
* synchronization
* target
* that
* the
* threshold
* timeout
* transaction
* transferred
* transmission
* triggered
* vetoes
* virtual

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-11-02 17:36:39 -04:00
Arne Welzel
d34167b2c4 zeek-setup: Load builtin-plugins/__preload__.zeek before initializing bifs
Prevent errors as follows with the bro-http2 plugin.

    error in /mitrecnd_HTTP2.events.bif.zeek, line 95: identifier not defined: http2_stream_stat
    error in /mitrecnd_HTTP2.events.bif.zeek, line 363: identifier not defined: http2_settings
    internal error in /mitrecnd_HTTP2.events.bif.zeek, line 460: Failed to find type named: http2_settings_unrecognized_table
2022-11-02 12:21:44 +01:00
Robin Sommer
f8eb2d9241
Merge remote-tracking branch 'origin/topic/awelzel/2440-break-next-usage-validation'
* origin/topic/awelzel/2440-break-next-usage-validation:
  parse.y: Traverse AST post parsing to detect break/next usage issues
2022-11-02 10:59:29 +01:00
Tim Wojtulewicz
bc0284aefa Merge remote-tracking branch 'origin/topic/awelzel/2446-runtime-error-for-variadic-functions'
* origin/topic/awelzel/2446-runtime-error-for-variadic-functions:
  Func: Do not crash on va_args confusion for script funcs
2022-11-01 07:47:50 -07:00
Arne Welzel
4314467e44 Func: Do not crash on va_args confusion for script funcs
Script and BIF functions with a single any parameter are excluded from
type checking regarding arguments. This makes it possible to call a
ScriptFunc with more arguments than it actually has parameters and frame
space for, causing heap-buffer-overflows.

This change runtime checks expected parameters and provided arguments
and short-circuits execution as well as logging runtime expression errors.

Fixes #2446
2022-11-01 08:55:14 +01:00
Tim Wojtulewicz
6dec7d6027 Merge remote-tracking branch 'origin/topic/awelzel/record-fields-not-just-enum'
* origin/topic/awelzel/record-fields-not-just-enum:
  bifs/record_fields: Include actual enum name in type_name
2022-10-31 15:18:11 -07:00
Tim Wojtulewicz
352705d316 Merge remote-tracking branch 'origin/topic/awelzel/no-reassembly-for-known-ports'
* origin/topic/awelzel/no-reassembly-for-known-ports:
  IPBasedAnalyzer/TCPSessionAdapter: Fix TCP reassembly decision for known port analyzers
2022-10-31 14:57:39 -07:00
Christian Kreibich
95151e1da9 Merge remote-tracking branch 'origin/topic/awelzel/2425-cat-sep-fully-varargs'
* origin/topic/awelzel/2425-cat-sep-fully-varargs:
  cat_sep: Make fully vararg and do explicit runtime type checks
2022-10-28 16:55:29 -07:00
Arne Welzel
850aaaa5a8 parse.y: Traverse AST post parsing to detect break/next usage issues
Seemed easiest to do it via the traversal infrastructure as we do not
otherwise track enough context/scope when instantiating break or next
statements.

Might be worth moving this out of src/parse.y, but didn't exactly know
where. Or maybe we wait until there's more such trivial validations
popping up

Fixes #2440
2022-10-28 12:53:37 +02:00
Tim Wojtulewicz
d442ea1bb9 egrep reported as obsolete by opensuse-tumbleweed builds 2022-10-27 11:48:43 -07:00
Arne Welzel
a5f04b6270 cat_sep: Make fully vararg and do explicit runtime type checks
Using positional and vararg arguments for BIFs, it's not possible to do
proper runtime type checking on them as discussed in #2425. The bifcl produced
code unconditionally attempts to convert the positional arguments to StringVals,
but nothing ever type checks them. Instead of improving the vararg support in
Zeek script and bifcl, align cat_sep() with fmt() in making it fully vararg
and do implement type checks by hand.

With this change, passing wrong types for the separator and default argument
isn't a fatal error anymore and the error messages are also more descriptive.

It's a bit of a crutch working around varargs limitations.

Fixes #2425
2022-10-27 13:06:06 +02:00
Christian Kreibich
3237ad0ba2 Merge remote-tracking branch 'origin/topic/awelzel/builtin-af-packet'
* origin/topic/awelzel/builtin-af-packet:
  Include in Jan's AF_PACKET plugin as builtin plugin
2022-10-26 16:48:37 -07:00
Arne Welzel
699949cd40 bifs/record_fields: Include actual enum name in type_name
One more from @stevesmoot. The record_fields() BIF produced "enum" as
type_name for fields of type enum.

Extend container_type_name() to append the actual name of the enum.

This is changing the format and may break consumers, but those are
likely in a category that are happy to adapt. Not having the actual
enum name available wasn't very helpful.

We could alternatively render only the actual type_name without the
prefixed "enum", but that isn't how it's done for record types currently
and it would make it more difficult to decide which subsequent BIFs to
use for further introspection, like enum_names().
2022-10-26 20:21:20 +02:00
Arne Welzel
2ad609cbbb Reintroduce event groups
This started with reverting commit 52cd02173d
and then rewriting it to be per handler rather than handler identifier
and adding support for hooks as well as adding implicit module groups.
2022-10-25 18:03:26 +02:00
Arne Welzel
f3f593c523 IPBasedAnalyzer/TCPSessionAdapter: Fix TCP reassembly decision for known port analyzers
This seems to be an age-old bug. Reported by mchen on discourse [1].

The TCPSessionAdapter decides in AddExtraAnalyzers() whether to enable
reassembly or not. When dpd_reassemble_first_packets is F, this boils down to
! GetChildren().empty(). The intention being that if any analyzers have been
added to the connection based on known ports, reassembly is to be enabled.

However, GetChildren() does not take into account new_children and so
! GetChildren().empty() is always false here and reassembly solely
based on dpd_reassemble_first_packets=F (or the tcp_content... options).
Ouch.

Call AppendNewChildren() before AddExtraAnalyzers() as a fix. Without this,
the new test does not produce an http.log and service "http" isn't in conn.log.

[1] https://community.zeek.org/t/how-to-activate-an-application-layer-analyzer-when-signature-dpd-reassemble-first-packets-is-off/6763
2022-10-25 16:07:40 +02:00
Robin Sommer
5aa7d80e88
Merge remote-tracking branch 'origin/topic/awelzel/enum-names-with-strings'
* origin/topic/awelzel/enum-names-with-strings:
  enum_names: Support naming types with a string
2022-10-25 12:37:33 +02:00
Robin Sommer
9f3a234f40
Merge remote-tracking branch 'origin/topic/awelzel/blank-identifer'
* origin/topic/awelzel/blank-identifer:
  scripts: Migrate table iteration to blank identifiers
  Introduce special treatment for the blank identifier _
2022-10-25 12:36:23 +02:00
Christian Kreibich
92c758bd44 Management framework: bump zeek-client and cluster testsuite 2022-10-24 16:00:58 -07:00
Arne Welzel
8c5896a74d scripts: Migrate table iteration to blank identifiers
No obvious hot-cases. Maybe the describe_file() ones or the intel ones
if/when there are hot intel hits.
2022-10-24 10:36:09 +02:00
Arne Welzel
46334f8b59 Introduce special treatment for the blank identifier _
Mostly: Do not instantiate variables within for loops and allow
reusing differently typed blanks which previously wasn't possible.

This may be missing some corner-cases, but the added tests seem
to work as expected and nothing else fell apart it seems.
2022-10-24 10:36:01 +02:00
Arne Welzel
a00cef9920 enum_names: Support naming types with a string
In his ZeekWeek 2022 presentation, @stevesmoot mentioned that he had a
difficult time looking up enum names when all he had was a string
naming the type.

Add support to enum_names() to transparently lookup the type if a string
is provided. This is similar in how record_fields() behaves when being
passed a string.
2022-10-21 20:09:48 +02:00
Tim Wojtulewicz
6bb6fed49f Add btest that exercises the pcap filter warnings 2022-10-21 10:50:00 -07:00
Tim Wojtulewicz
5e4db6d0c4 Add column to packet_filter.log for failure reason 2022-10-21 10:50:00 -07:00
Tim Wojtulewicz
0143d0cb86 Merge remote-tracking branch 'origin/topic/vern/CPP-Oct22-maint'
* origin/topic/vern/CPP-Oct22-maint:
  -O C++ maintenance updates to test suite
  -O gen-C++ maintenance: fixes for attributes & initializing globals
2022-10-17 16:19:04 -07:00
Tim Wojtulewicz
3656699e2f Merge remote-tracking branch 'origin/topic/awelzel/2403-reject-conflicting-plugins'
* origin/topic/awelzel/2403-reject-conflicting-plugins:
  plugins: Reject dynamic plugins matching names of built-in ones
2022-10-16 17:49:32 -07:00
Tim Wojtulewicz
bd7df9e2bf Add &ordered attribute for tables/sets 2022-10-16 15:31:42 -07:00
Vern Paxson
f4c1309dfc -O C++ maintenance updates to test suite 2022-10-14 08:38:55 -05:00
Tim Wojtulewicz
16601eafa2 Merge remote-tracking branch 'origin/topic/vern/ZAM-Oct22-maint'
* origin/topic/vern/ZAM-Oct22-maint:
  ZAM maintenance for recent test suite changes (and fixups missed last time)
2022-10-13 08:57:59 -05:00
Arne Welzel
0bc7d0905e Include in Jan's AF_PACKET plugin as builtin plugin
This has come up a few times and the motivation is mainly better "first timer"
experience with Zeek. Concretely, if one wants to run a Zeek cluster with
multiple workers and reasonable load balancing on Linux, AF_PACKET is a decent
start. Without AF_PACKET support being built into Zeek, however, a new user's
next experience is that of setting up a development environment in order
to compile an external plugin (think compiler, kernel headers, zkg, ...).
Only to get what could be termed basic functionality.

This is using the ZEEK_INCLUDE_PLUGINS infrastructure. I've used the all
upper case spelling of AF_PACKET in the help output because it seems everyone
else references/writes it like that. I think we should also write it
like that in the docs.
2022-10-13 13:29:27 +02:00
Vern Paxson
64ec7d0728 ZAM maintenance for recent test suite changes (and fixups missed last time) 2022-10-12 11:29:52 -07:00
Arne Welzel
048f2201fb plugins: Reject dynamic plugins matching names of built-in ones
This goes the hard-exit on conflicts route as IMO it provides better
messaging that something is wrong, rather than defaulting to something
the user may not expect.

Fixes #2403
2022-10-12 18:45:17 +02:00
Robin Sommer
b114850283 Move API for disabling packet analyzers into component.
Before, that API was part of the analyzers themselves, which meant we
couldn't disable a packet analyzer before it had been instantiated.
That's different from protocol/file analyzers, where we disable them
through the corresponding component. The lack of the component-side
API prevented Spicy from replacing packet analyzers at startup.

The reason we had put this into analyzer originally was performance so
that we don't need a component lookup for every packet. This change
keeps that optimization by caching the on/off state in the analyzer
itself as well, but now with the component being the one controlling
it.
2022-10-10 08:26:26 +02:00
Johanna Amann
3d9a1157f9 Update CT log list.
This uses the v3 json as a source for the first time. The test needed
some updating because Google removed a couple more logs - in the future
this should hopefully not be neccessary anymore because I think v3
should retain all logs.

In theory this might be neat in 5.1.
2022-10-06 15:10:59 +01:00
Robin Sommer
6fcbb55ccd Merge remote-tracking branch 'origin/topic/awelzel/analyzer-module-enable-disable-file-analyzer'
* origin/topic/awelzel/analyzer-module-enable-disable-file-analyzer:
  analyzer: Add file_analyzer support to enable_analyzer()/disable_analyzer()
2022-10-05 13:27:23 +02:00
Tim Wojtulewicz
37d4a28816 Merge remote-tracking branch 'origin/topic/awelzel/http-no-current-entity'
* origin/topic/awelzel/http-no-current-entity:
  http: Prevent script errors when http$current_entity is not set
2022-10-03 09:44:46 -07:00