Skip to main content
Cross-Origin Resource Sharing (CORS) enables servers to define who can access their assets from external sources. Misconfigurations allow attackers to steal sensitive data from authenticated users.

CORS Headers Reference

Access-Control-Allow-Origin: * combined with Access-Control-Allow-Credentials: true is not permitted by browsers. This combination is always rejected.

Exploitable Misconfigurations

Reflected Origin

When the server dynamically reflects the Origin header value in Access-Control-Allow-Origin:

Null Origin Exploit

Some applications whitelist null origin for local development. Use a sandboxed iframe to generate null origin:

Regex Bypass Techniques

XSS on Whitelisted Subdomain

If sub.requester.com is whitelisted and vulnerable to XSS:

Server-Side Cache Poisoning

If the server doesn’t sanitize the Origin header for illegal characters, inject HTTP headers via \r\n (0x0d 0x0a):
The response becomes:
If cached, this response is served to other users, enabling persistent XSS via UTF-7 encoding.

Client-Side Cache Poisoning

If the page reflects a custom header without encoding:
If the response is cached (without Vary: Origin), subsequent visits serve the poisoned response.

XSSI / JSONP Bypass

DNS Rebinding Attacks

DNS Rebinding via TTL

  1. Victim visits attacker’s page
  2. Attacker changes DNS A record (TTL=0) to internal IP
  3. Victim’s browser re-resolves DNS and now same-origin with internal service
  4. Attacker can read internal service responses
Tools: DNSrebinder, rebind.it

DNS Rebinding via Multiple IPs

  1. Set two A records: attacker IP + 0.0.0.0 (Linux/macOS)
  2. First request goes to attacker IP (serves payload)
  3. Attacker blocks their IP with iptables
  4. Second request resolves to 0.0.0.0 (localhost)
  5. Browser treats as same origin

DNS Rebinding over DoH (DNS-over-HTTPS)

Some DoH providers (NextDNS) replace private/loopback answers with 0.0.0.0, but Linux/macOS still route to local services.

Protections Against DNS Rebinding

  • Use TLS in internal services
  • Require authentication to access data
  • Validate the Host header on internal services
  • Implement HTTPS with valid certificates

Tools