Skip to content

Commit f685b3b

Browse files
committed
Removed CBC ciphers to address CVE-2013-0169 (LUCKY13)
Details: * This change removes the following CBC ciphers from the default set of ciphers in order to address CVE-2013-0169 (LUCKY13): - ECDHE-ECDSA-AES256-SHA384 - ECDHE-RSA-AES256-SHA384 - ECDHE-ECDSA-AES128-SHA256 - ECDHE-RSA-AES128-SHA256 This is done by listing them in the code, i.e. without any way to configure that by the user. Signed-off-by: Andreas Maier <maiera@de.ibm.com>
1 parent 4535ce0 commit f685b3b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

prometheus_client/exposition.py

+16
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,22 @@ def _get_ssl_ctx(
170170
"""Load context supports SSL."""
171171
ssl_cxt = ssl.SSLContext(protocol=protocol)
172172

173+
# The following chipers will be removed if the default cipher set contains
174+
# them. The reason for each cipher is stated in the comment.
175+
remove_cipher_names = [
176+
"ECDHE-ECDSA-AES256-SHA384", # is a CBC cipher (CVE-2013-0169)
177+
"ECDHE-RSA-AES256-SHA384", # is a CBC cipher (CVE-2013-0169)
178+
"ECDHE-ECDSA-AES128-SHA256", # is a CBC cipher (CVE-2013-0169)
179+
"ECDHE-RSA-AES128-SHA256", # is a CBC cipher (CVE-2013-0169)
180+
]
181+
cipher_names = [c['name'] for c in ssl_cxt.get_ciphers()]
182+
for cipher_name in remove_cipher_names:
183+
try:
184+
cipher_names.remove(cipher_name)
185+
except ValueError:
186+
pass
187+
ssl_cxt.set_ciphers(':'.join(cipher_names))
188+
173189
if cafile is not None or capath is not None:
174190
try:
175191
ssl_cxt.load_verify_locations(cafile, capath)

0 commit comments

Comments
 (0)