Skip to content

Commit

Permalink
Check for deprecated TLS 1.1
Browse files Browse the repository at this point in the history
The IETF officially deprecated TLS 1.1 in March 2021. As such,
Bandit should now check for and warn of its use.

https://datatracker.ietf.org/doc/rfc8996/

Signed-off-by: Eric Brown <eric_wade_brown@yahoo.com>
  • Loading branch information
ericwb committed Jul 10, 2022
1 parent 1067978 commit 7b0a5cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions bandit/plugins/insecure_ssl_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def gen_config(name):
"PROTOCOL_TLSv1", # strict option
"SSLv3_METHOD", # strict option
"TLSv1_METHOD",
"PROTOCOL_TLSv1_1",
"TLSv1_1_METHOD",
]
} # strict option

Expand Down
12 changes: 11 additions & 1 deletion examples/ssl-insecure-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
herp_derp(method=SSL.SSLv3_METHOD)
herp_derp(method=SSL.TLSv1_METHOD)

ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1_1)
SSL.Context(method=SSL.TLSv1_1_METHOD)

herp_derp(ssl_version=ssl.PROTOCOL_TLSv1_1)
herp_derp(method=SSL.TLSv1_1_METHOD)


ssl.wrap_socket()

def open_ssl_socket(version=ssl.PROTOCOL_SSLv2):
Expand All @@ -31,6 +38,9 @@ def open_ssl_socket(version=SSL.SSLv2_METHOD):
def open_ssl_socket(version=SSL.SSLv23_METHOD):
pass

# this one will pass ok
def open_ssl_socket(version=SSL.TLSv1_1_METHOD):
pass

# this one will pass ok
def open_ssl_socket(version=SSL.TLSv1_2_METHOD):
pass
8 changes: 2 additions & 6 deletions tests/functional/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,8 @@ def test_sql_statements(self):
def test_ssl_insecure_version(self):
"""Test for insecure SSL protocol versions."""
expect = {
"SEVERITY": {"LOW": 1, "MEDIUM": 10, "HIGH": 7},
"CONFIDENCE": {"LOW": 0, "MEDIUM": 11, "HIGH": 7},
}
expect = {
"SEVERITY": {"UNDEFINED": 0, "LOW": 1, "MEDIUM": 10, "HIGH": 7},
"CONFIDENCE": {"UNDEFINED": 0, "LOW": 0, "MEDIUM": 11, "HIGH": 7},
"SEVERITY": {"UNDEFINED": 0, "LOW": 1, "MEDIUM": 13, "HIGH": 9},
"CONFIDENCE": {"UNDEFINED": 0, "LOW": 0, "MEDIUM": 14, "HIGH": 9},
}
self.check_example("ssl-insecure-version.py", expect)

Expand Down

0 comments on commit 7b0a5cd

Please sign in to comment.