Skip to content

Commit 00d22f6

Browse files
committedNov 7, 2022
8279164: Disable TLS_ECDH_* cipher suites
Reviewed-by: xuelei, rhalade, wetmore
1 parent d634dde commit 00d22f6

File tree

4 files changed

+45
-94
lines changed

4 files changed

+45
-94
lines changed
 

‎src/java.base/share/conf/security/java.security

+2-1
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,8 @@ http.auth.digest.disabledAlgorithms = MD5, SHA-1
746746
# jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048, \
747747
# rsa_pkcs1_sha1, secp224r1
748748
jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, DTLSv1.0, RC4, DES, \
749-
MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL
749+
MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
750+
ECDH
750751

751752
#
752753
# Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)

‎test/jdk/javax/net/ssl/DTLS/CipherSuite.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
* @run main/othervm CipherSuite TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
4444
* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
4545
* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_GCM_SHA256
46-
* @run main/othervm CipherSuite TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
46+
* @run main/othervm CipherSuite TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 re-enable
4747
* @run main/othervm CipherSuite TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
4848
* @run main/othervm CipherSuite TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
49-
* @run main/othervm CipherSuite TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
49+
* @run main/othervm CipherSuite TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 re-enable
5050
*/
5151

5252
import javax.net.ssl.SSLEngine;

‎test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java

