Web csrf

From NoorQureshi/security-skills · View interactive version

Web csrf is an AI agent skill from the GitHub repository NoorQureshi/security-skills. Cross-Site Request Forgery — force a victim's browser to perform state-changing actions. Load on state-changing requests (POST/PUT/DELETE) that rely only on cookies, missing/weak CSRF tokens, `SameSite=None`, or forms/JSON without anti-CSRF. Signals: cookie-only auth, no token, token not validated.

How to use this skill

Skill file

Cross-Site Request Forgery (CSRF)

When it applies

A state-changing action authenticated purely by an ambiently-sent credential (cookie) with no

unpredictable token the attacker's site can't know/replay.

Why it works

Browsers attach cookies to cross-site requests automatically. If the server accepts the action

on cookie alone, an attacker page can submit it on the victim's behalf. Anti-CSRF tokens /

SameSite cookies break this by requiring something cross-site JS can't supply.

Method

  1. Find a candidate: a sensitive action (change email/password, transfer, role) that changes state.
  2. Check the defenses: is there a CSRF token? Is it validated (remove it / reuse another

user's / swap value)? Is the cookie SameSite=Lax/Strict? Is it a simple request (no preflight)?

  1. Build the PoC: auto-submitting HTML form (or fetch for simple requests) that fires the

action; host it and load it as the victim.

  1. Bypass weak tokens: token not tied to session, predictable, accepted when blank, only

checked if present, or leaked via GET/referer.

  1. JSON endpoints: try Content-Type: text/plain/form-encoding to avoid preflight; if the

API accepts it, CSRF applies.

Gotchas

Verify success

Loading your PoC while authenticated as the victim performs the action (email changed, etc.)

with no interaction beyond visiting the page.

References

PortSwigger CSRF labs; OWASP CSRF Prevention Cheat Sheet.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.