Skip to content

Insecure hashing algorithm

Description

The crypt functions are not recommended due to the significantly small key space. Modern hardware can crack crypt produced passwords relatively quickly. Consider using the Argon2id password hashing algorithm provided by libsodium.

Examples

Insecure Code

c
password = crypt(password);

Secure Code

c
password = argon2id_hash(password);

Remediation

Replace crypt or crypt_r with a secure password hashing algorithm like Argon2id from libsodium.

Rule Details

FieldValue
IDCODE-0588
CategoryCrypto
SeverityMEDIUM
CWECWE-327
ConfidenceHIGH
ImpactMEDIUM
LikelihoodHIGH
ExploitabilityEASY
Tagspassword hashing, insecure algorithm
OWASPA3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures