Skip to content

Commit 03d13c0

Browse files
committed
Issues #27850 and #27766: Remove 3DES from ssl default cipher list and add ChaCha20 Poly1305.
1 parent cbef66d commit 03d13c0

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

Doc/library/ssl.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ purposes.
279279

280280
RC4 was dropped from the default cipher string.
281281

282+
.. versionchanged:: 3.5.3
283+
284+
ChaCha20/Poly1305 was added to the default cipher string.
285+
286+
3DES was dropped from the default cipher string.
287+
282288

283289
Random generation
284290
^^^^^^^^^^^^^^^^^

Lib/ssl.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -157,36 +157,42 @@ def _import_symbols(prefix):
157157
else:
158158
CHANNEL_BINDING_TYPES = []
159159

160+
160161
# Disable weak or insecure ciphers by default
161162
# (OpenSSL's default setting is 'DEFAULT:!aNULL:!eNULL')
162163
# Enable a better set of ciphers by default
163164
# This list has been explicitly chosen to:
164165
# * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE)
165166
# * Prefer ECDHE over DHE for better performance
166-
# * Prefer any AES-GCM over any AES-CBC for better performance and security
167+
# * Prefer AEAD over CBC for better performance and security
168+
# * Prefer AES-GCM over ChaCha20 because most platforms have AES-NI
169+
# (ChaCha20 needs OpenSSL 1.1.0 or patched 1.0.2)
170+
# * Prefer any AES-GCM and ChaCha20 over any AES-CBC for better
171+
# performance and security
167172
# * Then Use HIGH cipher suites as a fallback
168-
# * Then Use 3DES as fallback which is secure but slow
169-
# * Disable NULL authentication, NULL encryption, and MD5 MACs for security
170-
# reasons
173+
# * Disable NULL authentication, NULL encryption, 3DES and MD5 MACs
174+
# for security reasons
171175
_DEFAULT_CIPHERS = (
172-
'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:'
173-
'DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:'
174-
'!eNULL:!MD5'
175-
)
176+
'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:'
177+
'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:'
178+
'!aNULL:!eNULL:!MD5:!3DES'
179+
)
176180

177181
# Restricted and more secure ciphers for the server side
178182
# This list has been explicitly chosen to:
179183
# * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE)
180184
# * Prefer ECDHE over DHE for better performance
181-
# * Prefer any AES-GCM over any AES-CBC for better performance and security
185+
# * Prefer AEAD over CBC for better performance and security
186+
# * Prefer AES-GCM over ChaCha20 because most platforms have AES-NI
187+
# * Prefer any AES-GCM and ChaCha20 over any AES-CBC for better
188+
# performance and security
182189
# * Then Use HIGH cipher suites as a fallback
183-
# * Then Use 3DES as fallback which is secure but slow
184-
# * Disable NULL authentication, NULL encryption, MD5 MACs, DSS, and RC4 for
185-
# security reasons
190+
# * Disable NULL authentication, NULL encryption, MD5 MACs, DSS, RC4, and
191+
# 3DES for security reasons
186192
_RESTRICTED_SERVER_CIPHERS = (
187-
'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:'
188-
'DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:'
189-
'!eNULL:!MD5:!DSS:!RC4'
193+
'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:'
194+
'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:'
195+
'!aNULL:!eNULL:!MD5:!DSS:!RC4:!3DES'
190196
)
191197

192198

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ Core and Builtins
6060
Library
6161
-------
6262

63+
- Issue #27850: Remove 3DES from ssl module's default cipher list to counter
64+
measure sweet32 attack (CVE-2016-2183).
65+
66+
- Issue #27766: Add ChaCha20 Poly1305 to ssl module's default ciper list.
67+
(Required OpenSSL 1.1.0 or LibreSSL).
68+
6369
- Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0.
6470

6571
- Remove support for passing a file descriptor to os.access. It never worked but

0 commit comments

Comments
 (0)