After this lesson, you will be able to: Recognize, find, and fix Cryptographic Failures (OWASP A02), and store passwords correctly with proper hashing (the security context for hash functions).
Cryptographic Failures (formerly 'Sensitive Data Exposure') is OWASP A02: data that should be protected is exposed because cryptography is missing, weak, or misused. The most common case is password storage, which is why this lesson is also the dedicated hash-functions security lesson: cryptographic hashes vs hash tables, why MD5 and SHA-1 are broken for security, salting and rainbow tables, and how to hash passwords correctly in code.
A02 covers failures to protect sensitive data: transmitting it in cleartext (no TLS), storing it unencrypted, or using weak/old algorithms. The signature case is password storage. A cryptographic hash (SHA-256, bcrypt, Argon2) is a deliberately one-way function used for passwords and integrity, which is a different thing from the fast hash function inside a hash-table data structure (built for speed, not security). For passwords you must use a slow, salted password-hashing function, never a plain fast hash, and never reversible encryption.
MD5 and SHA-1 are fast (billions of guesses per second on a GPU) and have known collision weaknesses, so they are unfit for passwords or signatures. A rainbow table is a precomputed map of hash to plaintext; an unsalted hash can be reversed by lookup. A salt is a unique random value stored with each hash, so identical passwords get different hashes and precomputed tables are useless. Modern password functions (bcrypt, scrypt, Argon2) are deliberately slow (a tunable work factor) and salt automatically, making brute force expensive even after a database leak.
Look for fast/unsalted hashing or cleartext; fix with a real password-hashing function.
# FIND IT (red flags in code or a leaked DB):# - passwords stored as md5(pw) or sha1(pw) or sha256(pw) with no salt# - passwords stored encrypted (reversible) or in plaintext# - sensitive data sent over http:// (no TLS)# VULNERABLEimport hashlibstored = hashlib.sha256(password.encode()).hexdigest() # fast + unsalted# FIXED: argon2 (modern default) or bcrypt; slow + auto-saltedfrom argon2 import PasswordHasherph = PasswordHasher()stored = ph.hash(password) # unique salt + tunable cost baked in# verify:try:ph.verify(stored, attempt) # raises on mismatchexcept Exception:deny()# Also: enforce TLS everywhere; encrypt sensitive data at rest with a# managed key (KMS); never log secrets.
Pick the most complete answer.
Sign in and purchase access to unlock this lesson.