-
Notifications
You must be signed in to change notification settings - Fork 667
Bug 1777129: Birthday attack against 64-bit block ciphers [Release-4.4] #3389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-robot
merged 1 commit into
openshift:master
from
benjaminapetersen:bug/1745431/birthday-attack-64-bit-ciphers
Dec 5, 2019
+112
−3
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package crypto | ||
|
|
||
| // this file is copied over from: | ||
| // https://github.com/openshift/library-go/blob/11013d437d762f00827c7e80d18b0a7b0abc07bd/pkg/crypto/crypto.go#L122 | ||
| // we may want to consider importing library-go and using this package | ||
| // directly as we would gain any effort maintaining this list. | ||
| import ( | ||
| "crypto/tls" | ||
| ) | ||
|
|
||
| func DefaultCiphers() []uint16 { | ||
| // HTTP/2 mandates TLS 1.2 or higher with an AEAD cipher | ||
| // suite (GCM, Poly1305) and ephemeral key exchange (ECDHE, DHE) for | ||
| // perfect forward secrecy. Servers may provide additional cipher | ||
| // suites for backwards compatibility with HTTP/1.1 clients. | ||
| // See RFC7540, section 9.2 (Use of TLS Features) and Appendix A | ||
| // (TLS 1.2 Cipher Suite Black List). | ||
| return []uint16{ | ||
| tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, | ||
| tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, | ||
| tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, | ||
| tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, // required by http/2 | ||
| tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, | ||
| tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, | ||
| tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, // forbidden by http/2, not flagged by http2isBadCipher() in go1.8 | ||
| tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, // forbidden by http/2, not flagged by http2isBadCipher() in go1.8 | ||
| tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, // forbidden by http/2 | ||
| tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, // forbidden by http/2 | ||
| tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, // forbidden by http/2 | ||
| tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, // forbidden by http/2 | ||
| tls.TLS_RSA_WITH_AES_128_GCM_SHA256, // forbidden by http/2 | ||
| tls.TLS_RSA_WITH_AES_256_GCM_SHA384, // forbidden by http/2 | ||
| // the next one is in the intermediate suite, but go1.8 http2isBadCipher() complains when it is included at the recommended index | ||
| // because it comes after ciphers forbidden by the http/2 spec | ||
| // tls.TLS_RSA_WITH_AES_128_CBC_SHA256, | ||
| // tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, // forbidden by http/2, disabled to mitigate SWEET32 attack | ||
| // tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, // forbidden by http/2, disabled to mitigate SWEET32 attack | ||
| tls.TLS_RSA_WITH_AES_128_CBC_SHA, // forbidden by http/2 | ||
| tls.TLS_RSA_WITH_AES_256_CBC_SHA, // forbidden by http/2 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/bin/bash | ||
|
|
||
| CONSOLE_URL=$(oc get console.config.openshift.io cluster --template '{{.status.consoleURL}}') | ||
| if [ -z "${CONSOLE_URL}" ] | ||
| then | ||
| echo "no console_url, are you connected to a cluster?" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # need to format the console_url for s_client | ||
| CONSOLE_URL_WITHOUT_HTTP=${CONSOLE_URL#"https://"} | ||
| SERVER="${CONSOLE_URL_WITHOUT_HTTP}:443" | ||
|
|
||
| ROUTER_CA=$(oc get configmap router-ca -n openshift-config-managed -o json | jq -r '.data["ca-bundle.crt"]') | ||
| echo "$ROUTER_CA" > /tmp/router-ca-file.txt | ||
|
|
||
| # CIPHER=ECDHE-ECDSA-CHACHA20-POLY1305 # DENIED | ||
| VALID_CIPHER_SAMPLE=( | ||
| ECDHE-RSA-AES128-GCM-SHA256 | ||
| ECDHE-RSA-AES256-GCM-SHA384 | ||
| ) | ||
|
|
||
| for CIPHER in "${VALID_CIPHER_SAMPLE[@]}" | ||
| do | ||
| RESULT=$(openssl s_client -connect "${SERVER}" -cipher "${CIPHER}" -CAfile /tmp/router-ca-file.txt 2>&1) | ||
| if [[ $? -eq 0 ]] | ||
| then | ||
| echo "valid cipher was correctly accepted (${CIPHER})" | ||
| else | ||
| echo "valid cipher suite was denied (${CIPHER})" | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
|
|
||
| # ensure we ignore weak ciphers | ||
| # CBC (cipher block chaining) are no longer reliable and should not be used | ||
| # CBC ciphers use an IV (initialization vector) and a chaining mechanism. | ||
| # The chaining mechanism means that a single bit error in a ciphertext block | ||
| # will invalidate all previous blocks. The chaining was good in that it hides | ||
| # plaintext patterns, but is inferior to other cipher modes. | ||
| INVALID_CIPHER_SAMPLE=( | ||
| RSA-AES-128-CBC-SHA256 | ||
| ECDHE-RSA-3DES-EDE-CBC-SHA # disabled to mitigate SWEET32 attack | ||
| RSA-3DES-EDE-CBC-SHA # disabled to mitigate SWEET32 attack | ||
| ) | ||
|
|
||
| for CIPHER in "${INVALID_CIPHER_SAMPLE[@]}" | ||
| do | ||
| RESULT=$(openssl s_client -connect "${SERVER}" -cipher "${CIPHER}" -CAfile /tmp/router-ca-file.txt 2>&1) | ||
| if [[ $? -eq 0 ]] | ||
| then | ||
| echo "invalid cipher suite used to connect to console (${CIPHER})" | ||
| exit 1 | ||
| else | ||
| echo "invalid cipher was correctly denied (${CIPHER})" | ||
| fi | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.