Commit graph

394 commits

Author SHA1 Message Date
Robin Sommer
fe7e1ee7f0 Merge topic/actor-system throug a squashed commit. 2018-05-18 22:39:23 +00: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
181b36cafb Merge remote-tracking branch 'origin/topic/seth/smb-pending-fix'
* origin/topic/seth/smb-pending-fix:
  Updating the defined SMB2 dialects to match Microsofts current docs.
  On rare occasions the server doesn't return the tree id on read responses.
  Fix an issue with pending commands.

BIT-1862 #merged
2018-04-18 10:48:03 -05:00
Seth Hall
9c85d3f3a9 On rare occasions the server doesn't return the tree id on read responses.
This tracks the tree id given by the request

This also addresses BIT-1862 with code submitted by Stefano Rinaldi
and took some hints from his changes in other areas of the code.
2018-04-05 17:12:33 -04:00
Devin Trejo
868cb5838d Add smb2_file_sattr 2018-04-04 14:40:43 -04:00
Seth Hall
31223caccd Fix an issue with pending commands.
This is a change from Stefano Rinaldi in ticket number 1862
2018-04-03 03:24:50 -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
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
Julien Wallior
a76e50d2e1 Change smb2_create_response event arguments to single response struct.
Added disposition and create_action fields.
2018-01-11 15:33:21 -05:00
Julien Wallior
f041c97cdc Change smb2_create_request event arguments to single request struct.
Added disposition and create_option fields.
2018-01-11 15:32:55 -05:00
Valerio G
18499fd7d9 Extend DHCP protocol analyzer with new options.
Add the folowing option types:
- 55 Parameters Request List;
- 58 Renewal time;
- 59 Rebinding time;
- 61 Client Identifier;
- 82 Relay Agent Information.

Extend the following events with new parameters, specifically:
- dhcp_discover exports client identifier and parameters request list;
- dhcp_request exports client_identifier and parameters request list;
- dhcp_ack exports rebinding time, renewal time and list of suboptions value of
  dhcp relay agent information option;
- dhcp_inform exports parameters request list.

Add option type specific variables within the scope of DHCP module
(see src/analyzer/protocol/dhcp/types.bif).

Move protocol specific variables "dhcp_msg" and "dhcp_router_list" from scope Global to DHCP::
and adapt inet_net_var in src/NetVar.cc consequently.

Extend src/analyzer/protocols/dhcp/main.bro to handle the new events and to log
dhcp_ack, dhcp_request and dhcp_discover.

Modify scripts/policy/protocols/dhcp/known-devices-and-hostnames.bro to
include new events' variables.
2018-01-08 21:53:58 +01:00
Jeffrey Bencteux
bd72710e3b add parameters and data to smb1_transaction_request/response messages
expose SMB_Data.Trans_Parameters and SMB_Data.Trans_Data fields of
SMB_COM_TRANSACTION (0x25) message type. See MS-CIFS section
2.2.4.33.1.

These fields are exposed to the script level as Bro strings. Note that
this commit also expose a new event smb1_transaction_response.
2017-12-07 10:01:13 +01:00
Jeffrey Bencteux
f2c3a9495d add SMB_Parameters.Words to smb1_transaction2_request event
expose the fields contained in SMB_Parameters.Words of the
SMB_COM_TRANSACTION2 (0x32) message to the script language. See
MS-CIFS section 2.2.46.1.
2017-12-07 10:00:55 +01: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
db15773c09 Tiny script changes for SSL.
log-hostcerts-only relied on old event ordering; the identifier key of
validate-certs is now shorter (no function change, just potentially a
tiny bit faster).
2017-07-28 09:21:35 -07:00
Johanna Amann
9594f69598 SSL: Update OCSP/SCT scripts and documentation. 2017-07-27 16:22:40 -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
0107ad6c31 Merge branch 'topic/johanna/ocsp-sct-validate' of ssh://git.bro.org/bro into topic/johanna/ocsp-sct-validate 2017-05-14 08:07:18 -07:00
Johanna Amann
eb50b3fed1 Change end-of-connection handling for validation
Move from using CCS (before: established) to just doing certificate
validation at the end of the connection.

This is (again) more robust in the case of aborted connection. I am
moving this into a hook because of the complexity of the
end-of-connection handling for SSL.

This should probably be extended to not just handle SSL validation, but
all other logging constructs that are currently called in _established.
2017-05-11 22:50:20 -07:00
Johanna Amann
876f492a35 OCSP/TLS/SCT: Fix a number of test failures.
These were caused by earlier code updates.

This commit also removes the ocsp stapling logging script; it was
defunctional and the information provided by it wnever really has been
especially interesting.
2017-05-06 08:01:20 -07:00
Johanna Amann
a334247478 SCT Validate: make caching a bit less aggressive.
This triggers a re-validation of the SCT when the certificate validation
status changed. This means that a SCT will show as valid if the
certificate chain could be validated and can now be used to determine
the correct issuer key hash.
2017-05-03 22:06:24 -07:00
Johanna Amann
d531a5405a SSL: Fix type of ssl validation result 2017-03-29 12:40:14 -07:00
Johanna Amann
aec62aeee9 SCT: Add caching support for validation 2017-03-29 09:17:30 -07:00
Johanna Amann
22b1eda472 SCT: Add signed certificate timestamp validation script.
This also rewrites the certificate validation script (which we need for
this) slightly.

This could need a bit of caching, but should generally work very
reliably.
2017-03-29 09:17:30 -07:00
Johanna Amann
115a676d08 SCT: Allow verification of SCTs in Certs.
This is much more complex than the TLS Extension/OCSP cases. We need to
first alter the certificate and remove the extension from it, before
extracting the tbscert. Furthermore, we need the key hash of the issuing
certificate to be able to validate the proof - which means that we need
a valid certificate chain.

