Use of a broken or risky cryptographic algorithm
Description
The application was found using an insecure or risky digest or signature algorithm. MD2, MD4, MD5, and SHA1 hash algorithms have been found to be vulnerable to producing collisions. This means that two different values, when hashed, can lead to the same hash value. If the application is trying to use these hash methods for storing passwords, then it is recommended to switch to a password hashing algorithm such as Argon2id or PBKDF2.
Examples
Insecure Code
python
import hashlib; digest = hashlib.new('md5')Secure Code
python
import hashlib; digest = hashlib.sha384()Remediation
Use a standard and secure digest algorithm like SHA384 instead of MD2, MD4, MD5, or SHA1. For example, use `hashlib.sha384()` to create a SHA384 hash.
Rule Details
| Field | Value |
|---|---|
| ID | CODE-0133 |
| Category | Crypto |
| Severity | MEDIUM |
| CWE | CWE-327 |
| Confidence | HIGH |
| Impact | MEDIUM |
| Likelihood | MEDIUM |
| Exploitability | MODERATE |
| Tags | insecure algorithm, cryptographic failure |
| OWASP | A3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures |