Skills

Csrf Cross Site Request Forgery

CSRF testing playbook.

Install

npx skills add yaklang/hack-skills --skill csrf-cross-site-request-forgery -g -a claude-code -y
Repository
yaklang/hack-skills2.6k
Category
Testing
Updated
2mo ago
License
MIT
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

CSRF testing playbook. Use when reviewing state-changing web flows, anti-CSRF defenses, SameSite behavior, JSON CSRF, login CSRF, and OAuth state handling.

SKILL: CSRF, Cross-Site Request Forgery, Expert Attack Playbook

AI LOAD INSTRUCTION: Expert CSRF techniques. Covers modern bypass vectors (SameSite gaps, custom header flaws, tokenless bypass patterns), JSON CSRF, multipart CSRF, chaining with XSS. Base models often present only basic CSRF without covering SameSite edge cases and common broken token implementations.

0. RELATED ROUTING

Also load:


1. CORE CONCEPT

CSRF exploits a victim's active session to perform state-changing requests from the attacker's origin.

Required conditions:

  1. Victim is authenticated (active session cookie)
  2. Server identifies session via cookie only (no secondary check)
  3. Attacker can predict/construct the valid request
  4. Cookie is sent cross-origin (SameSite=None or legacy behavior)

2. FINDING CSRF TARGETS

High-value state-changing endpoints:

- Password change         ← account takeover
- Email change            ← account takeover
- Add admin / change role ← privilege escalation
- Bank/payment transfer   ← financial impact
- OAuth app authorization ← hijack oauth flow
- Account deletion
- Two-factor auth disable  
- SSH key / API key addition
- Webhook configuration
- Profile/contact info update

3. TOKEN BYPASS TECHNIQUES

No Token Present

Simplest case, form simply lacks CSRF token. Check if POST /change-email has any token. If not → trivially exploitable.

Token Not Validated (most common finding!)

Token exists in request but is never verified server-side:

Remove the _csrf_token parameter entirely → does request still succeed?
→ YES → trivial bypass
Read the whole SKILL.md on GitHub

More in Testing