Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Sh Kb Csrf

ASecurity

Knowledge base for finding Cross-Site Request Forgery - state-changing requests that rely only on ambient credentials (cookies) with no anti-CSRF token or SameSite protection. Use when hunting CSRF. CWE-352, OWASP A01:2021-Broken Access Control.

14 stars
0 votes
0 copies
0 views
Added 9/28/2026
ai-agentsrustexpressspringapi

Works with

api

Security Analysis

A100/100

Scanned 9/28/2026

Install to Claude Code

$npx -y skills add dmdhrumilmistry/security-harness --skill sh-kb-csrf --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sh Kb Csrf?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Sh Kb Csrf
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dmdhrumilmistry-sh-kb-csrf/badge)](https://www.skillsdirectory.com/skills/dmdhrumilmistry-sh-kb-csrf)

More formats (shields.io, HTML) on the badges page.

Files
SKILL.md
---
name: sh-kb-csrf
description: "Knowledge base for finding Cross-Site Request Forgery - state-changing requests that rely only on ambient credentials (cookies) with no anti-CSRF token or SameSite protection. Use when hunting CSRF. CWE-352, OWASP A01:2021-Broken Access Control."
---

# Cross-Site Request Forgery (CSRF) - Hunter Knowledge Base

A logged-in victim's browser is tricked into sending a state-changing request; the app trusts the ambient
cookie and performs the action as the victim. Requires cookie-based auth and a missing anti-CSRF control.

## Preconditions to confirm first
1. The endpoint performs a **state change** (create/update/delete/transfer/settings).
2. Auth is via **ambient credentials** (session cookie / HTTP Basic), not a per-request header token that
   JS must attach (`Authorization: Bearer`) - pure Bearer-in-header APIs are generally not CSRF-able.
3. There is **no** effective anti-CSRF defense on that route.

## Sinks / patterns (grep targets)
State-changing route handlers (`POST`/`PUT`/`PATCH`/`DELETE`, or `GET` that mutates) that:
- lack CSRF middleware/decorator, or explicitly disable it: `csrf_exempt`, `@csrf.exempt`,
  `skip_before_action :verify_authenticity_token`, `csrf: false`, Spring `.csrf().disable()`,
  Express without `csurf`, `SameSite=None`/absent on the session cookie.
- Grep: `csrf_exempt|verify_authenticity_token|csrf().disable|csurf|SameSite|@csrf`.

## Detection recipe
1. From `codebase-map.json`, list state-changing endpoints and their auth mechanism.
2. Check the global CSRF posture: is protection enabled framework-wide? Then find per-route exemptions.
3. Check cookie flags: `SameSite=Lax/Strict` blocks most cross-site POSTs; `SameSite=None` re-opens it.
4. Confirm the endpoint doesn't already require a non-ambient token or a custom header (which forces a
   preflight and blocks simple cross-site requests).

## Payloads / PoC
- Auto-submitting form: an HTML page with `<form action="https://target/settings" method="POST">` and
  hidden inputs, plus `<script>document.forms[0].submit()</script>`; victim visiting it triggers the action.
- For JSON endpoints that accept `text/plain` or don't check content-type: a form with
  `enctype="text/plain"` crafting a JSON-ish body.
- GET-based state change: `<img src="https://target/delete?id=5">`.
- PoC = the victim, while logged in, loads the attacker page and the state change occurs.

## False-positive filters
- Anti-CSRF token required and validated (synchronizer token, double-submit cookie) on the route.
- `SameSite=Lax` (default in modern browsers) or `Strict` on the session cookie - mitigates most CSRF;
  note residual risk for top-level GET navigations under Lax.
- Auth is a header token the browser won't auto-attach cross-site (Bearer), not a cookie.
- Endpoint requires a custom header (forces CORS preflight) and CORS is not permissive.

## CWE / OWASP / severity
CWE-352. OWASP A01:2021. Severity by action impact: account/email/password change or money transfer ->
**high**; low-value toggles -> medium/low.

## Chaining hints
CSRF + `xss` (steal token then forge) ; CSRF to change email/password -> account takeover; CSRF to add an
attacker OAuth/app -> persistence; often combined with `access-control` to hit privileged actions.

## Mitigation
Enable framework CSRF protection on all state-changing routes (don't blanket-exempt); require a
synchronizer or double-submit token; set session cookies `SameSite=Lax`/`Strict` + `Secure`; prefer
non-ambient auth for APIs; require a custom header for JSON APIs and lock down CORS.

Attribution

dmdhrumilmistrydmdhrumilmistry
View sourceMore from dmdhrumilmistry →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

1074701 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

695601 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

691 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →