Commit graph

150 commits

Author SHA1 Message Date
Tim Wojtulewicz
9cb6de7447 Add weird for unknown HTTP/0.9 request method 2023-03-10 15:45:11 -07:00
Tim Wojtulewicz
0003495a9b Special case HTTP 0.9 early on
Mostly, treat HTTP0.9 completely separate. Because we're doing raw
delivery of a body directly, fake enough (connection_close=1, and finish
headers manually) so that the MIME infrastructure thinks it is seeing a
body.

This deals better with the body due to accounting for the first line. Also
it avoids the content line analyzer to strip CRLF/LF and the analyzer
then adding CRLF unconditionally by fully bypassing the content line
analyzer.

Concretely, the vlan-mpls test case contains a HTTP response with LF only,
but the previous implementation would use CRLF, accounting for two many bytes.
Same for the http.no-version test which would previously report a body
length of 280 and now is at 323 (which agrees with wireshark).

Further, the mime_type detection for the http-09 test case works because
it's now seeing the full body.

Drawback: We don't extract headers when a server actually replies with
a HTTP/1.1 message, but grrr, something needs to give I guess.
2023-03-10 09:52:34 -07:00
Johanna Amann
b56b856da9 SSL/TLS: Parse CertificateRequest message
This commit introduces parsing of the CertificateRequest message in the
TLS handshake. It introduces a new event ssl_certificate_request, as
well as a new function parse_distinguished_name, which can be used to
parse part of the ssl_certificate_request event parameters.

This commit also introduces a new policy script, which appends
information about the CAs a TLS server requests in the
CertificateRequest message, if it sends it.
2023-03-09 09:12:29 +01:00
Tim Wojtulewicz
2735109ad7 Update external testing commit hashes for telemetry changes 2023-03-02 13:41:09 -07:00
Tim Wojtulewicz
f6d3ed2395 Default known stores to false to avoid Broker stores 2023-03-02 12:48:53 -07:00
Arne Welzel
bfc2374c8f Bump external test suites, filter some telemetry.log entries 2023-02-27 15:42:18 +01:00
Arne Welzel
a693924099 Merge remote-tracking branch 'origin/topic/awelzel/2572-event-handler-stats'
* origin/topic/awelzel/2572-event-handler-stats:
  Bump external baselines
  external/testing-setup: Less telemetry.log volume
  EventHandler: Use telemetry framework for EventHandler.call_count
2023-02-22 12:59:41 +01:00
Arne Welzel
bf693aaaa5 Bump external baselines 2023-02-22 12:27:35 +01:00
Arne Welzel
f56785740c ftp: Limit user, password, arg and reply_msg column sizes in log
The user and password fields are replicated to each of the ftp.log
entries. Using a very large username (100s of KBs) allows to bloat
the log without actually sending much traffic. Further, limit the
arg and reply_msg columns to large, but not unbounded values.
2023-02-21 12:28:07 -07:00
Arne Welzel
b6df7773a9 Merge remote-tracking branch 'origin/topic/awelzel/arm64-container-follow-ups-2'
* origin/topic/awelzel/arm64-container-follow-ups-2:
  Bump private testsuite for char handling fixes
  Base64: report byte as positive integer
  netbios_decode: use unsigned char for result
  analyzer/http: Do not assume char is signed
  cirrus: Run tests in a Debian 11 container, too
2023-02-02 18:35:02 +01:00
Arne Welzel
bbe0a86d4a Bump private testsuite for char handling fixes 2023-02-02 16:24:41 +01:00
Robin Sommer
04a1ead978
Provide infrastructure to migrate legacy analyzers to Spicy.
As initial examples, this branch ports the Syslog and Finger analyzers
over. We leave the old analyzers in place for now and activate them
iff we compile without any Spicy.

Needs `zeek-spicy-infra` branches in `spicy/`, `spicy-plugin/`,
`CMake/`, and `zeek/zeek-testing-private`.

Note that the analyzer events remain associated with the Spicy plugin
for now: that's where they will show up with `-NN`, and also inside
the Zeekygen documentation.

We switch CMake over to linking the runtime library into the plugin,
vs. at the top-level through object libraries.
2023-02-01 11:33:48 +01:00
Tim Wojtulewicz
f842a86e80 Update external testing repo commit hashes for Teredo changes 2023-01-26 09:23:22 -07:00
Tim Wojtulewicz
e0553d451f Revert "Update external test repo commits"
This reverts commit 8e405ef2f0.
2023-01-25 08:36:41 -07:00
Tim Wojtulewicz
8e405ef2f0 Update external test repo commits 2023-01-25 08:36:16 -07:00
Arne Welzel
2d852209b0 Merge remote-tracking branch 'origin/topic/awelzel/analyzer-log'
* origin/topic/awelzel/analyzer-log:
  btest/net-control: Use different expiration times for rules
  analyzer: Add analyzer.log for logging violations/confirmations
