Commit graph

464 commits

Author SHA1 Message Date
Johanna Amann
7e801563a0 Merge branch 'topic/p-l-/add-badarp-tests' of https://github.com/p-l-/bro
* 'topic/p-l-/add-badarp-tests' of https://github.com/p-l-/bro:
  Add bad ARP tests
2018-05-31 15:06:33 -07:00
Jon Siwek
58864c358c Add NCP::max_frame_size tuning option
This helps prevent excessive allocations based on message lengths
taken from NCP headers.
2018-05-22 18:27:52 -05:00
Jon Siwek
e35da5f592 Migrate NCP analyzer to use latest analyzer API
It was possibly never updated for newer Analyzer API changes, as simply
attaching the NCP analyzer to a connection would result in null pointer
derefernces and also support analyzers were not attached.
2018-05-22 16:27:07 -05:00
Jon Siwek
de029dd430 Merge remote-tracking branch 'origin/topic/jsiwek/binpac-fixes'
* origin/topic/jsiwek/binpac-fixes:
  Update test baseline for binpac changes
  Update test baseline for optimized binpac static-size array parsing
  Fixes for MySQL and SMB protocol parsers
  BIT-1829: add unit test for modbus parser issue
2018-05-22 15:06:51 -05:00
Pierre LALET
8315aa36a6 Add bad ARP tests
The capture file (btest/Traces/arp-leak.pcap) contains the
exploitation of an ARP leak flaw against NetBSD 7.0.2 using Scapy
etherleak() function.
2018-05-18 17:39:53 +02:00
Jon Siwek
954e7980cf Fixes for MySQL and SMB protocol parsers
* MySQL: the parser for this was generally broken (not following
  the specification well) and needed many changes.  One addition is a
  new "mysql_result_row" event that provides access to the results of
  queries.

