CorsScan is a powerful and efficient Bash script designed to detect Cross-Origin Resource Sharing (CORS) vulnerabilities in web applications. CORS misconfigurations can lead to significant security risks, including unauthorized data access and exploitation. CorsScan helps you identify and address these vulnerabilities effectively.
CORS is a critical mechanism in web applications that allows or restricts resource sharing between different origins. Misconfigurations in CORS headers can:
- Expose sensitive data to unauthorized origins.
- Allow unsafe HTTP methods like
PUT
orDELETE
. - Enable attackers to bypass Same-Origin Policy (SOP).
Manually detecting these issues can be time-consuming and error-prone. Developers and security researchers need a tool to automate this process while maintaining accuracy.
CorsScan automates the detection of CORS vulnerabilities in a given list of URLs. It checks for:
- Wildcard
*
in theAccess-Control-Allow-Origin
header. - Reflection of the origin in the
Access-Control-Allow-Origin
header. - Unsafe methods like
PUT
orDELETE
in theAccess-Control-Allow-Methods
header. - Allowing all headers in
Access-Control-Allow-Headers
. - Misuse of credentials in
Access-Control-Allow-Credentials
.
With concurrent processing, CorsScan ensures fast and reliable results without compromising quality.
- Banner Display: A user-friendly banner on startup.
- Concurrent Execution: Processes multiple URLs simultaneously for increased speed.
- Detailed Detection: Checks multiple aspects of CORS misconfigurations.
- Customizable: Easily adaptable for different use cases.
- Bash (pre-installed on most Linux and macOS systems).
curl
command-line tool.
-
Clone the repository:
git clone https://github.com/YogSec/CorsScanner.git cd CorsScanner
-
Make the script executable:
chmod +x cors.sh
./cors.sh -h
Output:
##########################################
# CorsScan #
# CORS Vulnerability Scanner #
##########################################
Usage: ./cors.sh [OPTIONS]
Options:
-h Show help section.
-w <path> Execute the code with the specified wordlist path.
-s <file> Save the output to the specified file.
-v Show script version.
Provide a file containing a list of URLs to check:
./cors.sh -w path/to/wordlist
Example:
./cors.sh -w urls.txt
Specify a file to save the output:
./cors.sh -w path/to/wordlist -s output.txt
Example:
./cors.sh -w urls.txt -s results.txt
./cors.sh -v
urls.txt:
https://example.com
https://test.com
https://vulnerable.com
Running:
./cors.sh -w urls.txt
Output:
https://vulnerable.com has CORS misconfiguration: wildcard (*) in Access-Control-Allow-Origin
https://test.com reflects the origin in Access-Control-Allow-Origin
https://example.com allows unsafe methods in Access-Control-Allow-Methods: DELETE
https://vulnerable.com allows credentials with Access-Control-Allow-Credentials: true
- Improved Security: Quickly identifies and addresses CORS vulnerabilities.
- Time-Saving: Automates a tedious manual process.
- Scalable: Handles large URL lists efficiently.
- Customizable: Modify the script to suit specific testing requirements.
Hi! I am Abhinav Singwal, a security researcher passionate about helping the community secure their applications. Feel free to connect with me:
- Email: abhinavsingwal@gmail.com
- LinkedIn: https://www.linkedin.com/in/bug-bounty-hunter/
If you find CorsScan useful, consider supporting my work by buying me a coffee:
Thank you for your support! Together, we can build a safer web.