Skip to content

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

FieldValue
IDCODE-0696
CategoryCrypto
SeverityMEDIUM
CWECWE-327
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagsinsecure algorithm, cryptographic vulnerability
OWASPA6:2017-Security Misconfiguration, A04:2021-Insecure Design