Skip to main content
HighAI codeOWASP A02:2021CWE-327

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

  1. 1For password hashing: use bcrypt (cost 12+), argon2id, or scrypt.
  2. 2For tokens and IDs: use crypto.randomBytes(32).toString('hex').
  3. 3For data integrity/checksums (non-security): SHA-256 is acceptable.
  4. 4Migrate existing MD5/SHA-1 password hashes by rehashing on next login.

Code examples

Argon2 password hashing

TypeScript
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.

See every ai code check

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.

Propose a checkHow a check is built

Scan your own site for weak hashing algorithm (md5/sha-1) detected

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Weak Hashing Algorithm (MD5/SHA-1) Detected fix | VulnRadar