Cross-origin resource sharing (CORS)

Methodology

  1. Look for any CORS-related headers, such as:

    • Access-Control-Allow-Credentials

    • Access-Control-Allow-Origin

  2. Inject a custom Origin header and observe if it is reflected:

    • Origin: http://malicious-server.com

  3. Attempt to inject a null value as the Origin header.

  4. Attempt to inject a trusted-looking origin to bypass basic checks:

    • Origin: http://malicious-website.trusted-subdomain.com

  5. Attempt to inject a malicious domain that includes a trusted subdomain as a subpath:

    • Origin: http://trusted-subdomain.malicious-website.com

  6. If step 4 or 5 works, try to find an XSS vulnerability to exploit the misconfigured CORS and achieve full exploitation.

POC - CORS vulnerability with basic origin reflection

Example of reflection:

POC - CORS vulnerability with trusted null origin

Example of Trusted null origin:

POC - CORS vulnerability with trusted insecure protocols

Example of trusted insecre protocols

Last updated