An SSL or early TLS version with known attacks is used
What it finds
ssl.PROTOCOL_TLSv1, ssl.TLSVersion.TLSv1_1: SSL 2 and 3 and TLS 1.0 and 1.1 have known attacks and are turned off by current clients and servers (CWE-326). Code that still names them either allows them or pins a connection to them.
Reported are mentions of the protocol constants of ssl and OpenSSL.SSL for those versions.
From the rule's source, weak_tls_version.rs.
import sslfrom ssl import TLSVersion def contexts(): a = ssl.SSLContext(ssl.PROTOCOL_TLSv1)tx0 reports: ssl.PROTOCOL_TLSv1 selects a protocol version with known attacks a.minimum_version = TLSVersion.TLSv1_1tx0 reports: ssl.TLSVersion.TLSv1_1 selects b = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) b.minimum_version = ssl.TLSVersion.TLSv1_2 return a, b Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:weak-tls-version" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:weak-tls-version] reason="..."tx0 explain tx0/python:weak-tls-version shows the same in the terminal. Found a false positive? Report it.