Common Cryptographic Attacks
Reproduce four real attack classes end-to-end against code you write yourself — ECB pattern leakage, a CBC padding oracle, AES-GCM nonce reuse, and a hash length-extension attack — then patch each one and confirm the fix actually holds.
Prerequisites: Completion of all previous projects in this roadmap; Python 3.10+ with cryptography installed.
Verified against the pyca/cryptography documentation and established, long-published cryptanalysis (padding oracle attacks, ECB mode weaknesses, AES-GCM's documented nonce-reuse failure mode, and Merkle–Damgård length-extension attacks) — these are foundational, well-documented attack classes, not fast-moving areas, and the underlying mechanics haven't changed. Every exploit in this project targets a small, deliberately vulnerable service you build and run entirely on your own machine; nothing here targets a third-party system, and the goal throughout is recognizing and eliminating these patterns in real code, not attacking anything you don't own. This mirrors the long-standing pedagogical approach of resources like the Cryptopals Crypto Challenges, referenced directly in pyca/cryptography's own documentation as a learning resource.
AES has never been broken in the sense that matters practically — no one can recover a key faster than exhaustive search. Every attack in this project instead exploits a mode of operation choice, an error-handling detail, or a reuse mistake sitting on top of otherwise-sound math. That distinction matters for how you should read this project: the lesson isn't "AES is unsafe," it's "here are four specific, narrow ways people misuse AES (and hash functions) that look fine in casual code review and fail catastrophically in production." You built each of the correct patterns already, earlier in this roadmap — AEAD instead of plain encryption, unique nonces, HMAC instead of a naive hash-based MAC. This project builds the broken version of each one on purpose, exploits it yourself, and then applies the fix you already know from those earlier projects — so the fix stops being an abstract rule and becomes something you've personally watched close a real hole.
ECB mode leaks structure, even with a perfect key
Build and break a CBC padding oracle
Prove AES-GCM nonce reuse is catastrophic, not just "weaker"
Length-extension: forge a MAC without the key
Secret Mission: full exploit-then-patch cycle
Before You Go
Test what you just learned
Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.
Log in to unlock0 / 7 complete
