Inadequate Encryption Strength
Description
The application is using an SSL module with SSL or TLS protocols that have known deficiencies. It is recommended to use TLS 1.2 or 1.3 and `SSLContext.wrap_socket`. The `pyOpenSSL` module is deprecated and should be replaced with the `pyca/cryptography` module.
Examples
Insecure Code
python
ssl.PROTOCOL_SSLv2Secure Code
python
ssl.PROTOCOL_TLS_CLIENTRemediation
Create a new TLS context and pass in `ssl.PROTOCOL_TLS_CLIENT` for clients or `ssl.PROTOCOL_TLS_SERVER` for servers to the `ssl.SSLContext(...)` `protocol=` argument. Use the new `SSLContext.wrap_socket` method instead.
Rule Details
| Field | Value |
|---|---|
| ID | CODE-0166 |
| Category | Crypto |
| Severity | MEDIUM |
| CWE | CWE-326 |
| Confidence | HIGH |
| Impact | MEDIUM |
| Likelihood | MEDIUM |
| Exploitability | MODERATE |
| Tags | inadequate encryption, deprecated library |
| OWASP | A3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures |