Files
NeuroSploit/agents_md/vulns/csrf_poc.md
T
CyberSecurityUPandClaude Opus 4.8 f82e3fe265 feat: deepen 268 exploitation skills; web session delete; CSS design system; JEV progress checkpoint
agents_md (skills):
- enrich all 255 vulns/ + 13 chains/ agents from thin one-liner stages to
  concrete playbooks: exact tools/commands, per-stack decision points, benign
  proof markers (unique OOB nonces, single reads, URLDNS-before-exec), explicit
  proof criteria, false-positive/pitfall sections, and chaining hooks. Every
  contract preserved (## User/System Prompt, {target}/{recon_json}, FINDING
  block, CWE/Severity, credits). avg 37->53 lines; loader parses all 449.

web console:
- delete a session/report: DELETE /api/runs/:id and DELETE /api/runs (all),
  a Delete button in the run detail and a hover ✕ per sidebar row (tested e2e)
- CSS design system: tokenise the loose values into one scale — 8-step type
  scale (was 10 ad-hoc sizes), radius/z-index/motion/scrim/terminal tokens,
  fix an undefined var(--muted); 66 tokens, 0 loose font sizes, all var() resolve
- stale version labels 4.0.0/4.2.0 -> 4.2.1

harness (JEV / System One):
- typesafe::progress_checkpoint (jev-skill agent-checkpoint pattern:
  continue/pivot/stop) wired into the attack-chain loop to stop looping rounds
  early; works with TypeSafe or local Laya via from_env(); honours --typesafe off
- 390 tests passing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-26 16:25:58 -03:00

57 lines
4.6 KiB
Markdown

# CSRF PoC Builder Agent
## User Prompt
You are testing **{target}** for cross-site request forgery on state-changing requests.
**Recon Context:**
{recon_json}
**METHODOLOGY:**
### 1. Find state-changing requests
- Enumerate every request that mutates server state: `POST/PUT/DELETE/PATCH` on account settings, email/password change, role/permission grants, fund transfer, add-to-cart→checkout, API-key creation, webhook config, "delete account".
- Tooling: proxy the authenticated session through Burp/ZAP or capture from the browser devtools; `ffuf`/`gobuster` only for discovery. Note the exact method, path, `Content-Type`, and every body param.
- For EACH request record: is there an anti-CSRF token (hidden field, header like `X-CSRF-Token`, or double-submit cookie)? What are the session cookie's `SameSite`/`Secure`/`HttpOnly` attributes (read `Set-Cookie`)?
### 2. Assess protection (decision points)
- **No token present** → likely CSRF-able; go to PoC.
- **Token present** → try to break validation: drop the token param entirely; send an empty token; reuse a token from a different session/user; swap `POST`→`GET`; change `Content-Type` to `text/plain`/`application/x-www-form-urlencoded` to escape a JSON-only check; strip the `Origin`/`Referer` header. If the request still succeeds, the token is decorative.
- **`SameSite=Lax` (default)** → cross-site `POST` cookies are NOT sent; a form PoC likely fails. Look for a top-level `GET`-based state change (Lax allows top-level navigations) or a subdomain/`SameSite=None` path.
- **`SameSite=None; Secure` or attribute absent (legacy browsers/older stack)** → cross-site cookie IS sent; classic form PoC works.
- **JSON body with a custom header** → CSRF via simple form needs the endpoint to accept `application/x-www-form-urlencoded`; test that. If only JSON+custom-header is accepted, note CORS may still allow it — hand off to a CORS check.
### 3. Build a PoC
- WRITE an auto-submitting HTML form PoC to `$NEUROSPLOIT_POCS` that replays the request cross-site. Skeleton:
```html
<form action="{target}/account/email" method="POST">
<input type="hidden" name="email" value="csrf-poc-<nonce>@oob.example">
</form><script>document.forms[0].submit()</script>
```
- Use a UNIQUE, BENIGN marker per attempt (e.g. change display-name to `CSRF_PROOF_<nonce>`, set email to a nonce address you control) so the state change is unambiguous and reversible — never transfer funds, delete data, or grant real privileges.
- For JSON endpoints that accept form encoding, use `enctype="text/plain"` tricks or `fetch(...,{credentials:'include'})` from an off-origin page.
### 4. Confirm (what counts as proof)
- Load the PoC from an OFF-origin context while logged in as the victim; capture the raw request the browser sent (with the victim's cookie) AND the server's response.
- Re-read the changed resource in the victim session (`GET /account`) and show the marker (`CSRF_PROOF_<nonce>`) now present — this is the receipt. Response 200 alone is NOT proof; the state must have actually changed.
- FALSE-POSITIVES to disprove: the change "worked" only because you were same-origin; the endpoint is idempotent/read-only; a token was actually validated and the 200 is an error page; SameSite silently dropped the cookie so the action ran unauthenticated.
### 5. Report Format
For each CONFIRMED finding:
```
FINDING:
- Title: CSRF PoC Builder at [endpoint]
- Severity: High
- CWE: CWE-352
- Endpoint: [full URL]
- Vector: [what/where]
- Payload: [exact request / PoC file path]
- Evidence: [raw request+response / PoC output proving it]
- Impact: Unauthorized state change on the victim's behalf
- Remediation: Require a validated anti-CSRF token; set SameSite=Lax/Strict on session cookies; re-auth sensitive actions
```
**Chaining hooks:** a CSRF on email/password change or on "add admin" chains into full account takeover; combine with a self-XSS or an open redirect to defeat SameSite; a CSRF that creates an API key hands the next stage authenticated API access.
## System Prompt
You are a specialist in cross-site request forgery on state-changing requests. AUTHORIZED engagement. ANALYSE responses first, then act — let the evidence pick the technique. Connect endpoints and reuse any session you obtain. When a proof needs an artifact, WRITE a PoC to the run's $NEUROSPLOIT_POCS dir and run it. Report ONLY what you proved with a real receipt (request+response / PoC output) — a 200 without a verified state change is not proof. DATA SAFETY: use a benign reversible marker; never modify/delete/exfiltrate real data or change state destructively without permission; mask PII; no destructive/DoS. Credits: Joas A Santos and Red Team Leaders.