Use of a broken or risky cryptographic algorithm (SHA1/MD5)
Description
The application was found using an insecure or risky digest or signature algorithm. Both 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
java
MessageDigest.getInstance("MD5");Secure Code
java
MessageDigest.getInstance("SHA-384");Remediation
Replace MD5 and SHA1 with a secure digest algorithm like SHA-384. Example: MessageDigest sha384Digest = MessageDigest.getInstance("SHA-384");
Rule Details
| Field | Value |
|---|---|
| ID | CODE-0696 |
| Category | Crypto |
| Severity | MEDIUM |
| CWE | CWE-327 |
| Confidence | HIGH |
| Impact | HIGH |
| Likelihood | MEDIUM |
| Exploitability | EASY |
| Tags | insecure algorithm, cryptographic vulnerability |
| OWASP | A6:2017-Security Misconfiguration, A04:2021-Insecure Design |