Cryptanalysis in practice: why real systems break at keys, modes, and randomness

Modern ciphers like AES are rarely broken directly; systems fail through reused nonces, ECB mode, weak randomness, and poor key handling. Classic cryptanalysis ideas, the mistakes that actually cause breaches, and safer defaults.

Lesson 4 of 10 · 12 min read · practice only with authorization

Diagram

Where encryption actually fails

Follow the path. One example at a time.

Step 1 of 4

Cipher

AES-256 itself has no practical break.

Illustration: Cipher
# Cipher
# AES-256 itself has no practical break.

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Modes

    What fails
    ECB leaks structure; CBC without a MAC allows padding oracles.
    Who is affected
    Data encrypted with those modes.
    What you would notice
    AES/ECB or CBC without HMAC in code.
    What you change
    Use AEAD modes such as AES-GCM or ChaCha20-Poly1305.
  2. Randomness

    What fails
    Predictable random numbers make keys and nonces guessable.
    Who is affected
    Everything derived from them.
    What you would notice
    Math.random or rand() used for keys or tokens.
    What you change
    Use the OS CSPRNG (secrets, crypto.randomBytes, /dev/urandom).
  3. Key management

    What fails
    Hard-coded or unrotated keys turn one leak into permanent exposure.
    Who is affected
    All data under the key.
    What you would notice
    Keys in repositories or config files.
    What you change
    Store keys in a KMS or HSM and rotate them.

Classic ideas still worth knowing

Frequency analysis broke substitution ciphers; known-plaintext and chosen-plaintext attacks describe what an attacker may observe; differential and linear cryptanalysis drove modern cipher design. These frame why today’s advice is “use vetted primitives through a high-level library”.

Post-quantum migration

NIST published its first post-quantum standards in 2024: ML-KEM (FIPS 203) for key exchange and ML-DSA and SLH-DSA (FIPS 204 and 205) for signatures. Browsers and TLS libraries already offer hybrid key exchange. Start by inventorying where you use RSA and elliptic-curve keys.

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

Why is ECB mode unsafe for most data?

Sibling techniques

Pages at the same depth, plus a lab and a glossary card for this one.

  1. MapCryptography basics: hashes, symmetric and public-key encryption, and signaturesThe four primitives security work depends on, what each guarantees, and the common mistakes: encoding mistaken for encryption, fast hashes for passwords, and encryption without integrity.

Practice

  1. LabControl benchA failure is described. Choose the control that changes the outcome.