Skip to content

Use of weak hash

Description

Detected usage of weak crypto function. Consider using stronger alternatives like those provided by the Sodium library in PHP.

Examples

Insecure Code

php
$hash = md5('password');

Secure Code

php
$hash = hash('sha256', 'password', true);

Remediation

Replace weak crypto functions (crypt, md5, md5_file, sha1, sha1_file, str_rot13) with stronger alternatives from the Sodium library or other secure cryptographic libraries.

Rule Details

FieldValue
IDCODE-0747
CategoryCrypto
SeverityMEDIUM
CWECWE-328
ConfidenceHIGH
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsinsecure hashing, weak crypto
OWASPA3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures

References