Module lessons (1/4)
Cookies (HttpOnly/SameSite), CORS & CSRF
Simulate cookie theft and cross-site requests, bypass suffix-based origin checks, and enforce exact Origin allowlists.
What you'll learn in this lesson
- Explain how browser cookies (
HttpOnly,Secure,SameSite), CORS, and CSRF interact across origins. - Exploit broken
.endsWith()and.includes()CORS origin filters using lookalike domains. - Enforce exact
new URL(origin).originCORS allowlists, hardenedSet-Cookieflags, and fail-closed CSRF + origin verification on state-changing routes.
Overview
Authentication cookies live in the browser's shared cookie jar, which creates two distinct cross-origin attack vectors: Cross-Site Request Forgery (CSRF) (a third-party site triggers a browser request that carries cookies automatically) and Permissive CORS (a server reflects an untrusted Origin header with credentials, letting another site read…
Inspect four security patterns at the HTTP trust boundary:
Sections covered in this lesson
- 11. Cookie Flags, CORS Origin Parsing & CSRF Guards
- 22. Interactive Explorer: HTTP Cookies, CORS & CSRF
- 33. Progressive Labs: Warm-Up → Attack → Defend → Harden
- 44. Checkpoints & Code Review
Unlock "Cookies (HttpOnly/SameSite), CORS & CSRF" and the full Application & Web Security curriculum
Simulate cookie theft and cross-site requests, bypass suffix-based origin checks, and enforce exact Origin allowlists.
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.