Skip to content
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

Removed CBC ciphers to address CVE-2013-0169 (LUCKY13) #1051

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions prometheus_client/exposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,22 @@ def _get_ssl_ctx(
"""Load context supports SSL."""
ssl_cxt = ssl.SSLContext(protocol=protocol)

# The following chipers will be removed if the default cipher set contains
# them. The reason for each cipher is stated in the comment.
remove_cipher_names = [
"ECDHE-ECDSA-AES256-SHA384", # is a CBC cipher (CVE-2013-0169)
"ECDHE-RSA-AES256-SHA384", # is a CBC cipher (CVE-2013-0169)
"ECDHE-ECDSA-AES128-SHA256", # is a CBC cipher (CVE-2013-0169)
"ECDHE-RSA-AES128-SHA256", # is a CBC cipher (CVE-2013-0169)
]
cipher_names = [c['name'] for c in ssl_cxt.get_ciphers()]
for cipher_name in remove_cipher_names:
try:
cipher_names.remove(cipher_name)
except ValueError:
pass
ssl_cxt.set_ciphers(':'.join(cipher_names))

if cafile is not None or capath is not None:
try:
ssl_cxt.load_verify_locations(cafile, capath)
Expand Down