How to fix: Weak Hashing Algorithm (MD5/SHA-1) Detected
The response contains code using MD5 or SHA-1 for hashing. These algorithms are cryptographically broken and should not be used for any security purpose including password hashing, token generation, or data integrity.
Why it matters
MD5 and SHA-1 are broken. Collision attacks on SHA-1 are practical (SHAttered attack). For passwords, both algorithms are too fast: billion-hash-per-second GPU cracking makes them trivially reversible given any common password.
AI tools frequently suggest md5() or sha1() for 'hashing passwords' or 'generating tokens'. These functions were never designed for password storage and have been cryptographically broken since 2005 (MD5) and 2017 (SHA-1).
How to fix it
- 1For password hashing: use bcrypt (cost 12+), argon2id, or scrypt.
- 2For tokens and IDs: use crypto.randomBytes(32).toString('hex').
- 3For data integrity/checksums (non-security): SHA-256 is acceptable.
- 4Migrate existing MD5/SHA-1 password hashes by rehashing on next login.
Code examples
Argon2 password hashing
import argon2 from 'argon2';
// Bad (AI-generated)
const hash = crypto.createHash('md5').update(password).digest('hex');
// Good
const hash = await argon2.hash(password, { type: argon2.argon2id });
const valid = await argon2.verify(hash, password);References
Detected automatically by VulnRadar. The check id is vibe-md5-sha1-usage, stable across every scan so you can filter or diff on it.
More ai code checks
- LowGeneric Error Messages Leak No Context
- MediumTODO/FIXME Security Note in Response
- Higheval() Usage in Page Scripts
- HighSSL Certificate Verification Disabled
- HighMath.random() Used for Security Tokens
- CriticalHardcoded Credential in Authentication Logic
- CriticalJWT 'none' Algorithm Accepted
- CriticalSQL String Concatenation Pattern Detected
Questions
- How severe is Weak Hashing Algorithm (MD5/SHA-1) Detected?
- VulnRadar rates this high severity in the ai code category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id vibe-md5-sha1-usage, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Weak Hashing Algorithm (MD5/SHA-1) Detected map to?
- It maps to CWE-327. In the OWASP Top 10 it falls under A02:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.