Cryptographic Failures happen when sensitive data is stored or transmitted with weak, outdated, or missing cryptography — exposing passwords, tokens, and personal data the moment a breach occurs. Try the interactive playground below to see how a weak hash cracks instantly, while a modern one resists it.
OWASP Top 10 · 2025 · A04 — Cryptographic Failures
Cryptographic failures happen when sensitive data — passwords, tokens, credit card numbers — is protected with weak, outdated, or missing cryptography instead of proven, modern methods. A common mistake is confusing hashing (one-way, used for passwords) with encryption (two-way, used for data you need back), then implementing either one badly: fast unsalted hashes like MD5 or SHA1, hand-rolled ciphers, missing TLS, or hardcoded keys. The result is data that looks protected on paper but falls apart the moment an attacker gets a copy of it.
| Username | Password Hash (leaked) | Crack Attempt | Result |
|---|
# No salt, fast general-purpose hash # Crackable at billions of guesses/sec import hashlib def store_password(password): hash = hashlib.md5( password.encode() ).hexdigest() db.save(hash) # same input -> same hash, always # rainbow tables crack this instantly
# Unique salt + deliberately slow hash # Tunable work factor (rounds) import bcrypt def store_password(password): salt = bcrypt.gensalt(rounds=12) hash = bcrypt.hashpw( password.encode(), salt ) db.save(hash) # each hash is unique, ~250ms per guess # brute force becomes infeasible
When a database of unsalted MD5 or SHA1 hashes leaks, attackers don’t “hack” anything further — they run the hashes through precomputed rainbow tables or GPU rigs doing tens of billions of guesses per second, and typically recover a large fraction of passwords within minutes. Because so many users reuse passwords across sites, one weakly-hashed database can cascade into account takeovers everywhere else.
bcrypt, scrypt, or Argon2 — with an appropriate work factor, never a general-purpose hash like MD5/SHA1.AES-GCM — never unauthenticated modes like ECB, which leak data patterns.