CORS
Cross Origin Resource Sharing misconfiguration exploits
A CORS policy allows developers to selectively relax SOP restrictions and allow controlled cross-origin requests. It's a browser security policy that's declared through the Access-Control-Allow-Origin and Access-Control-Allow-Credentials response headers.

CORS Misconfiguration
Detection
Send a request with a likely trusted origin in the Origin: request header and examine the response for any CORS policy reflections.
Scanner
Nuclei template
https://github.com/coffinxp/priv8-Nuclei/blob/main/cors.yaml
Burp Extension

To use this extension, simply click on the “Activate CORS* checkbox” and browse your target to let the extension do its magic. It will attempt different CORS bypass techniques for all requests passing through your Burp proxy. All you need to do is to check the results.

URL Validation Bypass
Bypassing weak regex pattern validations
Null Access-Control-Allow-Origin
Payload: Use a sandboxed iframe with allow-scripts and srcdoc to execute a script that:
Sends a request to
https://api.example.com/api/account/billingincluding the user's cookies (credentials: 'include').Reads the response, encodes it in base64, and sends it to a malicious server at
http://attacker-server/collector.
Resources
Interesting Books
Interesting BooksThe Web Application Hacker’s Handbook The go-to manual for web app pentesters. Covers XSS, SQLi, logic flaws, and more
Bug Bounty Bootcamp: The Guide to Finding and Reporting Web Vulnerabilities Learn how to perform reconnaissance on a target, how to identify vulnerabilities, and how to exploit them
Real-World Bug Hunting: A Field Guide to Web Hacking Learn about the most common types of bugs like cross-site scripting, insecure direct object references, and server-side request forgery.
Support this Gitbook
I hope it helps you as much as it has helped me. If you can support me in any way, I would deeply appreciate it.
Last updated