* SMB: the spec seems to explitly call out the omission of the
  PrimaryDomain field on SMB_COM_SESSION_SETUP_ANDX responses (and I
  don't see that field in pcaps either), so this may have just been a
  typo that used to work fine in the past only due to faulty array
  parsing behavior in binpac.
2018-05-18 10:31:36 -05:00
Jon Siwek
9c1e20394b BIT-1829: add unit test for modbus parser issue 2018-05-18 09:24:06 -05:00
Pierre LALET
a7fb278710 Add tests for ARP in 802.11 (w & w/o RadioTAP) 2018-05-15 18:15:17 +02:00
Julien Wallior
afac2ac20f Add krb unit test 2018-05-10 10:14:30 -04:00
Jon Siwek
1f777b57b8 BIT-1926: add unit tests for misc. HTTP patches 2018-05-08 15:39:27 -05:00
Jon Siwek
81133f3116 Merge remote-tracking branch 'origin/topic/seth/dhcp-update'
* origin/topic/seth/dhcp-update:
  Rework to the DHCP analyzer.
  First step of DHCP analyzer rearchitecture.
  Add .btest scripts for dhck_ack and dhcp_discover messages verifying that new options are correctly reported in dhcp.log records.
  Extend DHCP protocol analyzer with new options.

BIT-1924 #merged

Additional changes:

* Removed known-hosts.bro as the only thing populating its table was
  the already-removed known-hosts-and-devices.bro.  So a
  known_devices.log will no longer be generated.

* In dhcp-options.pac, the process_relay_agent_inf_option had a memleak
  and also process_auto_proxy_config_option looked like it accessed one
  byte past the end of the available bytestring, so fixed those.
2018-05-01 18:06:41 -05:00
Jon Siwek
10b1857a9c Update &check'd fields in various protocol parsers
* The altered Modbus checks seemed overly strict -- the pcap used
  for the unit test at least had quantities/byte_count fields of
  zero, to which the server responds with an error (expected).

* Most of the altered DNP3 checks seemed overly strict and caused
  the unit tests to fail.  The one that was just wrong was the
  'start' field in header blocks.

* Removed the "start" parameter of the dnp3_header_block event
  since it's always the same value.

* The SMB check failed to compile and I don't know what it intended
  to do, so removed.
2018-04-18 18:16:34 -05:00
Devin Trejo
17202e9df4 Add unit tests for new SMB2 event -- smb2_file_sattr. 2018-04-04 16:55:10 -04:00
Seth Hall
5b07bbe0a5 Merge branch 'gssapi-krb-fix' of https://github.com/jrolli/bro into jrolli-gssapi-krb-fix 2018-04-02 22:28:11 -04:00
Seth Hall
95fbe150df Improving the new SMB2 create command test.
It's now a less fragile test than it was.
2018-04-02 22:25:51 -04:00
Seth Hall
68d0085d35 Merge branch 'smb_changes' of https://github.com/jwallior/bro into jwallior-smb_changes 2018-04-02 17:06:30 -04:00
Johanna Amann
f39efd0317 Recognize TLS 1.3 negotiation correctly.
The way in which TLS 1.3 is negotiated was changed slightly in later
revisions of the standard. The final version is only sent in an
extension - while the version field in the server hello still shows TLS
1.2.

This patch makes ssl.log show the correct version again.
2018-03-27 14:58:06 -07:00
Seth Hall
e76b56ce53 Rework to the DHCP analyzer.
Highlights:
 - Reduced all DHCP events into a single dhcp_message event. (removed legacy events since they weren't widely used anyway)
 - Support many more DHCP options.
 - DHCP log is completely reworked and now represents DHCP sessions
   based on the transaction ID (and works on clusters).
 - Removed the known-devices-and-hostnames script since it's generally
   less relevant now with the updated log.
2018-03-01 08:36:32 -08:00
Robin Sommer
2ecfae8810 Merge remote-tracking branch 'origin/topic/johanna/ssl_signature_details'
Closes BIT-1897.

* origin/topic/johanna/ssl_signature_details:
  Make parsing of ServerKeyExchange work for D(TLS) < 1.2.
  Add more details to ssl_server_signature.
2018-02-05 15:21:28 -08:00
Jon Siwek
4cd9f0edf9 Merge branch 'smb-transaction-messages' of https://github.com/jbencteux/bro
* 'smb-transaction-messages' of https://github.com/jbencteux/bro:
  add test for smb1_com_transaction_response event changes
  add test for smb1_com_transaction2_secondary_request event changes
  add test for smb1_com_transaction2_request event changes
  add test for smb1_com_transaction_secondary_request event changes
  add test for smb1_com_transaction_request event changes
  fix setup field handling in smb1_com_transaction_request messages
  fix smb1_com_transaction* messages
  add smb1_transaction2_secondary_request event
  add smb1_transaction_secondary_request event
  add parameters and data to smb1_transaction_request/response messages
  add SMB_Parameters.Words to smb1_transaction2_request event
2018-02-05 16:33:25 -06:00
Jon Siwek
9603deeb64 Merge branch 'nfs-updates' of https://github.com/dtrejod/bro
* 'nfs-updates' of https://github.com/dtrejod/bro:
  Format print nfs units tests to improve output readability. Add unit tests for new NFS events -- nfs_proc_symlink, nfs_proc_link, nfs_proc_sattr.
  Bug fix: nfs3_writeargs didn't properly return filehandle.
  Add nfs_proc_symlink, nfs_proc_link, nfs_proc_sattr.
2018-02-05 14:15:18 -06:00
Jon Siwek
35fa1261f3 Merge branch 'mount-protocol' of https://github.com/dtrejod/bro
* 'mount-protocol' of https://github.com/dtrejod/bro:
  Add unit tests for new MOUNT events -- mount_proc_mnt, mount_proc_umnt, mount_proc_umnt_all, mount_proc_not_implemented.
  Add mount_proc_null, mount_proc_mnt, mount_proc_umnt, mount_proc_umnt_all, mount_proc_not_implemented, mount_reply_status.
2018-02-05 13:32:36 -06:00
Seth Hall
ba49ab8201 Merge branch 'feature/new_dhcp_data' of https://github.com/Mr-Click/bro into topic/seth/merge-121-dhcp-extensions 2018-02-01 10:06:35 -05:00
Johanna Amann
141394ac9b Merge remote-tracking branch 'origin/master' into topic/johanna/ssl_signature_details 2018-01-26 10:33:18 -08:00
Jeffrey Bencteux
015eec8c71 add test for smb1_com_transaction_response event changes 2018-01-19 14:29:31 +01:00
Jeffrey Bencteux
4c0b6e0984 add test for smb1_com_transaction2_secondary_request event changes 2018-01-19 14:29:26 +01:00
Jeffrey Bencteux
4807b7d847 add test for smb1_com_transaction2_request event changes 2018-01-19 14:29:20 +01:00
Jeffrey Bencteux
314e992284 add test for smb1_com_transaction_secondary_request event changes 2018-01-19 14:29:09 +01:00
Johanna Amann
cd345caadb Merge remote-tracking branch 'origin/master' into topic/johanna/websockets 2018-01-12 10:27:23 -08:00
Jeffrey Bencteux
6d497ea8b0 add test for smb1_com_transaction_request event changes 2018-01-12 13:00:05 +01:00
Devin Trejo
e529268b0a Format print nfs units tests to improve output readability. Add unit
tests for new NFS events -- nfs_proc_symlink, nfs_proc_link,
nfs_proc_sattr.
2018-01-11 17:02:47 -05:00
Devin Trejo
f6cf4a41ff Add unit tests for new MOUNT events -- mount_proc_mnt, mount_proc_umnt,
mount_proc_umnt_all, mount_proc_not_implemented.
2018-01-11 17:00:15 -05:00
Julien Wallior
f165ff943e Expand smb2 unit test. 2018-01-11 15:33:31 -05:00
Valerio G
928e33a7b8 Add .btest scripts for dhck_ack and dhcp_discover messages verifying that new
options are correctly reported in dhcp.log records.
2018-01-08 21:55:24 +01:00
Johanna Amann
8ba5c03538 Do not log SOCKS passwords by default.
This introduces a new option, SOCKS::default_capture_password which can
be used to specify if Socks passwords are logged by default

Like fot FTP/HTTP, this option is set to false by default.

Addresses BIT-1791
2017-12-01 14:36:57 -08:00
Johanna Amann
94f55532f2 Make parsing of ServerKeyExchange work for D(TLS) < 1.2.
Now we only parse the SignatureAndHashalgorithm field in cases where it
is present. This change also takes care to respect SCTs, which do
include the SignatureAndHashalgorithm in their digitally-signed struct,
even when used in protocol versions that do not have the
SignatureAndHashalgorithm in the protocols digitally-signed struct.

I also added tests to make sure this does indeed work with TLS 1.1 - it
turns out that so far we did not have a single TLS 1.1 pcap.
2017-11-30 12:20:45 -08:00
Johanna Amann
88f98489a2 Add more details to ssl_server_signature.
This splits out the signature and the hash algorithm from the actual
signature.
2017-11-28 13:45:50 -08:00
Johanna Amann
577357d509 Small fixes and changes for the recent ssl-keyexchange-event merge.
This commit fixes a few small issues.

* server key exchange parameters are only parsed when a named curve is
  given.

* I removed the ssl-verbose.bro and moved the functionality into the
  testcase.

  The information that we get with these events is likely irrelevant to
  the majority of Bro users; I do not think that we have to ship a
  script that uses them by default. A script like this would be
  something to publish via the Bro package manager instead; this is the
  approach that we have taken with a number of the recent SSL addition.

* I marked the ssl_server_curve event as deprecated. More information is
  contained in the new ssl_ecdh_server_params event.

  This is an events that is probably seldomly (or never) directly used
  by anyone; I plan to completely remove it right after the 2.6 release.
2017-11-28 12:33:27 -08:00
Justin Azoff
43b2b9806e add a max_line_length flag to ContentLine_Analyzer
In ContentLine_Analyzer, prevent excessively long lines being assembled.
The line length will default to just under 16MB, but can be overriden on
a per-analyzer basis.  This is done for the finger,ident, and irc
analyzers.
2017-11-03 16:25:26 -04:00
Vlad Grigorescu
6cbcfbcd49 Merge remote-tracking branch 'origin/master' into topic/vladg/bit-1838 2017-10-05 14:36:45 -05:00
Vlad Grigorescu
d7fbaad024 Add btest for new SSH curve25519 KEX 2017-10-05 14:36:13 -05:00
jrolli
45ee32db49 Added and verified correct test results 2017-09-17 21:25:59 +00:00
John E. Rollinson
9ad93a5077 Initial btest structure 2017-09-17 16:13:10 -04:00
Johanna Amann
1ede6bf7fe Add TLS 1.3 fix and testcase.
It turns out that Chrome supports an experimental mode to support TLS
1.3, which uses a non-standard way to negotiate TLS 1.3 with a server.
This non-standard way to negotiate TLS 1.3 breaks the current draft RFC
and re-uses an extension on the server-side with a different binary
formatting, causing us to throw a binpac exception.

This patch ignores the extension when sent by the server, continuing to
correctly parse the server_hello reply (as far as possible).

From what I can tell this seems to be google working around the fact
that MITM equipment cannot deal with TLS 1.3 server hellos; this change
makes the fact that TLS 1.3 is used completely opaque unless one looks
into a few extensions.

We currently log this as TLS 1.2.
2017-09-09 22:25:49 -07:00
Johanna Amann
eab80c8834 HTTP: Recognize and skip upgrade/websocket connections.
This adds a slight patch to the HTTP analyzer, which recognizez when a connection is
upgraded to a different protocol (using a 101 reply with a few specific headers being
set).

In this case, the analyzer stops further processing of the connection (which will
result in DPD errors) and raises a new event:

event http_connection_upgrade(c: connection, protocol: string);

Protocol contains the name of the protocol that is being upgraded to, as specified in
one of the header values.
2017-08-04 07:04:28 -07:00
Robin Sommer
faa4150154 Merge remote-tracking branch 'origin/topic/johanna/ocsp-sct-validate'
Closes #1830.

* origin/topic/johanna/ocsp-sct-validate: (82 commits)
  Tiny script changes for SSL.
  Update CT Log list
  SSL: Update OCSP/SCT scripts and documentation.
  Revert "add parameter 'status_type' to event ssl_stapled_ocsp"
  Revert "parse multiple OCSP stapling responses"
  SCT: Fix script error when mime type of file unknown.
  SCT: another memory leak in SCT parsing.
  SCT validation: fix small memory leak (public keys were not freed)
  Change end-of-connection handling for validation
  OCSP/TLS/SCT: Fix a number of test failures.
  SCT Validate: make caching a bit less aggressive.
  SSL: Fix type of ssl validation result
  TLS-SCT: compile on old versions of OpenSSL (1.0.1...)
  SCT: Add caching support for validation
  SCT: Add signed certificate timestamp validation script.
  SCT: Allow verification of SCTs in Certs.
  SCT: only compare correct OID/NID for Cert/OCSP.
  SCT: add validation of proofs for extensions and OCSP.
  SCT: pass timestamp as uint64 instead of time
  Add CT log information to Bro
  ...
2017-07-30 08:49:41 -07:00
Johanna Amann
ade9aa219b Better handling of % at end of line. 2017-07-27 22:04:47 -07:00
Johanna Amann
9126376581 Revert "add parameter 'status_type' to event ssl_stapled_ocsp"
This reverts commit 545848d906.

Revert further part of stapled OCSP response handling that probably
never worked.
2017-07-27 15:12:19 -07:00
Johanna Amann
b7a7e45a07 Merge remote-tracking branch 'origin/master' into topic/johanna/ocsp-sct-validate 2017-06-26 11:16:08 -07:00
Jon Siwek
5540b228e5 Merge branch 'nfs_changes' of https://github.com/jwallior/bro
* 'nfs_changes' of https://github.com/jwallior/bro:
  Add nfs unittest. Includes an example for the new nfs_proc_rename.
  Added rename event to rpc/nfs protocol analyzer. 	This event identifies and reports information 	about nfs/rpc calls and replies of the type 	rename.
  Expand parsing of RPC Call packets to add Uid, Gid, Stamp, MachineName and AuxGIDs
  Fix NFS protocol parser.
2017-05-22 20:35:56 -05:00