Missing: documentation, nice integration so that we can just add a
script and use this in Bro.
2017-03-29 09:17:24 -07:00
Johanna Amann
7aa219758c Merge remote-tracking branch 'origin/master' into topic/johanna/ocsp-new 2017-03-16 12:28:08 -07:00
Seth Hall
0b8b76cfab Refactor base krb scripts and update tests. 2017-02-18 13:55:39 -05:00
Johanna Amann
9c6cebf324 OCSP: a bunch of whitespace fixes 2017-02-10 17:03:04 -08:00
Johanna Amann
c670613996 Make OCSP analyzer part of the X.509 analyzer
This allows the easier integration of shared functionality. And it also
makes logical sense, given that OCSP is not interesting without X.509.
2017-02-10 17:02:15 -08:00
Johanna Amann
dfc871f831 Merge remote-tracking branch 'origin/master' into topic/johanna/ocsp 2017-02-08 10:35:12 -08:00
Johanna Amann
c05e07cc90 Add record layer version to event ssl_encrypted_data.
This exposes the record layer version of the fragment in addition to the
content type and the length. The ordering of the arguments in the event
is the same as the ordering in the protocol message (first type, then
version, then length).

This also includes a slight change to the analyzer, no longer calling
the generate function if the event is not used.
2017-02-03 13:45:40 -08:00
John E. Rollinson
7caf507163 Add script to log ticket hashes in krb log 2017-01-29 09:40:11 +09:00
Johanna Amann
e3c7bcbb43 Add missing paths to SMM Log::create_streams calls 2017-01-12 13:45:39 +01:00
Daniel Thayer
475682ba7f Fix minor typos in documentation
Some of these fixes are for broken links in the auto-generated docs.
2016-11-14 09:50:19 -06:00
Daniel Thayer
5745213326 Fix minor typos in documentation of various scripts 2016-11-11 14:08:17 -06:00
Seth Hall
5832b872c2 Removed some files that aren't being used.
- I went ahead and finished implementing smb2 tree_disconnect.
   This made it possible to address an edge case when packet
   loss occurs.
 - Fixes BIT-1721
2016-11-01 15:56:15 -04:00
Seth Hall
4f3fe047f4 SMB fixes and cleanup.
SMB error handling improved. The analyzer isn't destroyed when a problem
is encoutered anymore.  The flowbuffer in the parser is now flushed and
the analyzer is set to resync against an SMB command.  This was needed
because there is some state about open files that is kept within the
parser itself which was being destroyed and that was causing analysis
after content gaps or parse errors to be faulty.  The new mechanism
doesn't detroy the parser so parsing after gaps is improved.

DCE_RPC handling in SMB is improved in the edge case where a drive
mapping isn't seen. There is a new const named SMB::pipe_filenames
which is used as a heuristic for identifying "files" opened on named
pipe shares.  If the share mapping type isn't known and a filename
in this set is found, the share type will change to "PIPE" by
generating an event named "smb_pipe_connect_heuristic".  Reads and
writes to that file will be sent to the DCE_RPC analyzer instead of
to the files framework.

The concept of "unknown" share types has been removed due to the new
heuristic detection of share types.

Some general clean up of how the SMB cmd log is written and when.
2016-10-31 13:35:47 -04:00
Johanna Amann
38f6ca87ae Merge remote-tracking branch 'origin/topic/dnthayer/ticket1720'
BIT-1720 #merged

* origin/topic/dnthayer/ticket1720:
  Added missing README files for documentation
  List new log files in the log-files.rst document
2016-10-13 14:09:44 -07:00
Daniel Thayer
23a5f83c94 Added missing README files for documentation
These are the one-line script package descriptions.
2016-10-10 22:55:50 -05:00
Seth Hall
b55c4e61db Tiny fix for a DCE_RPC script issue.
Fixes BIT-1688 (or at least should)
2016-10-08 10:58:11 -04:00
Robin Sommer
a87083233e Merge remote-tracking branch 'origin/topic/jazoff/ticket-1670'
BIT-1670 #merged

* origin/topic/jazoff/ticket-1670:
  Ensure that the notice uid field is filled in.
  Move lookup_addr when statement
2016-09-27 11:38:08 -07:00
Justin Azoff
c74218568a Ensure that the notice uid field is filled in. 2016-09-19 22:11:31 -04:00
Johanna Amann
077a5cbda8 Remove old ack_above_hole event from scripts.
Fixes BIT-1673
2016-08-19 07:26:34 -07:00
Justin Azoff
f9b3f739e4 Move lookup_addr when statement
Move the when statement to a function so that the connection record is
not in scope. Cloning a connection record is an expensive operation and
this avoids it and this avoids it.
2016-08-17 10:41:41 -04:00
Seth Hall
117b5c3ac7 Lots of SMB1 parsing fixes. 2016-08-08 15:36:07 -04:00
Seth Hall
44496922f1 Add rename and delete events for SMB2. 2016-07-28 08:55:15 -04:00
Robin Sommer
781fdfa5ba Merge remote-tracking branch 'origin/topic/seth/smb' into topic/robin/smb-merge 2016-07-07 10:41:31 -07:00
Seth Hall
cfe3bddd75 Fixing SMB tests again. 2016-06-28 11:03:16 -04:00
Seth Hall
91161f790c SMB test clean up and docs 2016-06-28 10:30:41 -04:00
Johanna Amann
743d4672bd SMTP does not need to pull in the notice framework.
This caused test baseline changes in one of the test: notice now ties in
netcontrol due to ACTION_DROP. Catch and release uses the new_connection
event, which was not before triggered and can cause uids to be generated
for connections that are not usually assigned uids in bare mode.
2016-06-23 13:22:16 -07:00