Skip to content
Skillpedia
Security5.4k Β· #14903

hunt-csrf

What it does

This skill tests whether state-changing actions are protected against cross-site request forgery. It is for authorized testing of login sessions, profile changes and other account actions.

When to use it

  • βœ“When a form changes account settings and you want to confirm it needs a valid token.
  • βœ“When a site relies only on the Origin or Referer header for protection.
  • βœ“When a GraphQL or API endpoint might accept changes through GET requests.

Skill link

https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-csrf/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-csrf/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCan you check whether our profile update form can be submitted from another site without a valid token, in our authorized test?”

5 new skills a week. 1 minute to read.

How it works

The agent sends the same action with altered origin headers, missing tokens or from a test page, and checks whether the change still happens. It reports actions that succeed without proper protection.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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:

POST /profile HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Origin: https://a-domain-the-app-treats-as-trusted-or-attacker-controlled.example
Cookie: <authenticated session>

username=csrf_poc

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:

  1. GET the form endpoint to establish a baseline and check what fields exist (look for hidden csrf_token, authenticity_token, _token, csrfmiddlewaretoken fields).
  2. POST the state-changing action without any CSRF token field. Send only the functional parameters (email, amount, etc.).
  3. Use a "simple-request" Content-Type β€” application/x-www-form-urlencoded, multipart/form-data, OR text/plain are 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 a text/plain body (common), craft a text/plain payload that parses as valid JSON (see the JSON-CSRF-via-text/plain section). Don't skip a JSON endpoint on the assumption that application/json alone is protective.
  4. 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

/oauth/authorize?RelayState=
/accounts/link
/import/friends
/api/v*/heartbeat
/api/v*/collect
/monitoring/* (Grafana, Prow, Prometheus)
/auth/saml/callback
/connect/* (social integrations)

Response Header Signals

# Missing or weak SameSite cookie attributes
Set-Cookie: session=abc123; HttpOnly        # no SameSite = vulnerable
Set-Cookie: sess
FAQ

What is CSRF?

It is when a site tricks a logged-in browser into sending a request the user did not intend.

Do I need a real attacker website for tests?

Not always. The skill says a raw request with a set header can be enough when the server only checks the header text.

Which headers are tested?

The skill tests the Origin header first and falls back to Referer if needed.

Details

Original description by the author

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 (Ti

repo: elementalsouls/Claude-BugHunter

Popularity

GitHub stars
5.4k
Ranking position
#14903
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills