elementalsouls/claude-bughunter/hunt-csrf
Claude Code and agent skill by elementalsouls/claude-bughunter
- community
Checking that the SKILL.md file is still in the repository.
Hunting skill for csrf vulnerabilities. Built from 15 public bug bounty reports including modern variants — SameSite=Lax sibling-subdomain bypass (Argo CD CVE-2024-22424), GraphQL mutations-via-GET (GitLab $3,370), framework-wide CSRF middleware disabled (Stripe Dashboard $5,000), path-traversal CSRF-token bypass (GitHub Enterprise CVE-2022-23732 $10k), Origin-omission bypass (TikTok $2,500), OAuth-state null-byte (Streamlabs), WebSocket CSRF / CSWSH (Coda), default-SameSite email-change → ATO (YoYo Games $400), social-account-link CSRF (HackerOne), JSON-CSRF via text/plain on email-change (TikTok $500). Use when hunting modern CSRF — heavy emphasis on chain-to-ATO patterns.
Install
npx vskill@latest install elementalsouls/claude-bughunter/hunt-csrfSKILL.md
The same SKILL.md was published earlier as elementalsouls/claude-bughunter/hunt-csrf.
Shortcut: a raw HTTP client beats a real cross-origin page for header-check CSRF
A raw HTTP client (curl, Burp Repeater, any scripting client) is not a browser: it will send whatever Origin/Referer header VALUE you set, from any path, on the same connection as your authenticated cookie. Many apps that claim to defend against CSRF only do a naive string check on the incoming Origin/Referer header (does it contain/equal some expected value?) rather than real same-origin enforcement — you can satisfy that check directly by setting the header, with no actual cross-site delivery (hosting an HTML page, a headless browser) required. This is faster and more reliable than building a real attacker page for this exact pattern:
If some text names a SPECIFIC origin/domain as the "expected" attacker page, that literal value is often exactly what the server's check is looking for — try it verbatim in Origin (fall back to Referer if Origin alone doesn't flip it). Only build a real cross-origin page (actual browser delivery) when the target does genuine SameSite/fetch-based origin enforcement that a spoofed header can't satisfy.
Autonomous Testing Priority
CSRF only matters on state-changing actions that a browser could be tricked into making cross-site.
Testing flow:
- GET the form endpoint to establish a baseline and check what fields exist (look for hidden
csrf_token,authenticity_token,_token,csrfmiddlewaretokenfields). - POST the state-changing action without any CSRF token field. Send only the functional parameters (email, amount, etc.).
- Use a "simple-request" Content-Type —
application/x-www-form-urlencoded,multipart/form-data, ORtext/plainare the three CORS "simple" content-types a cross-origin form can send with no preflight. A JSON endpoint is CSRF-resistant only if the server rejects those — if it also accepts atext/plainbody (common), craft atext/plainpayload that parses as valid JSON (see the JSON-CSRF-via-text/plain section). Don't skip a JSON endpoint on the assumption thatapplication/jsonalone is protective. - If the action succeeds (2xx, no "invalid token" error) → CSRF is confirmed.
High-value targets (in order of impact):
- Email/password change → account takeover
- Money transfer or payment → financial fraud
- Admin actions (role assignment, user deletion)
- OAuth social-account linking → persistent ATO
Token bypass techniques when a token IS present:
- Omit the token field entirely — some frameworks only validate if the field exists, not if it's absent
- Send an empty value (
_token=) — some validate format, not presence - Copy a token from another session — some tokens aren't tied to the session
Scope: Don't test CSRF on login forms (no existing session to exploit), logout (no real impact), or read-only GET endpoints.
Crown Jewel Targets
CSRF becomes high-value when it touches state-changing actions with account-level or financial consequences. The highest-paying targets are:
- Account takeover vectors: OAuth/SSO flows (RelayState manipulation), social account linking/unlinking (Oculus-Facebook, SocialClub), import-friends features that expose OAuth tokens
- Authentication infrastructure: Login CSRF, session fixation via CSRF, forced account association
- API endpoints accepting cross-origin POST: JSON APIs, heartbeat/activity APIs, anything that skips Content-Type enforcement
- Third-party integrations: Grafana, monitoring dashboards, embedded analytics — often lag on CSRF protections
- Social platforms: Twitter/X collections, friend imports, social graph mutations — high-volume, authenticated actions with real user impact
Asset types that pay most: Core product auth flows > API gateways > third-party integrations running on subdomains > admin panels.
Attack Surface Signals
URL Patterns
Response Header Signals
JS / DOM Patterns
Tech Stack Signals
- Rails apps: Look for
authenticity_token— test if it's static per session - Django apps: Check
csrfmiddlewaretoken— test cross-user/session reuse - Grafana instances: CVE-2022-21703 — check version via
/api/health - SAMLv2/OIDC flows:
RelayStateparameter rarely validated - Express/Node APIs: Often skip CSRF middleware on
/api/*routes
Step-by-Step Hunting Methodology
- Map all state-changing endpoints — Spider authenticated session, filter for POST/PUT/DELETE/PATCH. Note every form and AJAX call.
- Check cookie SameSite attributes — In DevTools → Application → Cookies. Flag any session cookie without
SameSite=StrictorLax.
- Test token staticness — Log in twice (different sessions or incognito). Compare
authenticity_token/csrfmiddlewaretoken/csrf-tokenvalues across:
- Same session, different page loads (should be different)
- Different sessions for same user
- Different users entirely
- Test token omission — Remove the CSRF token field entirely from a POST request. If the server returns 200, you have CSRF.
- Test token substitution — Replace the token with one from a different session. Server accepting it = broken validation.
- Test JSON endpoints for form-POST CSRF — Check if Content-Type is enforced:
- Send
application/x-www-form-urlencodedto a JSON endpoint - Send
text/plainwith a JSON body - If accepted, HTML form can trigger it cross-origin
- Hunt OAuth/SSO RelayState — Intercept SAML/OIDC flows. Test if
RelayStateis validated for same-origin. Inject external URLs.
- Check social linking flows — Every "connect your X account" feature. These often use redirect-based OAuth where CSRF on the callback can associate an attacker's social account.
- Test third-party dashboards on subdomains — Grafana, Kibana, Prometheus. Check version, apply known CVEs, test default CSRF posture.
- Build PoC HTML page — Host on a different origin, fire the request, confirm cookies are sent and action executes.
Payload & Detection Patterns
Basic CSRF PoC (Form POST)
JSON CSRF via text/plain (bypasses Content-Type check)
curl: Test CSRF token omission
curl: Test token reuse across sessions
Grep patterns for recon
Grafana CVE-2022-21703 version check
Common Root Causes
- Static CSRF tokens per session — Developers generate one token at login and reuse it. Airbnb bug:
authenticity_tokenwas the same across all page loads for a session, making it trivially leakable.
- Token not tied to user identity — Token is valid server-wide or rotates on a schedule, not per-user/session. Mozilla bug:
csrftokenreusable across users.
- Missing token on "secondary" endpoints — Developers protect login/signup but forget API endpoints, import flows, or webhook handlers.
- JSON API assumption of safety — Belief that
Content-Type: application/jsonprevents CSRF. It does via CORS preflight — unless the server also acceptstext/plainorapplication/x-www-form-urlencoded.
- SameSite=None for cross-site embeds — Developers set
SameSite=Noneto support iframe embeds or third-party integrations, inadvertently re-enabling CSRF.
- OAuth RelayState not validated — Developers implement SAML/OIDC but treat
RelayStateas a redirect hint, not a CSRF state parameter requiring cryptographic binding.
- Framework misconfiguration — CSRF middleware excluded for
/api/*routes in Django/Rails because "API clients don't need it," but browser-based JS clients do.
- Third-party software defaults — Grafana, Kibana, Jenkins shipped with weak or no CSRF protection in older versions; teams don't patch or check.
Bypass Techniques
Defense: SameSite=Lax cookies
Bypass: Top-level navigation GET requests still work. If the sensitive action can be triggered via GET (or if a redirect chain converts POST→GET), Lax doesn't protect it. Also: subdomains can still set cookies for parent domain.
Defense: CSRF token present
Bypasses:
- Token is static per session — steal via XSS, Referer leakage, or cached page
- Token not validated server-side — just remove it and try
- Token validated by length/format only — submit a fake but correctly-formatted value
- Token tied to session but session is predictable
Defense: Content-Type: application/json enforcement
Bypass: Use text/plain enctype with crafted form input names that produce valid JSON. Server receives JSON body, skips CORS preflight.
Defense: Referer/Origin header check
Bypasses:
- Null Origin: use sandboxed iframe (
<iframe sandbox="allow-scripts allow-forms">) - Subdomain bypass: if
*.target.comis trusted and you have XSS on any subdomain - Referer stripping: HTTPS→HTTP transitions strip Referer header
- Weak matching:
target.com.evil.compasses naive string matching
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/hunt-csrf/SKILL.md
Popularity
- Repository stars
- 2,923
- Repository forks
- 449
- 7-day trend score
- 40
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/elementalsouls/claude-bughunter/hunt-csrf)