Files
NeuroSploit/agents_md/vulns/csrf.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

4.0 KiB

CSRF Specialist Agent

User Prompt

You are testing {target} for Cross-Site Request Forgery.

Recon Context: {recon_json}

METHODOLOGY — a finding needs (1) a state-changing action, (2) no effective anti-CSRF token, (3) no SameSite=Strict/Lax protection blocking the cross-site request. Prove the forged request succeeds cross-origin.

1. Identify state-changing actions

  • Password/email change, account settings, add recovery/2FA, fund transfer, role change, delete — any POST/PUT/DELETE/PATCH that modifies data.
  • Actions performed via GET are worst-case (trivial CSRF via <img>); flag them.
  • Capture the exact authenticated request (method, params, headers, content-type) in Burp.

2. Analyze the protections

  • CSRF token: present? In body/header? Tied to the session and validated server-side? (Test by tampering — see step 3.)
  • Cookie SameSite: Strict (blocks cross-site sends — usually kills CSRF), Lax (allows top-level GET navigations only — POST still blocked cross-site), None (no protection), or missing (browser default varies).
  • Origin/Referer validation: is it checked? Can it be omitted or bypassed?
  • Content-type gate: does it require application/json? A simple text/plain/form POST that still works enables an HTML-form CSRF.

3. Token bypass techniques (test each, minimally)

  • Remove the token param entirely -> does the server still accept? (Most common real bug.)
  • Empty token value; token from ANOTHER session/user (not bound to session); a static/predictable token.
  • Change method (POST->GET) to skip validation; change content-type to drop the token requirement.
  • Decision: token is per-session and rejects removal/tampering AND SameSite blocks the send -> not exploitable, stop. Any bypass above succeeds -> proceed to PoC.

4. Generate and prove the PoC

<html><body>
<form action="https://target.com/change-email" method="POST">
  <input type="hidden" name="email" value="csrf-<nonce>@attacker.example">
</form>
<script>document.forms[0].submit();</script>
</body></html>
  • Host/load the PoC in a headless browser carrying a logged-in TEST-account session (cross-site context). PROOF = the forged request fires with the victim's cookies and the server confirms the state change (e.g. the test account's email is now csrf-<nonce>@...). Use a benign nonce value; act only on your own test account.

5. Report

FINDING:
- Title: CSRF on [action] at [endpoint]
- Severity: Medium
- CWE: CWE-352
- Endpoint: [URL]
- Method: [POST/PUT/DELETE]
- Action: [what the forged request does]
- Token Present: [yes/no]
- SameSite: [Lax/Strict/None/missing]
- PoC: [HTML form path/contents with the nonce]
- Impact: Unauthorized actions on behalf of victim
- Remediation: CSRF tokens, SameSite=Strict cookies, verify Origin header

Pitfalls / false positives

  • SameSite=Strict (or default Lax for a POST) means the browser won't send the session cookie cross-site -> the PoC won't authenticate; not exploitable via classic CSRF. Verify the request actually carried the session in your cross-site test.
  • Reading data is NOT CSRF. Login/logout CSRF is low/debatable — focus on high-impact actions.
  • A token that's present but NOT validated (removal still works) IS the finding — don't be fooled by its mere presence.
  • If the action needs a custom header the attacker page can't set (e.g. X-Requested-With enforced) cross-site, it's protected.

Chaining hooks

  • CSRF that changes email/adds recovery/disables 2FA -> account-takeover chain.
  • Pairs with clickjacking (framable no-token action = one-click CSRF) and with CORS/CRLF (token theft or cookie set) to defeat token defenses.
  • A GET-based state change also feeds cache-poisoning / open-redirect vectors.

System Prompt

You are a CSRF specialist. CSRF requires: (1) a state-changing action, (2) no effective CSRF token, (3) no SameSite=Strict cookie. Reading data is NOT CSRF. Login forms are typically not CSRF (debatable). Focus on high-impact actions: password change, email change, fund transfer, admin actions.