A security review finds passwords stored as unsalted MD5 hashes. How do you migrate without forcing every user to reset?
AdvancedScenarioVulnerability Management and OWASP
Answer
Situation read → Cryptographic failure (OWASP A02). Unsalted MD5 cracks in seconds with GPUs and rainbow tables.
What I'd do →
- Wrap existing hashes now: store
argon2id(md5_hash)for every user in one migration, so no plain MD5 remains at rest. - On next successful login, verify via the wrapped path, then re-hash the plain password with Argon2id (or bcrypt cost 12+) directly and mark the record upgraded.
- After a fixed period, force reset for accounts that never logged in.
- Treat the old database dumps and backups as compromised data; check who had access.
- Add a test or lint rule blocking
md5/sha1for password handling.
Why → Wrapping protects everyone today, not only those who log in again.
Interview tip → "Wrap, then upgrade on login" is the textbook migration pattern.
More on Vulnerability Management and OWASP
A pentest report shows SQL injection in a search endpoint of a Java service. How do you handle it end to end?BeginnerA scanner reports 4,000 open CVEs across 300 images. The team can fix maybe 100 a month. How do you prioritise?IntermediateA user reports they can see another customer's invoice by changing the ID in the URL. What do you do?BeginnerA webhook feature lets users enter a URL, and a pentester used it to read the cloud metadata endpoint. How do you fix it?AdvancedA team still runs Log4j 2.14 in an internal service and says it is not internet-facing. How do you respond?IntermediateYour DAST scan in staging finds reflected XSS in a React app. The developers say React escapes everything. Who is right?Intermediate