Commit graph

57 commits

Author SHA1 Message Date
Johanna Amann
7c48aad582 Update DTLS error handling
DTLS now only outputs protocol violations once it saw something that
looked like a DTLS connection (at least a client hello). Before the
danger that it misinterprets something is too high.

It has a configurable number of invalid packets that it can skip over
(because other protocols might be interleaved with the connection) and a
maximum amount of Protocol violations that it outputs because of wrong
packet versions.
2019-04-04 12:27:42 -07:00
Johanna Amann
23eb8096fc SSL: test updates for record_layer version
Update the tests to also include the recently included record layer
fields.
2018-08-28 11:02:20 -07:00
Johanna Amann
b2a0418dc5 Final touches to SSL events with record layer version. 2018-08-23 14:18:38 -07:00
Johanna Amann
b1dbd757a6 Merge remote-tracking branch 'origin/master' into topic/johanna/tls-more-data 2018-08-17 11:52:00 -07:00
Jon Siwek
bb55f82809 Remove requestorName parameter of ocsp_request event
This field isn't publicly available via the OpenSSL 1.1 API, not used
in the base scripts, and has no example in the test suit, so removing
it is simpler than trying to support manually parsing it out of the
raw data.
2018-06-29 16:15:34 -05:00
Johanna Amann
a891517762 Fix read at invalid address in X509 extension parser.
When encountering an extension unknown to OpenSSL, we would read from
the wrong memory location. Also added a testcase to prevent this specific
case from happening again.
2018-06-04 12:05:56 -07: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
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
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
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
61906fe7fb Merge branch 'topic/johanna/tls13-extensions' into topic/johanna/ocsp-sct-validate 2017-04-05 12:04:15 -07:00
Johanna Amann
6c9449c780 Add support for two TLS 1.3 extensions.
New events:

event ssl_extension_supported_versions(c: connection, is_orig: bool, versions: index_vec)

event ssl_extension_psk_key_exchange_modes(c: connection, is_orig: bool, modes: index_vec)
2017-04-05 11:55:40 -07:00
Johanna Amann
0cd0ffed13 SSL: update dpd signature for TLS1.3
The dpd signature missed a few cases that are used for TLS 1.3,
especially when draft versions (which are all that we are seeing at the
moment) are being negotiated.

