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 with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
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.
version
1.1.0
revision_date
"2026-07-25T00:00:00.000Z"
license
MIT
category
redteam
tags
["csrf","hunt","redteam"]
When to Use
Use when the target has any state-changing endpoint that a logged-in user can trigger — POST/PUT/DELETE on account settings, email changes, social account linking, OAuth flows, API calls, or file operations. CSRF exploits the trust a site has in a user's browser by forging cross-origin requests. Every form submission, AJAX call, OAuth callback, and API mutation is a candidate. Highest-value targets: account takeover vectors (OAuth/SSO flows, social account linking), authentication infrastructure (login CSRF, session fixation), JSON APIs accepting cross-origin POST, and third-party integrations (Grafana, monitoring dashboards).
⚠️ CRITICAL: curl ≠ browser. Model the browser security model.
CSRF PoC MUST work in a real browser, not just curl. The browser enforces rules that curl ignores:
Browser Rule
curl Behavior
Real CSRF Impact
SameSite=Lax
curl sends cookie anyway
Blocks cookie on cross-site POST — no CSRF
SameSite=Strict
curl sends cookie anyway
Blocks cookie on all cross-site requests — no CSRF
CORS preflight
curl skips OPTIONS
Browser blocks if Content-Type: application/json
Sec-Fetch-Site: cross-site
curl doesn't send
Server can reject cross-site requests via this header
CSRF verification checklist:
✅ Endpoint changes state (POST/PUT/DELETE)
✅ Cookie has SameSite=None OR SameSite=Lax with GET-based action
✅ No custom CSRF token/header required
✅ PoC works from a different origin in a real browser
If step 2 fails (SameSite=Lax on POST endpoint) → NOT exploitable CSRF via curl alone. SameSite=Lax allows cookies on top-level navigation GET, not cross-site POST. A curl POST succeeding with the cookie is a false positive — the browser would block it.
CSRF Middleware Protection Bypass:
Many modern web frameworks (for example, those with CSRF protection enabled by default) reject state-changing requests such as POST, PUT, or DELETE with a 403 Forbidden response when the CSRF token is missing or invalid.
In some applications, if the method is not covered by the same CSRF middleware or is handled differently, it may be possible to perform the same state-changing action using PATCH instead. This can result in a CSRF protection bypass if the server accepts the request without validating a CSRF token.
PATCH
SameSite cheat sheet:
Cookie Attribute
Browser sends cookie on...
SameSite=None
All cross-site requests (needs Secure)
SameSite=Lax
Cross-site GET (top-level nav only). Blocks POST
SameSite=Strict
Same-site only. Blocks everything cross-site
Not set (default)
Treated as Lax in modern browsers
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.
# Missing or weak SameSite cookie attributes
Set-Cookie: session=abc123; HttpOnly # no SameSite = vulnerable
Set-Cookie: session=abc123; SameSite=None # explicitly allows cross-site
# Missing CSRF headers
# No X-Frame-Options or permissive CORS
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true # dangerous combo
JS / DOM Patterns
// Static or predictable CSRF tokens
meta[name="csrf-token"] // grep if value changes across sessions
authenticity_token // Rails — check if reused across page loads// JSON endpoints without Content-Type enforcementfetch('/api/heartbeat', {method: 'POST', body: JSON.stringify(data)})
// No CSRF token in form at all
<form method="POST" action="/accounts/link"> // no hidden token field
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
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=Strict or Lax.
Test token staticness — Log in twice (different sessions or incognito). Compare authenticity_token / csrfmiddlewaretoken / csrf-token values 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-urlencoded to a JSON endpoint
Send text/plain with a JSON body
If accepted, HTML form can trigger it cross-origin
Hunt OAuth/SSO RelayState — Intercept SAML/OIDC flows. Test if RelayState is 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.
Static CSRF tokens per session — Developers generate one token at login and reuse it. Airbnb bug: authenticity_token was 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: csrftoken reusable 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/json prevents CSRF. It does via CORS preflight — unless the server also accepts text/plain or application/x-www-form-urlencoded.
SameSite=None for cross-site embeds — Developers set SameSite=None to support iframe embeds or third-party integrations, inadvertently re-enabling CSRF.
OAuth RelayState not validated — Developers implement SAML/OIDC but treat RelayState as 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
Bypass: If attacker can set cookies (subdomain takeover, cookie injection via HTTP), they can set both the cookie and the form field to matching attacker-controlled values.
Bypass: Simple requests (form POST, text/plain) don't trigger preflight and can't set custom headers — but some servers only check for header presence, not value, and some frameworks accept requests without it.
Gate 0 Validation
What can the attacker DO right now? — The attacker must be able to trigger a specific state-changing action (account linking, email change, data deletion, social association) on behalf of the victim without any interaction beyond visiting a URL or page.
What does the victim LOSE? — Identify the concrete harm: account access (ATO), data exposure, financial loss, reputation damage. "A CSRF token is missing" is not impact — "attacker can link their Oculus account to victim's Facebook account, gaining full profile access" is impact.
Can it be reproduced in 10 minutes from scratch? — You must be able to: (a) create attacker and victim accounts, (b) host a static HTML PoC, (c) have victim visit PoC, (d) confirm the action executed in victim's account — all within 10 minutes with no additional prerequisites.
Real Impact Examples
Scenario 1: Social Account Takeover via Import Friends (Rockstar Games)
An attacker crafted a malicious page targeting the "Import Friends" OAuth integration. When an authenticated SocialClub user visited the page, the CSRF triggered the OAuth token exchange with an attacker-controlled social account. The victim's SocialClub account became permanently linked to the attacker's Facebook/social identity, enabling full account access without the victim's knowledge. Rated high severity due to complete account compromise path.
Scenario 2: Facebook Account Hijacking via Oculus Integration CSRF
During Oculus-Facebook account linking, the OAuth callback lacked proper CSRF state validation. An attacker could craft a URL that, when loaded by an authenticated Facebook user who had started the Oculus linking flow, would associate the attacker's Oculus device credentials with the victim's Facebook account. The attacker then had persistent access to the victim's Facebook profile through the Oculus app. The attack required only that the victim click a link while logged into Facebook.
Scenario 3: JSON API CSRF on Heartbeat/Activity Tracking
A POST endpoint accepting application/json was assumed CSRF-safe by developers. A researcher crafted an HTML form using enctype="text/plain" with an input name designed to produce syntactically valid JSON when submitted. The browser sent the request cross-origin without a preflight (no custom headers, text/plain is a simple request), cookies were attached, and the server processed the JSON body as legitimate — silently logging attacker-controlled activity data under the victim's account identity.
The following real, verified bug-bounty / coordinated-disclosure cases extend this skill. Four cases chain CSRF to full ATO; all five are modern (SameSite-era).
Argo CD — SameSite=Lax bypass via sibling subdomain + Content-Type abuse (CVE-2024-22424) (GHSA-92mw-q256-5vwg · Writeup)
Subclass: SameSite=None/Lax misconfig chain — same parent-domain bypass + JSON CSRF via missing Content-Type enforcement
Root cause: Argo CD did not enforce Content-Type: application/json, and SameSite=Lax is moot when the attacker controls any sibling subdomain of the shared parent
Year: 2023 reported, fixed Jan 2024 in 2.7.16/2.8.8/2.9.4
GitLab — CSRF on /api/graphql via GET-converted mutations (H1 #1122408)
Subclass: GET-state-changing endpoint (GraphQL mutations through GET requests)
Root cause: router matched the post-traversal path for execution but pre-traversal path for CSRF-protection scope, so the protected endpoint was reached without a valid token
Year: 2022 — $10,000
HackerOne self — CSRF on social account linking → ATO (H1 #1727221)
Subclass: account-link CSRF (social provider attach without state binding)
Payload: <img src="https://hackerone.com/users/social_accounts/google?code=ATTACKER_CODE&state=PREDICTABLE"> — victim's browser completes attacker-initiated link flow
Root cause: token bound to OAuth-link callback was either reused across attempts or not user-bound, so attacker-issued link callbacks were accepted on the victim's session — attacker's Google account becomes a valid login path = ATO
Year: 2022 — informational scope on H1 self-program, but public PoC
Duende BFF (commercial successor to IdentityServer4) is the canonical ASP.NET Core BFF library for SPAs. Its antiforgery primitive is non-standard and not user-bound: instead of ASP.NET Core's per-session/per-user double-submit token, Duende only requires the presence of a static header X-CSRF: 1 on every BFF-mapped endpoint. The header value is identical for every caller; it exists only to force a CORS preflight on cross-origin calls. This collapses CSRF defence to "same-origin + session cookie present" — and produces several distinct attack patterns when one BFF serves multiple privilege partitions.
Architecture primer: browser↔BFF authenticates via an encrypted HttpOnly session cookie (default .AspNetCore.Cookies); BFF↔API uses OAuth tokens cached server-side. Endpoints registered via MapBffManagementEndpoints / MapRemoteBffApiEndpoint / MapBffApiEndpoint enforce X-CSRF: 1 and session presence — nothing else. (docs.duendesoftware.com/bff, Duende blog Mar 2025)
Attack class 1 — X-CSRF: 1 is not user-bound, so cross-role replay succeeds same-origin
When a single BFF serves /admin/* and /user/* partitions, the antiforgery primitive cannot distinguish role-A from role-B. Any same-origin script that can land an XHR with X-CSRF: 1 and the victim's session cookie reaches admin endpoints if the victim has the admin role. Stock ASP.NET Core antiforgery (which binds the token to HttpContext.User.Identity.Name and rejects on identity change) does the right thing here; Duende BFF does not. (docs.duendesoftware.com/bff/fundamentals/options)
Payload shape: from a logged-in low-priv session, fetch('/bff/admin/users/delete?id=42', {credentials:'include', headers:{'X-CSRF':'1'}}) — succeeds if the victim's session happens to hold the admin role and the attacker can land any same-origin script (self-XSS, subdomain-takeover JS, dependency-confusion).
Attack class 2 — SignalR/WebSocket carve-out (the /negotiate shortcut)
Browser WebSockets cannot send custom headers, so X-CSRF: 1 cannot be enforced on the upgrade. Developers routinely work around this by excluding SignalR hub paths from BFF antiforgery (MapHub<X>().DisableAntiforgery() or registering them as non-BFF endpoints). Once excluded, any same-site origin (including a takenover sibling subdomain or a stored-XSS page) can open the WS with the ambient session cookie → CSRF-over-WebSocket to invoke hub methods that mutate state.
Attack class 3 — Cookie-domain wildcarding turns subdomain takeover into session fixation
BFF session cookies default to host-only, but developers commonly override with options.Cookie.Domain = ".example.com" to share login across app.example.com and admin.example.com. This drops the __Host- prefix protection. Take over legacy.example.com (CNAME to deprovisioned Heroku/S3) → set Set-Cookie: .AspNetCore.Cookies=<attacker_session>; Domain=.example.com → victim hits app.example.com carrying attacker's session = session-fixation ATO. (nestenius.se BFF cookie hardening)
Evidence strength
No Duende.BFF-direct CVE exists as of 2026-05. The three classes above are design-level / documented behaviour that becomes a live finding when paired with a co-resident primitive (same-origin script execution, SignalR carve-out, or subdomain takeover). Report severity should lean on the chain's business impact rather than CVE citation. Adjacent confirmed CVEs in the Duende ecosystem: CVE-2025-26620 (Duende.AccessTokenManagement race), CVE-2024-51987 (Duende.AccessTokenManagement.OpenIdConnect incorrect-token-after-refresh), CVE-2024-39694 (Duende.IdentityServer open redirect). (Duende advisories on GitHub)
Hunting checklist
curl --max-time 30 --connect-timeout 10 https://target/bff/user -H 'X-CSRF: 1' -b '<session>' — dumps the full claim set including internal IDs, role names, tenant IDs (info disclosure on its own).
Inspect Set-Cookie on /bff/login callback — flag Domain= attribute (vs __Host- prefix); flag missing Secure/HttpOnly.
From a low-priv session, replay admin-partition POSTs with X-CSRF: 1 to confirm no per-role token binding.
Enumerate SignalR/WS hubs (/hubs/*, /signalr/*) — open without X-CSRF; if 101 Switching Protocols, CSWSH-style attacks viable.
Subdomain inventory + DNS-takeover scan for any *.example.com if BFF cookie has Domain=.example.com.
CSRF on logout — logout CSRF is informational at best. No real impact unless chained with session fixation.
SameSite=Lax bypass assumptions — Lax cookies are sent on top-level GET navigations. CSRF via form GET may still work.
Anti-CSRF token without validation test — removing the token and getting 200 doesn't prove missing validation. The endpoint may use a different mechanism (double-submit cookie, custom header).
Content-Type bypass — if the server only checks Content-Type: application/json, try text/plain with JSON body or form-encoded with JSON-like structure.
CORS preflight bypass != CSRF — bypassing the OPTIONS preflight for CORS doesn't automatically enable CSRF. Different attack classes.
Related Skills & Chains
hunt-xss — Any XSS on a trusted origin neutralizes CSRF defenses (token, SameSite, Origin check) instantly. Chain primitive: XSS reads the meta[name=csrf-token] value and same-origin-fetches /accounts/email with attacker payload → one-click ATO via attacker-page postMessage triggering the stored XSS to perform the state change.
hunt-auth-bypass — CSRF combined with an auth-bypass primitive lets attacker-side scripts perform state changes that should have required step-up auth. Chain primitive: CSRF on /settings/password reaches an endpoint that skips the re-auth check → password change executes without the victim ever entering their current password → ATO.
hunt-oauth — OAuth/SAML state/RelayState is structurally a CSRF token; missing validation here is account-linking CSRF. Chain primitive: attacker initiates OAuth on their account, sends victim the /callback?code=X&state= URL → victim's logged-in browser completes the link → attacker's social identity now controls victim's account.
security-arsenal — Reach for the CSRF PoC templates (form POST, enctype=text/plain JSON, sandboxed-iframe null-origin, base64 multipart bypass) before writing one from scratch; also the WAF-bypass header variants for Origin/Referer checks.
triage-validation — Run the Pre-Severity Gate before submitting CSRF on a logout endpoint or any action without state-change consequence — those are the canonical N/A traps. Confirm victim LOSES something concrete (account access, money, data), not just "a request executed."