Automating the CORS Vulnerability Scan

Angix black
3 min readSep 15, 2024

--

When conducting a bug bounty, automating your scanning process not only saves time but ensures you don’t miss common vulnerabilities. One such vulnerability is Cross-Origin Resource Sharing (CORS) misconfigurations, which can expose sensitive data or allow unauthorized access to APIs.

Here’s a methodology to automate the scanning of CORS misconfigurations using common tools.

Step 1: Subdomain Enumeration

The first step in any bug bounty process is to gather subdomains. Subdomains are often vulnerable to various attacks, and they can lead to an expanded attack surface. For this, we’ll use subfinder, a fast and reliable subdomain enumeration tool.

Command:

subfinder -d example.com -o subd.txt
  • -d example.com: Specifies the target domain.
  • -o subd.txt: Saves the discovered subdomains into a file named subd.txt

This step will output a list of subdomains related to the target domain (e.g. example.com). The next step is to verify which of these subdomains are live.

Step 2: HTTP Probing for Live Subdomains

After gathering subdomains, it’s essential to check which ones are actually live and accessible over the web. We use httpx-toolkit for this. This tool sends HTTP requests to each subdomain and reports whether they are active on various ports

Command:

httpx-toolkit -list subd.txt -ports 80,443,8080,8000,8888 -threads 200 -output live.txt
  • -list subd.txt: Input file containing the list of subdomains to probe.
  • -ports 80,443,8080,8000,8888: Specifies the ports to check (common HTTP/S ports).
  • -threads 200: Sets the number of concurrent threads for faster probing.
  • -output live.txt: Saves the results of live subdomains to live.txt.

Step 3: CORS Vulnerability Scanning with Corscan

To identify CORS (Cross-Origin Resource Sharing) misconfigurations, Corscan is a robust tool designed for efficient detection of CORS issues across multiple domains. CORS vulnerabilities can lead to serious risks like unauthorized data access or session hijacking. Crsn automates and streamlines this scanning process, making it easier to find these issues at scale.

Command :

crsn -f live.txt -t 100 --filter
  • -f live.txt: Specifies the file containing live subdomains
    Be sure it have https://$
  • -t 100: Sets the number of concurrent threads for faster scanning (100 in this example).
  • --filter: Helps narrow down results by filtering out irrelevant domains and focusing on those with potential vulnerabilities.

Corscan GitHub

By following this methodology and utilizing tools like
Subfinder, Httpx,Corscan,
you can effectively automate your CORS vulnerability scanning and enhance your bug bounty efforts. Automating these processes not only improves efficiency but also helps in identifying critical vulnerabilities that could lead to serious security issues.

Watch Youtube Video

If you have any questions or need further assistance, feel free to reach out. You can connect with me through my social media channels for more updates, tips, and discussions on cybersecurity and pentesting:

Happy hunting and stay secure!

--

--