Password hashes use bcrypt or argon2 (not raw crypto)
Why it matters
Storing crypto.createHash('sha256').update(password).digest('hex') as a password hash is not password hashing — it's a fingerprint. SHA-256 runs at ~3 billion hashes per second on a gaming GPU, making a leaked database crackable in hours for common passwords. CWE-916 (Use of Password Hash With Insufficient Computational Effort) and OWASP A02 describe the requirement: password KDFs (bcrypt, argon2, scrypt) are deliberately slow — 250ms per attempt — which makes brute-force impractical. An AI-generated auth module that uses crypto.createHash instead of bcrypt.hash is the most common credential-storage mistake in vibe-coded projects.
Severity rationale
Medium because exploitation requires access to the hashed password database, but once obtained, SHA-256 or MD5 hashes can be cracked at billions of attempts per second on commodity hardware.
Remediation
Replace any crypto.createHash call on passwords with bcrypt.hash() or argon2.hash(). Both are purposefully slow and include a random salt automatically.
// Bad: fast, saltless, GPU-friendly
const hash = crypto.createHash('sha256').update(password).digest('hex')
// Good: bcrypt with cost factor 12 (~250ms on modern hardware)
import bcrypt from 'bcrypt'
const hash = await bcrypt.hash(password, 12)
// Verification
const valid = await bcrypt.compare(candidatePassword, storedHash)
// Or argon2 (preferred for new projects)
import argon2 from 'argon2'
const hash = await argon2.hash(password)
const valid = await argon2.verify(storedHash, candidatePassword)
If you have existing SHA-256 hashes in production, plan a migration: on next successful login, re-hash with bcrypt and store the new hash.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Security Implementation Validation Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-916 — Use of Password Hash with Insufficient Computational Effort
- cwe · CWE-759 — Use of a One-Way Hash Without a Salt
- owasp:2021 · A02 — Cryptographic Failures
- owasp:2021 · A07 — Identification and Authentication Failures
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-security-theater·automated