Skip to content
Back to skills

Web Csrf Cors

ASecurity

Cross-Site Request Forgery and CORS misconfiguration testing — missing/weak/bypassable CSRF tokens, SameSite gaps, method and content-type tricks, and CORS flaws (reflected origin, null origin, wildcard+credentials, weak origin matching) that expose authenticated data cross-origin. Generates browser-loadable PoCs. Use for state-changing requests and cross-origin data access.

  • 16 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 17, 2026
securityrustawstestingapi

Works with

  • api

Security analysis

A100/100

Scanned November 17, 2026

npx -y skills add AnandJogawade/Zazy-Pentest-Plugin-for-Claude --skill web-csrf-cors --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Web Csrf Cors?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Web Csrf Cors
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/anandjogawade-web-csrf-cors/badge)](https://www.skillsdirectory.com/skills/anandjogawade-web-csrf-cors)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: web-csrf-cors
description: Cross-Site Request Forgery and CORS misconfiguration testing — missing/weak/bypassable CSRF tokens, SameSite gaps, method and content-type tricks, and CORS flaws (reflected origin, null origin, wildcard+credentials, weak origin matching) that expose authenticated data cross-origin. Generates browser-loadable PoCs. Use for state-changing requests and cross-origin data access.
---

# CSRF & CORS

Two cross-origin problems: CSRF forces a victim's browser to perform state-changing actions; CORS misconfiguration lets an attacker origin *read* authenticated responses. Test both wherever cookies authenticate requests.

## Trigger phrases

`csrf, cross-site request forgery, samesite, csrf token, cors, cross-origin, access-control-allow-origin, origin reflection, preflight`

## Part A — CSRF

### 1. Identify candidates
State-changing requests authenticated by cookies (not by a header-based bearer token the attacker can't set): change email/password, transfer, delete, update settings, add user, make purchase.

### 2. Test the protections
- **No token / not validated:** remove the CSRF token or its value — does the action still succeed?
- **Token not tied to session:** use a token from another account/session; if accepted, protection is broken.
- **Token validation flaws:** empty token accepted, token only validated if present (drop the param entirely), token in body but checked loosely, predictable/static token, token leaked (GET/Referer/HTML).
- **Method bypass:** change `POST`→`GET`, use `X-HTTP-Method-Override`, or a method the check ignores.
- **Content-Type bypass:** if JSON is required, try `text/plain`/`application/x-www-form-urlencoded` (simple request, no preflight) — if the server still parses it, CSRF works.
- **SameSite reality check:** `SameSite=Lax` still allows top-level GET navigations (so GET state-change = CSRF); `Lax` has a brief default window nuance; `None` = no SameSite protection; check whether the session cookie sets it at all. Subdomain/`SameSite` + XSS-on-subdomain chains.
- **Double-submit / custom-header defenses:** can the header be set cross-origin? Is the double-submit cookie attacker-settable (subdomain cookie injection)?
- **Referer-based defense:** omit Referer (via `<meta name=referrer>`), or match a weak check (substring/attacker domain contains the allowed string).

### 3. Build the PoC
Generate an auto-submitting HTML form (or `fetch` for simple-request JSON/CORS cases) that performs the action when the victim loads it. Confirm in a real browser with a logged-in victim session. For GET-based, a single `<img>`/link suffices.

## Part B — CORS misconfiguration
Check `Access-Control-Allow-Origin` (ACAO) and `-Allow-Credentials` (ACAC) behavior by sending varied `Origin` headers:
1. **Reflected origin + credentials:** server reflects any `Origin` into ACAO and sets `ACAC: true` ⇒ any site can read authenticated responses. Critical.
2. **`null` origin + credentials:** `Origin: null` reflected with credentials ⇒ exploitable from sandboxed iframe / `data:` document.
3. **Wildcard `*`:** with credentials the browser blocks it, but `*` on authenticated non-credentialed data or internal APIs can still leak; wildcard subdomains are riskier.
4. **Weak origin matching:** `allowed.com` matched by substring/prefix/suffix — `allowed.com.attacker.com`, `attackerallowed.com`, `allowed.com.evil`, missing anchors, regex `.` treated literally; trusting all subdomains (then XSS/takeover on any subdomain → full read).
5. **Pre-flight / method gaps:** permissive `Allow-Methods`/`Allow-Headers`.

### Exploit
Host a page that `fetch`es the target with `credentials:'include'` from a malicious origin and exfiltrates the response (tokens, PII, CSRF tokens → chain to CSRF). Confirm actual cross-origin read.

## Depth & chaining
- CORS read of a CSRF token defeats token-based CSRF defense → chain to full CSRF.
- CSRF on email/password change ⇒ account takeover — demonstrate it.

## Evidence
Provide the working PoC (HTML/JS), the request/response showing the weak ACAO/ACAC or accepted forged request, and the resulting impact in a victim session.

Attribution

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

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.