A02: Cryptographic Failures

Simulating the risks of storing sensitive data like passwords without proper encryption.

Interactive Simulation

Enter a password, save it to the "database", and then simulate an attacker breaching it.

idusernamepassword_storage
1aliceNULL

Explanation

This vulnerability, previously known as "Sensitive Data Exposure," covers failures related to cryptography. Storing passwords in plaintext is a critical example. If an attacker breaches the database, they have immediate access to all user credentials.

The correct approach is to use a strong, adaptive, salted hashing algorithm like bcrypt. This converts the password into a fixed-length, irreversible hash. Even if the database is breached, the attacker only gets the hashes, which are computationally difficult to reverse.

Toggle Defense

When enabled, the password is not stored directly. Instead, a one-way hash is generated and stored.