Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

"sunsetsha1" handler detecting TLS certificates using SHA-1 expiring during or after sunset period#78

Open
mkenne11 wants to merge 1 commit intogoogle:devfrom
mkenne11:sunsetsha1
Open

"sunsetsha1" handler detecting TLS certificates using SHA-1 expiring during or after sunset period#78
mkenne11 wants to merge 1 commit intogoogle:devfrom
mkenne11:sunsetsha1

Conversation

@mkenne11
Copy link

A "sunsetsha1" handle was added to test for certificates using the SHA-1 signature algorithm and that expire during or after the Google Chrome SHA-1 sunset period. Changes were made to the mitm daemon and Android client for this handler.

See Chromium blog post for more details:
http://blog.chromium.org/2014/09/gradually-sunsetting-sha-1.html

@mkenne11
Copy link
Author

This request is intended to address issue #60.

@chadbrubaker
Copy link
Contributor

This should probably be a data handler with the rest of the TLS check stuff in https://github.com/google/nogotofail/blob/dev/nogotofail/mitm/connection/handlers/data/ssl.py, once #83 lands you can get the Certificate chain bytes pretty easily and then check in a passive handler.

Also I should add a data handler that handles buffering/parsing TLS records since we're currently duplicating a lot of code. I'll file a blocking issue :)

@mkenne11 mkenne11 force-pushed the sunsetsha1 branch 2 times, most recently from 43b0469 to 241d204 Compare September 9, 2015 11:23
@mkenne11
Copy link
Author

mkenne11 commented Sep 9, 2015

I changed the sunsetsha1 handler to be a data handler and passive. I also modified it to parse the certificate chain bytes (the new handshake "Certifcate" class) when checking the certs signing algorithm.

I am accessing the Certificate.certificates list to check each cert in the chain of trust. I was hoping to access the certificate attributes using the OpenSSL API attributes (e.g. .get_signature_algorithm()). Is the a way of casting the each cert byte string to a OpenSSL certificate type? Or maybe I'm off track ...

Here's the current handler commit with the relevant line highlighted. Thanks in advance.
https://github.com/mkenne11/nogotofail/blob/241d204cb218e48576509f17c2df5743394e021a/nogotofail/mitm/connection/handlers/data/ssl.py#l130

@mkenne11 mkenne11 force-pushed the sunsetsha1 branch 4 times, most recently from 6fcad97 to e98150a Compare September 10, 2015 12:05
@mkenne11
Copy link
Author

It's OKI worked out how to cast a certificate byte string to a pyOpenSSL certificate object.

When checking the signature algorithm of each certificate in the chain - do I need to check the algorithm for just the first certificate? Or the signature of the intermediate certificates and root certificate as well?

I assume I only need to check the signing algorithm of the first cert in the certificates list (index 0) which signs the encrypted message - but I'm happy to be told otherwise :)

@chadbrubaker
Copy link
Contributor

Probably best to only go with the leaf cert.
On Thu, Sep 10, 2015 at 5:22 AM Michael Kennedy notifications@github.com
wrote:

It's OKI worked out how to cast a certificate byte string to a pyOpenSSL
certificate object.

When checking the signature algorithm of each certificate in the chain -
do I need to check the algorithm for just the first certificate? Or the
signature of the intermediate certificates and root certificate as well?

I assume I only need to check the signing algorithm of the first cert in
the certificates list (index 0) which signs the encrypted message - but I'm
happy to be told otherwise :)


Reply to this email directly or view it on GitHub
#78 (comment).

@mkenne11 mkenne11 force-pushed the sunsetsha1 branch 2 times, most recently from cfdfa0a to 8ee21f9 Compare September 15, 2015 13:07
@mkenne11
Copy link
Author

Thanks Chad. I revised the handler to check only the leaf node for use of SHA-1 during or after the sunset period.

I'll keep an eye out for the data handler that handles buffering/parsing of TLS records to land, then finalize this handler as well the noforwardsecrecy handler (PR # 79).

@mkenne11 mkenne11 changed the title Added handler "sunsetsha1" to test TLS SHA-1 certificates expiring during or after SHA-1 sunset dates "sunsetsha1" handler detecting TLS certificates using SHA-1 expiring during or after sunset period Sep 27, 2015
@mkenne11 mkenne11 force-pushed the sunsetsha1 branch 4 times, most recently from 73dc7e3 to d6e79fb Compare December 1, 2015 11:30
@mkenne11
Copy link
Author

mkenne11 commented Dec 1, 2015

I changed the sha-1 handler to use the new TlsRecordHandler.

I also included a change to exclude compiled Android client and test harness files (APKs) from Git, by including these in the project .gitignore files. I built the projects in Android Studio and the default build path "app/" where the APKs are created.

It worked fine for me in testing - please let me know if you spot any issues. Happy to fix :)

@mkenne11
Copy link
Author

mkenne11 commented Dec 1, 2015

Firefox is alerting on intermediate certificates using SHA-1 which expire after the sunset date.
https://blog.mozilla.org/security/2015/10/20/continuing-to-phase-out-sha-1-certificates/

Currently I'm only alerting when the leaf certificate uses SHA-1 after this date. Do you think there is much value in alerting on intermediate certificates as well?

@mkenne11
Copy link
Author

I added alerts for intermediate certificates who use SHA-1 as the signature signing algorithm. I noticed both Firefox and SSL Labs alerts on intermediate certificates.

I raised the intermediate certificate alerts as a WARNING as the risk to the client should be small. I believe for an attacker to exploit this vulnerability they would need to have a cert with the same (SHA-1) hash value as the intermediate cert and convince the root CA to sign it (but I'm not an expert :) ).

The new handler "sunsetsha1" detects TLS certificates using the SHA-1 signature algorithm which expire during or after the Google Chrome SHA-1 sunset period. See Google security blog entry:
https://googleonlinesecurity.blogspot.com.au/2014/09/gradually-sunsetting-sha-1.html.

Note. The signature algorithm is checked for the "leaf" and "intermediate" certificates in the chain.
@mkenne11
Copy link
Author

Improved variable name consistency.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants