Skip to content
Skillpedia
Security5.4k Β· #14902

hunt-cors

What it does

This skill tests CORS settings that could let an attacker's site read sensitive responses from a logged-in user's account. It is for authorized testing of web apps and APIs.

When to use it

  • βœ“When an API returns private data and sends CORS headers.
  • βœ“When a site reflects any origin in its CORS settings.
  • βœ“When you want to confirm whether a cross-site read is possible in a real browser.

Skill link

https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-cors/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-cors/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCan you check whether our API lets other websites read account data from a logged-in browser in our authorized test?”

5 new skills a week. 1 minute to read.

How it works

The agent sends requests from a test origin and checks the CORS headers. It confirms a finding only when a browser can actually read the private response.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

HUNT-CORS β€” Cross-Origin Resource Sharing Misconfiguration

What actually pays (and what does not)

CORS pays High only when an attacker-controlled origin can perform a credentialed cross-origin read of sensitive authenticated data, and you have a browser PoC proving the response body is readable from evil.com.

Two hard browser rules that kill most "findings" β€” check these FIRST:

  • Access-Control-Allow-Origin: * CANNOT be combined with credentials. If the server returns ACAO: *, the browser refuses to send/expose the response for a credentials: include request. A wildcard-only endpoint is not credential-exploitable. It is only interesting if the data it serves is sensitive without a session (rare) β€” usually this is Informational/Low.
  • Access-Control-Allow-Credentials: true is meaningless on its own. It matters only if ACAO reflects/allows your specific attacker origin AND a cross-origin credentialed fetch actually returns a readable body. ACAC on a response that does not reflect your origin proves nothing.

If you cannot demonstrate a readable cross-origin authed body in a real browser, you do not have a High. Do not submit header-diffing alone.


Crown Jewel Targets

  • Reflect-any-origin + credentials β€” server echoes the Origin header AND sets ACAC: true β†’ any site reads authed API responses. The classic High.
  • Null-origin trust β€” ACAO: null + ACAC: true. A sandbox iframe (or a data:/redirect chain) emits Origin: null, so any page can read authed data.
  • Subdomain-regex bypass β€” trusted-origin regex with a parsing flaw. The correct payload depends on which flaw (see Phase 3 β€” this is where most skills get it wrong).
  • Subdomain takeover β†’ trusted origin β€” a dangling subdomain that the CORS policy trusts; take it over, host the PoC there (see hunt-subdomain).
  • postMessage missing/loose origin check β€” handler that processes event.data without strictly validating event.origin.

Attack Surface Signals

Any endpoint returning an Access-Control-Allow-Origin header
API endpoints:   /api/*, /v1/*, /graphql
Profile/account: /api/me, /api/profile, /api/user, /api/session
Secrets/tokens:  /api/tokens, /api/keys, /api/csrf, /api/account/settings
Financial:       /api/balance, /api/transactions
Admin/internal:  /api/admin/*, /api/internal/*

Prioritize endpoints that (a) require a session cookie and (b) return PII, tokens, CSRF tokens, or other secrets in the body.


Step-by-Step Hunting Methodology

Phase 1 β€” Discover CORS endpoints

# Probe API endpoints. Use GET (not -I): some servers only emit CORS on GET,
# and -I sends HEAD which may be handled differently.
while read url; do
  result=$(curl -s -D - -o /dev/null "$url" \
    -H "Origin: https://evil.com" \
    -H "Cookie: $SESSION_COOKIE" | grep -i "access-control")
  [ -n "$result" ] && echo "=== $url ===" && echo "$result"
done < recon/$TARGET/api-endpoints.txt

# httpx bulk check
cat recon/$TARGET/live-hosts.txt | awk '{print $1}' | \
  httpx -H "Origin: https://evil.com" -match-string "access-control-allow-origin"

Phase 2 β€” Reflect-any-origin + null origin

# Does the server reflect an arbitrary Origin back?
curl -s -D - -o /dev/null https://$TARGET/api/me \
  -H "Origin: https://evil.com" \
  -H "Cookie: $SESSION_COOKIE" | grep -i "access-control"

# Vulnerable (the High case):
#   Access-Control-Allow-Origin: https://evil.com   <- reflects attacker origin
#   Access-Control-Allow-Credentials: true          <- + credentials => readable
#
# NOT exploitable for credentialed theft:
#   Access-Control-Allow-Origin: *                   <- browser blocks creds read
#   (no ACAC, or ACAC absent)                        <- not credentialed

# Null-origin trust
curl -s -D - -o /dev/null https://$TARGET/api/me \
  -H "Origin: null" \
  -H "Cookie: $SESSION_COOKIE" | grep -i "access-control"
# Looking for:  Access-Control-Allow-Origin: null  +  ACAC: true

Phase 3 β€” Subdomain / trusted-origin regex bypass

The right payload depends on which regex flaw the server has. Identify the class first, then send the matching payload. Getting this wrong wastes the test and produces false negatives.

Server regex (intended: trust *.target.com) Flaw Bypass origin that matches Why
^https?://.*\.target\.com$ None β€” escaped dot + end-anchor. Correct. (no simple bypass) `evil.
FAQ

Is a wildcard origin enough for a finding?

Usually no. The skill says a wildcard origin cannot be used with credentials, so it is often low severity.

Why must it be tested in a browser?

Header checks alone can mislead, so the skill requires proof that a browser can read the response.

Does it cover subdomain tricks?

Yes. It covers weak subdomain matching and null origin trust.

Details

Original description by the author

Hunt CORS Misconfiguration β€” origin-reflection with credentials, null-origin trust, subdomain-regex bypass (unanchored vs unescaped-dot vs prefix-only), pre-flight (OPTIONS) gating bypass, postMessage origin checks. High only when an attacker-controlled origin can perform a CREDENTIALED cross-origin read of sensitive data and you have proven it in a browser. Use when testing API endpoints, SPAs, or any app emitting Access-Control-* headers.

repo: elementalsouls/Claude-BugHunter

Popularity

GitHub stars
5.4k
Ranking position
#14902
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills