8000 Issues #27850 and #27766: Remove 3DES from ssl default cipher list an… · python/cpython@fa53dbd · GitHub
[go: up one dir, main page]

Skip to content

Commit fa53dbd

Browse files
vstinnerlarryhastings
authored andcommitted
Issues #27850 and #27766: Remove 3DES from ssl default cipher list and add ChaCha20 Poly1305. (#224)
Backport: replace 3.5.3 with 3.4.7 in the doc versionchanged. (cherry picked from commit 03d13c0)
1 parent f37b0cb commit fa53dbd

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

Doc/library/ssl.rst

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

281281
RC4 was dropped from the default cipher string.
282282

283+
.. versionchanged:: 3.4.7
284+
285+
ChaCha20/Poly1305 was added to the default cipher string.
286+
287+
3DES was dropped from the default cipher string.
288+
283289

284290
Random generation
285291
^^^^^^^^^^^^^^^^^

Lib/ssl.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,36 +160,42 @@ def _import_symbols(prefix):
160160
else:
161161
CHANNEL_BINDING_TYPES = []
162162

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

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

195201

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Documentation
1919
Library
2020
-------
2121

22+
- Issue #27850: Remove 3DES from ssl module's default cipher list to counter
23+
measure sweet32 attack (CVE-2016-2183).
2224

2325
What's New in Python 3.4.6?
2426
===========================

0 commit comments

Comments
 (0)
0