2023-01-10 10:22:58 +01:00
Arne Welzel
17d0ade26a analyzer: Add analyzer.log for logging violations/confirmations
By default this only logs all the violations, regardless of the
confirmation state (for which there's still dpd.log). It includes
packet, protocol and file analyzers.

This uses options, change handlers and event groups for toggling
the functionality at runtime.

Closes #2031
2023-01-09 18:11:49 +01:00
Tim Wojtulewicz
b9a4afe9bf Update zeek-testing-private commit hash 2022-11-08 16:53:58 -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
Tim Wojtulewicz
66e818e69b Update external test hashes 2022-11-02 16:38:24 -07:00
Tim Wojtulewicz
5e4db6d0c4 Add column to packet_filter.log for failure reason 2022-10-21 10:50:00 -07:00
Robin Sommer
39148ef706
Merge remote-tracking branch 'origin/topic/awelzel/files-log-unrolling'
I removed `deprecated-txhosts-rxhosts-connuids.zeek` from
`local.zeek`, seems preferable not to have a script-to-go-away in the
standard configuration for new users. Also tweaked `NEWS` just a tiny
bit.

* origin/topic/awelzel/files-log-unrolling:
  files.log: Unroll and introduce uid and id fields
2022-08-17 09:01:43 +02:00
Arne Welzel
d2314d2666 files.log: Unroll and introduce uid and id fields
This is a script-only change that unrolls File::Info records into
multiple files.log entries if the same file was seen over different
connections by single worker. Consequently, the File::Info record
gets the commonly used uid and id fields added. These fields are
optional for File::Info - a file may be analyzed without relation
to a network connection (e.g by using Input::add_analysis()).

The existing tx_hosts, rx_hosts and conn_uids fields of Files::Info
are not meaningful after this change and removed by default. Therefore,
files.log will have them removed, too.

The tx_hosts, rx_hosts and conn_uids fields can be revived by using the
policy script frameworks/files/deprecated-txhosts-rxhosts-connuids.zeek
included in the distribution. However, with v6.1 this script will be
removed.
2022-08-16 17:22:20 +02:00
Tim Wojtulewicz
b5b022449e Update zeek-testing-private commit hash after email regex changes
Related to https://github.com/zeek/zeek/pull/2221
2022-08-12 16:44:25 -07:00
Robin Sommer
686e740bbe
Merge remote-tracking branch 'origin/topic/awelzel/telemetry-script-land-v0'
* origin/topic/awelzel/telemetry-script-land-v0:
  Introduce telemetry framework
  Bump broker submodule to master.
2022-08-05 17:14:23 +02:00
Arne Welzel
3fe930dbf2 Introduce telemetry framework
Adds base/frameworks/telemetry with wrappers around telemetry.bif
and updates telemetry/Manager to support collecting metrics from
script land.

Add policy/frameworks/telemetry/log for logging of metrics data
into a new telemetry.log and telemetry_histogram.log and add into
local.zeek by default.
2022-08-05 11:43:44 +02:00
Vern Paxson
a94afdec47 tie to revised private testing repo 2022-06-16 14:33:11 -07:00
Tim Wojtulewicz
c299301372 Update zeek-testing-private hash [nomail] [skip ci] 2022-03-22 13:12:12 -07:00
Johanna Amann
b1415dd364 Merge remote-tracking branch 'origin/topic/johanna/gh-1952'
* origin/topic/johanna/gh-1952:
  Match DPD TLS signature on one-sided connections.

Fixes GH-1952
2022-02-03 11:24:34 +00:00
Johanna Amann
95f1565498 Match DPD TLS signature on one-sided connections.
This commit changes DPD matching for TLS connections. A one-sided match
is enough to enable DPD now.

This commit also removes DPD for SSLv2 connections. SSLv2 connections do
basically no longer happen in the wild. SSLv2 is also really finnicky to
identify correctly - there is very little data required to match it, and
basically all matches today will be false positives. If DPD for SSLv2 is
still desired, the optional signature in policy/protocols/ssl/dpd-v2.sig
can be loaded.

Fixes GH-1952
2022-02-01 16:51:21 +00:00
Robin Sommer
a7427e95bf
Switch to recording unmodified HTTP header.
We used to attempt to remove any port specification before recording
HTTP host headers in logs. Doing so would (1) remove potentially useful
information, (2) not match what the documentation seemed to suggest, and
(3) fail for IP6 addresses containing colons.

We now record the original HOST header as is.

Addresses #1844.
2021-12-21 21:54:47 +01:00
Robin Sommer
dd5d6e1756 Merge branch 'topic/foxds/dcerpc_auth' of ssh://github.com/fox-ds/zeek
* 'topic/foxds/dcerpc_auth' of ssh://github.com/fox-ds/zeek:
  Fix protocol forwarding in dce_rpc-auth
  Fix protocol forwarding in dce_rpc-auth
2021-09-23 17:50:00 +02:00
Tim Wojtulewicz
b7e264f8ef Merge remote-tracking branch 'origin/topic/seth/tsv-logs-utf8-by-default'
* origin/topic/seth/tsv-logs-utf8-by-default:
  Fix mis-usage of string::append that leads to an overflow
  Use json_escape_utf8 for all utf8 data in ODesc
  Switch the TSV Zeek logs to be UTF8 by default.
2021-09-08 12:04:13 -07:00
Tim Wojtulewicz
404fed6923 Use json_escape_utf8 for all utf8 data in ODesc 2021-09-07 09:16:53 -07:00
Tim Wojtulewicz
569552b320 GH-1589: Avoid extracting IP-like strings from SMTP headers 2021-09-03 17:35:10 +00:00
Johanna Amann
7ec50bf434 Merge remote-tracking branch 'origin/topic/johanna/gh-859'
* origin/topic/johanna/gh-859:
  Add X509/SSL changes to NEWS
  X509: add check if function succeeds
  GH-1634: Address feedback
  Small indentation fixes in ssl-log-ext.zeek
  Fix memory leak in x509_check_cert_hostname bif
  Small bugfix and updates for external test hashes (SSL/X509)
  Baseline updates for recent SSL changes.
  Add ability to check if hostname is valid for a specific cert
  Add ssl_history field to ssl.log
  Add policy script suppressing certificate events
  Add new ssl-log-ext policy script
  Deprecate extract-certs-pem.zeek and add log-certs-base64.zeek
  Implement X509 certificate log caching
  Deprecate ICSI SSL notary script.
  Change SSL and X.509 logging format
  Enable OCSP logging by default.
  Split the code that handles X509 event hashing into its own file

Closes GH-859
2021-07-05 10:12:46 +01:00
Johanna Amann
8972676e92 GH-1634: Address feedback
This commit addreses feedback for GH-1643, changing typos and renaming
one of the fields in x509.log.
2021-07-02 15:12:58 +01:00
Johanna Amann
509b501e1b Merge remote-tracking branch 'origin/master' into topic/johanna/gh-859 2021-06-30 10:36:54 +01:00
Robin Sommer
40923fdd65 Merge remote-tracking branch 'origin/topic/robin/gh-1406-m1-tests'
* origin/topic/robin/gh-1406-m1-tests:
  Fix SMB tests on Apple M1.
2021-06-30 07:52:44 +02:00
Robin Sommer
369e42a6e4 Fix SMB tests on Apple M1.
Due to different double precision on M1, file IDs for SMB could end up
changing on M1 because the access time of a file goes into their
computation. The real solution for this would be changing Zeek's
internal "time" representation to uint64; that's planned, but requires
major surgery. For now, this PR changes the SMB code to also pass SMB's
original time representation (which is a uint64) into script-land, and
then use that for computing the file ID.

Closes #1406
2021-06-29 20:17:02 +02:00
Johanna Amann
93d7778f97 Small bugfix and updates for external test hashes (SSL/X509) 2021-06-29 15:25:08 +01:00
Vlad Grigorescu
9d0bd96e1f Simplify the logic a big by making Notice$email_dest have a default rather than be optional 2021-06-17 10:31:04 -05:00
Vlad Grigorescu
fc7dfe7340 Update hashes in external testing repos 2021-06-12 10:54:00 -05:00
Jon Siwek
9e8eb30620 Add missing zeek/ prefix to a telemetry header's includes 2021-04-30 18:29:34 -07:00
Jon Siwek
76fb1e7fd0 Fixes to decode_netbios_name and decode_netbios_name_type BIFs
Fixes to `decode_netbios_name`:

* Improve validation that input string is a NetBIOS encoding
  (32 bytes, with characters ranging from 'A' to 'P').  This helps
  prevent Undefined Behavior of left-shifting negative values.
  Invalid encodings now cause a return-value of an empty string.

* More liberal in what decoded characters are allowed.  Namely,
  spaces are now allowed (but any trailing null-bytes and spaces
  are trimmed, similar to before).

Fixes to `decode_netbios_name_type`:

* Improve validation that input string is a NetBIOS encoding
  (32 bytes, with characters ranging from 'A' to 'P').  This helps
  prevent Undefined Behavior of left-shifting negative values and
  a heap-buffer-overread when the input string is too small.
  Invalid encodings now cause a return-value of 256.
2021-04-27 15:27:04 -07:00
Jon Siwek
07bad2d40e Merge remote-tracking branch 'origin/topic/seth/fix-smb-ts-fields'
* origin/topic/seth/fix-smb-ts-fields:
  Updating external test commit pointers
  ts fields in SMB logs now default to network_time()
2021-03-11 12:44:04 -08:00
Seth Hall
87950cb833 Updating external test commit pointers 2021-03-10 18:23:15 +00:00
Jon Siwek
efba91cd26 Merge branch 'topic/oakljon/gh-1352-smtp-header-parsing' of https://github.com/theavgjojo/zeek
* 'topic/oakljon/gh-1352-smtp-header-parsing' of https://github.com/theavgjojo/zeek:
  GH-1352: Added flag to stop processing SMTP headers in attached messages
2021-01-21 17:01:13 -08:00
Johanna Amann
8955e6c060 Merge branch 'master' of github.com:zeek/zeek 2020-12-07 18:23:18 +00:00
Johanna Amann
5f6b95c027 Update external baseline commit hashes 2020-12-06 20:19:52 -08:00