Tested fixes for CWE-916 in Express, Flask, Spring Boot, ASP.NET Core, FastAPI, Django, net/http and Laravel: the vulnerable code, the fix, a plausible fix that still fails, and the regression tests.
MITRE’s description of CWE-916: The product generates a hash for a password, but it uses a scheme that does not provide a sufficient level of computational effort that would make password cracking attacks infeasible or expensive.
Common consequences MITRE lists
- Access Control: Bypass Protection Mechanism; Gain Privileges or Assume Identity
After a database leak, fast hashes let attackers test billions of guesses per second on GPUs, recovering most passwords and enabling credential stuffing elsewhere.
- Use a slow, salted password hashing function. OWASP’s Password Storage Cheat Sheet recommends Argon2id with at least 19 MiB of memory, 2 iterations and parallelism 1.
- Where Argon2id is unavailable, OWASP gives minimums for scrypt (N=2^17, r=8, p=1), bcrypt (work factor 10 or more, with input limited to 72 bytes) and, for FIPS-140, PBKDF2-HMAC-SHA-256 with 600,000 iterations.
- Store the algorithm and parameters with each hash, benchmark them on your hardware, and upgrade old hashes when users next sign in.
Guides on this site
Password storage: hashing parameters and rehash on login
Choose Argon2id, scrypt, PBKDF2 or bcrypt with current minimum parameters, store a versioned hash, and upgrade old hashes after a successful login without overwriting a reset.
Choose cryptographic algorithms and parameters by job
A sourced quick reference for October 2026: which algorithm and parameters to use for encryption, hashing, passwords, MACs, signatures, key agreement, key derivation, randomness and TLS, the matching APIs in Node.js, Python, Java, Go and .NET, and where post-quantum migration stands.
Case study: the LastPass breach (2022)
How an attacker went from a compromised developer laptop to a DevOps engineer's home computer, the keys to LastPass's cloud backups and a copy of customer vaults; why each vault's safety then rested on its master password and PBKDF2 iteration count; and what it teaches about backup keys, privileged endpoints, KDF upgrades and unencrypted metadata.
Practice
References
List data from MITRE; the name, definition and consequences are from MITRE’s CWE 4.20 catalogue. A guide is listed as the main subject when the weakness is what the guide is about, and as covering it when a dedicated section or worked example addresses it.
CWE content: Copyright © 2006–2026, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation. CWE™ is free to use by any organization or individual for any research, development, and/or commercial purposes, per these CWE Terms of Use. Accordingly, The MITRE Corporation hereby grants you a non-exclusive, royalty-free license to use CWE for research, development, and commercial purposes. Any copy you make for such purposes is authorized on the condition that you reproduce MITRE’s copyright designation and this license in any such copy. CWE is a trademark of The MITRE Corporation. CWE Terms of Use.