This fix mostly allows draft versions in the server hello (identified by
7F[version]; since we do not know how many drafts there will be, we are
currently allowing a rather safe upper limit.
2017-04-05 08:58:08 -07:00
Johanna Amann
c403a7f4e6 SCT: add validation of proofs for extensions and OCSP.
This does not yet work for certificates, because this requires some
changing the ASN.1 structure before validation (we need to extract the
tbscert and remove the SCT extension before).

API will change in the future.
2017-03-29 09:04:05 -07:00
Johanna Amann
d50bddfbfb SCT: pass timestamp as uint64 instead of time
For verification, we need the exact uint64 as it was seen on the wire;
converting it to a double might mean that we loose precision.
2017-03-16 18:18:39 -07:00
Johanna Amann
dcf4907857 Add CT log information to Bro
This commit add the table SSL::ct_logs to Bro. This table is populated
with information about the currently active certificate transparency
logs (data from Google). The data can, e.g., be used to identify which
Logs are being used in SCTs.
2017-03-16 13:50:32 -07:00
Johanna Amann
c431d14eed OCSP: re-enable logging, fix tests, fix x509 issue
Re-enable logging, now in policy because it probably is interesting to
no-one. We also only log ocsp replies.

Fix all tests.

Fix an issue where ocsp replies were added to the x.509 certificate
list.
2017-02-10 17:05:12 -08:00
Johanna Amann
b061a5db1a Merge branch 'topic/johanna/signed_certificate_timestamp' into topic/johanna/ocsp-new 2017-02-10 17:04:50 -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
c92bf9bad2 Introduce ssl_plaintext_data event.
This event is the replacement for ssl_application_data, which is removed
in the same commit. It is more generic, containing more information than
ssl_application_dataand is raised for all SSL/TLS messages that are
exchanged before encryption starts.

It is used by Bro internally to determine when a TLS1.3 session has been
completely established. Apart from that, it can be used to, e.g.,
determine the record layer TLS version.
2017-02-03 13:58:26 -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
Johanna Amann
f721c74bad Add compression methods to ssl_client_hello event.
This change adds compression methods to the ssl_client_hello event. It
not being included was an oversight from a long time ago.

This change means that the signature of ssl_client_hello changes
slightly and scripts will have to be adjusted; since this is a commonly
used event, the impact of it might be higher than usually for event
changes.
2017-02-03 11:48:55 -08:00
Johanna Amann
3882ba6fbf Add support for the signed_certificate_timestamp TLS extension. 2017-02-03 11:23:49 -08:00
Johanna Amann
fdef28ce7c TLS 1.3 support.
Well, at least -draft-16, and we don't quite parse all extensions yet
(not that there is that much left to parse).
2016-10-07 12:51:43 -07:00
Johanna Amann
11ec4903ee SSL: add support for signature_algorithms extension. 2016-07-11 15:01:59 -07:00
Johanna Amann
39bdc397a0 DTLS: Fix interaction with STUN
Now the DTLS analyzer cleanly skips all STUN messages; no warnings
should be logged to dpd.log and parsing should work flawlessly with
intermixed STUN messages.
2016-05-17 16:36:46 -07:00
Johanna Amann
a88b32ca03 Add testcase for CVE-2015-3194 2016-01-19 14:45:52 -08:00
Johanna Amann
da9b5425e4 Merge remote-tracking branch 'origin/master' into topic/johanna/ocsp 2015-12-14 16:05:41 -08:00
Johanna Amann
401e6c9102 Extend ssl dpd signature to allow alert before server_hello.
The alert in this case is caused by the server name in the SNI not being
recognized by the server, which triggers an alert. Since the server is
an apache, and this might happen reasonably often, the new signature
allows one TLS alert before the server hello is expected.
2015-10-22 13:36:21 -07:00
Liang Zhu
1989f34a0a add parsing certificates in OCSP responses 2015-08-18 19:35:43 -07:00
Liang Zhu
1abd41c413 copy paste error 2015-07-31 13:50:48 -07:00
Liang Zhu
61f7276c80 parse revocation time and reason in ocsp response 2015-07-31 13:39:25 -07:00
Liang Zhu
fc35ab9bf5 add a btest for ocsp http get 2015-07-15 01:30:46 -07:00
Liang Zhu
545848d906 add parameter 'status_type' to event ssl_stapled_ocsp 2015-07-08 14:11:14 -07:00
Liang Zhu
d1c568663c add btest and fix bug 2015-06-19 09:37:10 -07:00
Johanna Amann
236a895418 Update mozilla CA list.
This also patches a few tests to contain certificates that were removed.
Furthermore, we include the old CA file with the external tests and load
it automatically. Those traces are kind of old now, more and more of the
CAs in them are no longer valid and it does not really make sense to
update them on each change...
2015-04-14 16:40:41 -07:00
Johanna Amann
991e4f5dc3 DTLS working.
The only thing that is missing is a signature to detect the protocol (it
has no well-known port).

Reassembly is kind of fidgety - at the moment we only support
re-assembling one simultaneous message per direction (which looking at
our test-traffic might not be a problem). And I am not quite sure if I
got all cases correct...

But - it works :)
2015-03-12 15:46:17 -07:00
Johanna Amann
ba27bb54d4 Implement correct parsing of TLS record fragmentation.
Finally. Our test-case is a >400kb certificate with 10,000 alternative
names. :)
2015-03-11 18:23:08 -07:00
Johanna Amann
e48c6ccc4a Do not log common name by default (it is most interesting for scripts)
and add a test case.
2015-03-03 16:38:25 -08:00
Johanna Amann
cd21b7f130 Fix x509 analyzer to correctly return ecdsa as the key_type for ecdsa certs.
Returned dsa so far.

Bug found by Michał Purzyński
2014-11-25 11:18:07 -08:00
Bernhard Amann
67c0cc118d Add two more ssl events - one triggered for each handshake message and one
triggered for the tls change cipherspec message.

Also - fix small bug. In case SSL::disable_analyzer_after_detection was set
to F, the ssl_established event would fire after each data packet after the
session is established.
2014-06-06 12:50:54 -07:00
Bernhard Amann
55d0c6f7fa Implement verification of OCSP replies.
The OpenSSL code to do that is a nightmare.
2014-05-16 10:32:08 -07:00
Bernhard Amann
fb56b22cff Add DH support to SSL analyzer.
When using DHE or DH-Anon, sever key parameters are now available
in scriptland.

Also add script to alert on weak certificate keys or weak dh-params.
2014-04-26 23:52:51 -07:00
Bernhard Amann
597c373fa0 Log chosen curve when using ec cipher suite in TLS. 2014-04-26 09:48:36 -07:00
Bernhard Amann
c24629abf4 Add very basic ocsp stapling support.
This only allows access to the ocsp stapling response data. No verification
or anything else at the moment.
2014-04-24 12:37:34 -07:00
Bernhard Amann
9b7eb293f1 Add documentation, consts and tests for the new events.
This also fixes the heartbleed detector to work for encrypted attacks in this
branch again. It stopped working, because the SSL analyzer now successfully detects
established connections, and the scripts usually disable analyzing after that.

(The heartbeat branch should not have been affected)
2014-04-24 12:05:30 -07:00
Bernhard Amann
5d9fb1631c test for new ssl/tls dpd signature 2014-04-10 14:33:14 -07:00
Bernhard Amann
4da0718511 Finishing touches of the x509 file analyzer.
Mostly baseline updates and new tests.

addresses BIT-953, BIT-760, BIT-1150
2014-03-13 15:21:30 -07:00