From dec813f118f7abffa24a9a0431dea125a6096518 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 28 Nov 2013 08:06:54 +0100 Subject: ssl.create_default_context() sets OP_NO_COMPRESSION to prevent CRIME --- Lib/ssl.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/ssl.py') diff --git a/Lib/ssl.py b/Lib/ssl.py index 72e6a6e6d4c..b29b90582ed 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -383,6 +383,8 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None, context = SSLContext(PROTOCOL_TLSv1) # SSLv2 considered harmful. context.options |= OP_NO_SSLv2 + # disable compression to prevent CRIME attacks (OpenSSL 1.0+) + context.options |= getattr(_ssl, "OP_NO_COMPRESSION", 0) # disallow ciphers with known vulnerabilities context.set_ciphers(_RESTRICTED_CIPHERS) # verify certs in client mode -- cgit v1.2.3