Module lessons (1/3)
PKCE S256 & Anti-CSRF state Handshake
Reproduce OAuth Login CSRF callbacks and verify Web Crypto SHA-256 PKCE challenges alongside constant-time state binding.
What you'll learn in this lesson
- Understand how Authorization Code interception and OAuth Login CSRF exploit flows missing PKCE or
state. - Compute deterministic PKCE
S256challenges in the browser and edge runtimes usingcrypto.subtle.digest('SHA-256', ...). - Reject
code_challenge_method=plaindowngrade attacks and bind client login attempts strictly to a cryptographicstatenonce.
Overview
OAuth 2.1 mandates Proof Key for Code Exchange (PKCE) for every authorization code client — even confidential server-rendered apps. Without PKCE, malware or custom URI scheme hijackers that intercept a one-time code on the redirect can redeem it immediately at /oauth/token.
Meanwhile, omitting an unguessable session-bound state token invites Login CSRF: an attacker starts OAuth with their own account, captures /callback?code=attacker_code, and tricks a victim browser into loading that callback URL — silently signing the victim into the attacker's workspace so saved search queries, API keys, or billing cards belong…
Sections covered in this lesson
- 11. PKCE
S256&stateCryptography in Practice - 22. Interactive Explorer: OAuth 2.1 PKCE & Login CSRF Lab
- 33. Progressive Labs: Warm-Up → Attack → Defend → Harden
- 44. Checkpoints & Code Review
Unlock "PKCE S256 & Anti-CSRF state Handshake" and the full Application & Web Security curriculum
Reproduce OAuth Login CSRF callbacks and verify Web Crypto SHA-256 PKCE challenges alongside constant-time state binding.
Unlock all 6 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Application & Web Security plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.