ΣύνδεσηΕγγραφή
A04 · 2025

Cryptographic Failures

Sensitive data is not encrypted, or is protected with weak crypto.

What it is

Passwords, tokens and personal data need the right protection: TLS on the wire, slow salted hashes for passwords, and strong random values for tokens. Old algorithms (MD5, SHA-1) or home-made crypto give a false sense of safety.

What can happen

Example: Storing passwords

✕ Vulnerable
import { createHash } from "node:crypto";

// Fast hash, no salt: same password -> same hash, cracked by lookup tables.
const hash = createHash("md5").update(password).digest("hex");
✓ Fixed
import bcrypt from "bcrypt";

// Slow, salted, with a cost factor you can raise later.
const hash: string = await bcrypt.hash(password, 12);
const ok: boolean = await bcrypt.compare(attempt, hash);

For tokens (email verify, password reset) use crypto.randomBytes(32), and store only its SHA-256 hash.

How to prevent it

What CrimsonScan checks

Partly detected

The light scan checks TLS (old protocols, weak ciphers, expired certificates). The heavy scan flags cookies without Secure. How passwords are stored is invisible from outside.

Read more on owasp.org ↗