+23-13
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8076221 8211883 8163327
26+
* @bug 8076221 8211883 8163327 8279164
2727
* @summary Check if weak cipher suites are disabled
2828
* @modules jdk.crypto.ec
2929
* @run main/othervm DisabledAlgorithms default
@@ -60,9 +60,8 @@ public class DisabledAlgorithms {
6060
System.getProperty("test.src", "./") + "/" + pathToStores +
6161
"/" + trustStoreFile;
6262

63-
// supported 3DES, DES, RC4, NULL, and anon cipher suites
64-
// it does not contain KRB5 cipher suites because they need a KDC
65-
private static final String[] desede_des_rc4_null_anon_ciphersuites
63+
// disabled 3DES, DES, RC4, NULL, anon, and ECDH cipher suites
64+
private static final String[] disabled_ciphersuites
6665
= new String[] {
6766
"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
6867
"TLS_ECDHE_RSA_WITH_RC4_128_SHA",
@@ -109,7 +108,19 @@ public class DisabledAlgorithms {
109108
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
110109
"TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
111110
"TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
112-
"SSL_RSA_WITH_3DES_EDE_CBC_SHA"
111+
"SSL_RSA_WITH_3DES_EDE_CBC_SHA",
112+
"TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384",
113+
"TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384",
114+
"TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
115+
"TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
116+
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",
117+
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",
118+
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
119+
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
120+
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
121+
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
122+
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
123+
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA"
113124
};
114125

115126
public static void main(String[] args) throws Exception {
@@ -128,9 +139,8 @@ public static void main(String[] args) throws Exception {
128139
System.out.println("jdk.tls.disabledAlgorithms = "
129140
+ Security.getProperty("jdk.tls.disabledAlgorithms"));
130141

131-
// check if 3DES, DES, RC4, NULL, and anon cipher suites
132-
// can't be used by default
133-
checkFailure(desede_des_rc4_null_anon_ciphersuites);
142+
// check that disabled cipher suites can't be used by default
143+
checkFailure(disabled_ciphersuites);
134144
break;
135145
case "empty":
136146
// reset jdk.tls.disabledAlgorithms
@@ -144,9 +154,9 @@ public static void main(String[] args) throws Exception {
144154
System.out.println("jdk.certpath.disabledAlgorithms = "
145155
+ Security.getProperty("jdk.certpath.disabledAlgorithms"));
146156

147-
// check if 3DES, DES, RC4, NULL, and anon cipher suites
148-
// can be used if jdk.{tls,certpath}.disabledAlgorithms is empty
149-
checkSuccess(desede_des_rc4_null_anon_ciphersuites);
157+
// check that disabled cipher suites can be used if
158+
// jdk.{tls,certpath}.disabledAlgorithms is empty
159+
checkSuccess(disabled_ciphersuites);
150160
break;
151161
default:
152162
throw new RuntimeException("Wrong parameter: " + args[0]);
@@ -172,11 +182,12 @@ private static void checkFailure(String[] ciphersuites) throws Exception {
172182
throw new RuntimeException("Expected SSLHandshakeException "
173183
+ "not thrown");
174184
} catch (SSLHandshakeException e) {
175-
System.out.println("Expected exception on client side: "
185+
System.out.println("Got expected exception on client side: "
176186
+ e);
177187
}
178188
}
179189

190+
server.stop();
180191
while (server.isRunning()) {
181192
sleep();
182193
}
@@ -272,7 +283,6 @@ public void run() {
272283
} catch (SSLHandshakeException e) {
273284
System.out.println("Server: run: " + e);
274285
sslError = true;
275-
stopped = true;
276286
} catch (IOException e) {
277287
if (!stopped) {
278288
System.out.println("Server: run: unexpected exception: "

‎test/jdk/javax/net/ssl/sanity/ciphersuites/CheckCipherSuites.java

+18-78
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4750141 4895631 8217579 8163326
26+
* @bug 4750141 4895631 8217579 8163326 8279164
2727
* @summary Check enabled and supported ciphersuites are correct
2828
* @run main/othervm CheckCipherSuites default
2929
* @run main/othervm CheckCipherSuites limited
@@ -50,54 +50,38 @@ public class CheckCipherSuites {
5050
// Not suite B, but we want it to position the suite early
5151
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
5252

53-
// AES_256(GCM) - ECDHE - forward screcy
53+
// AES_256(GCM) - ECDHE - forward secrecy
5454
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
5555
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
5656

57-
// AES_128(GCM) - ECDHE - forward screcy
57+
// AES_128(GCM) - ECDHE - forward secrecy
5858
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
5959

60-
// AES_256(GCM) - DHE - forward screcy
60+
// AES_256(GCM) - DHE - forward secrecy
6161
"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
6262
"TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
6363
"TLS_DHE_DSS_WITH_AES_256_GCM_SHA384",
6464

65-
// AES_128(GCM) - DHE - forward screcy
65+
// AES_128(GCM) - DHE - forward secrecy
6666
"TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
6767
"TLS_DHE_DSS_WITH_AES_128_GCM_SHA256",
6868

69-
// AES_256(CBC) - ECDHE - forward screcy
69+
// AES_256(CBC) - ECDHE - forward secrecy
7070
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
7171
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
7272

73-
// AES_256(CBC) - ECDHE - forward screcy
73+
// AES_256(CBC) - ECDHE - forward secrecy
7474
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
7575
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
7676

77-
// AES_256(CBC) - DHE - forward screcy
77+
// AES_256(CBC) - DHE - forward secrecy
7878
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
7979
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA256",
8080

81-
// AES_128(CBC) - DHE - forward screcy
81+
// AES_128(CBC) - DHE - forward secrecy
8282
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
8383
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA256",
8484

85-
// AES_256(GCM) - not forward screcy
86-
"TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384",
87-
"TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384",
88-
89-
// AES_128(GCM) - not forward screcy
90-
"TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
91-
"TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
92-
93-
// AES_256(CBC) - not forward screcy
94-
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",
95-
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",
96-
97-
// AES_128(CBC) - not forward screcy
98-
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
99-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
100-
10185
// AES_256(CBC) - ECDHE - using SHA
10286
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
10387
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
@@ -114,14 +98,6 @@ public class CheckCipherSuites {
11498
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
11599
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
116100

117-
// AES_256(CBC) - using SHA, not forward screcy
118-
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
119-
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
120-
121-
// AES_128(CBC) - using SHA, not forward screcy
122-
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
123-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
124-
125101
// deprecated
126102
"TLS_RSA_WITH_AES_256_GCM_SHA384",
127103
"TLS_RSA_WITH_AES_128_GCM_SHA256",
@@ -144,16 +120,10 @@ public class CheckCipherSuites {
144120
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
145121
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
146122
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA256",
147-
"TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
148-
"TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
149-
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
150-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
151123
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
152124
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
153125
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
154126
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
155-
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
156-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
157127
"TLS_RSA_WITH_AES_128_GCM_SHA256",
158128
"TLS_RSA_WITH_AES_128_CBC_SHA256",
159129
"TLS_RSA_WITH_AES_128_CBC_SHA",
@@ -175,54 +145,38 @@ public class CheckCipherSuites {
175145
// Not suite B, but we want it to position the suite early
176146
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
177147

178-
// AES_256(GCM) - ECDHE - forward screcy
148+
// AES_256(GCM) - ECDHE - forward secrecy
179149
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
180150
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
181151

182-
// AES_128(GCM) - ECDHE - forward screcy
152+
// AES_128(GCM) - ECDHE - forward secrecy
183153
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
184154

185-
// AES_256(GCM) - DHE - forward screcy
155+
// AES_256(GCM) - DHE - forward secrecy
186156
"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
187157
"TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
188158
"TLS_DHE_DSS_WITH_AES_256_GCM_SHA384",
189159

190-
// AES_128(GCM) - DHE - forward screcy
160+
// AES_128(GCM) - DHE - forward secrecy
191161
"TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
192162
"TLS_DHE_DSS_WITH_AES_128_GCM_SHA256",
193163

194-
// AES_256(CBC) - ECDHE - forward screcy
164+
// AES_256(CBC) - ECDHE - forward secrecy
195165
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
196166
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
197167

198-
// AES_256(CBC) - ECDHE - forward screcy
168+
// AES_256(CBC) - ECDHE - forward secrecy
199169
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
200170
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
201171

202-
// AES_256(CBC) - DHE - forward screcy
172+
// AES_256(CBC) - DHE - forward secrecy
203173
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
204174
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA256",
205175

206-
// AES_128(CBC) - DHE - forward screcy
176+
// AES_128(CBC) - DHE - forward secrecy
207177
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
208178
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA256",
209179

210-
// AES_256(GCM) - not forward screcy
211-
"TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384",
212-
"TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384",
213-
214-
// AES_128(GCM) - not forward screcy
215-
"TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
216-
"TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
217-
218-
// AES_256(CBC) - not forward screcy
219-
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",
220-
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",
221-
222-
// AES_128(CBC) - not forward screcy
223-
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
224-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
225-
226180
// AES_256(CBC) - ECDHE - using SHA
227181
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
228182
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
@@ -239,14 +193,6 @@ public class CheckCipherSuites {
239193
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
240194
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
241195

242-
// AES_256(CBC) - using SHA, not forward screcy
243-
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
244-
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
245-
246-
// AES_128(CBC) - using SHA, not forward screcy
247-
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
248-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
249-
250196
// deprecated
251197
"TLS_RSA_WITH_AES_256_GCM_SHA384",
252198
"TLS_RSA_WITH_AES_128_GCM_SHA256",
@@ -269,16 +215,10 @@ public class CheckCipherSuites {
269215
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
270216
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
271217
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA256",
272-
"TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
273-
"TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
274-
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
275-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
276218
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
277219
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
278220
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
279221
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
280-
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
281-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
282222
"TLS_RSA_WITH_AES_128_GCM_SHA256",
283223
"TLS_RSA_WITH_AES_128_CBC_SHA256",
284224
"TLS_RSA_WITH_AES_128_CBC_SHA",

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Nov 7, 2022

@openjdk-notifier[bot]
Please sign in to comment.