Coder Social home page Coder Social logo

chenjj / corscanner Goto Github PK

View Code? Open in Web Editor NEW
1.0K 1.0K 178.0 2.74 MB

🎯 Fast CORS misconfiguration vulnerabilities scanner

Home Page: https://pypi.org/project/cors/

License: MIT License

Python 100.00%
cors cors-misconfigurations cors-policy cors-scanner python python3 vulnerability-scanners web-security

corscanner's People

Contributors

chenjj avatar golim avatar hayicle avatar malayke avatar phackt avatar razapoonja avatar ritiksahni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

corscanner's Issues

Rename package

Thanks for the useful package! One thing though:

> pip install cors

I think is somewhat misleading and probably confusing for package maintainers who include this package, because I’m not including CORS but a CORS scanner. So, could you please rename the package

name='cors',

from cors to corscanner such that:

> pip install corscanner

WARNING Found misconfiguration! -1

Hello,

When running CORScanner on a list with multiple subdomains - the following is being outputed:

2019-10-02 16:24:38 WARNING Found misconfiguration! -1
2019-10-02 16:24:38 WARNING Found misconfiguration! -1
2019-10-02 16:24:39 WARNING Found misconfiguration! -1
2019-10-02 16:24:39 WARNING Found misconfiguration! -1
2019-10-02 16:24:39 WARNING Found misconfiguration! -1

Any idea why is this happening?
Thanks

sqlite3.OperationalError: unable to open database file

please help he how to resolve this issue ?

Traceback (most recent call last):
File "/usr/share/command-not-found/CommandNotFound/util.py", line 23, in crash_guard
callback()
File "/usr/lib/command-not-found", line 90, in main
cnf = CommandNotFound.CommandNotFound(options.data_dir)
File "/usr/share/command-not-found/CommandNotFound/CommandNotFound.py", line 79, in init
self.db = SqliteDatabase(dbpath)
File "/usr/share/command-not-found/CommandNotFound/db/db.py", line 12, in init
self.con = sqlite3.connect(filename)
sqlite3.OperationalError: unable to open database file

Questions about tools

Hi.

Does the CORScanner tool support all the features of the "CORStest" tool?

What's the difference?

Questions about redirection method

In the common/corscheck.py file, when the request is sent in the send_req method, the allow_redirects parameter is set to True. What are the considerations for this design? When detecting domain name A, if there is a redirection, I think the response from the first request should be used to determine whether the vulnerability exists, because after redirecting to domain B, the access-control-allow-origin parameter is set by domain B, it can no longer reflect the CORS status of the domain A.

[enchancement] response status code in results

Hi Jianjun,

Hope you're well. Using CORScanner on a big scope i realized that i have a lot of false positive on 404 pages returning a permissive CORS. What do you think to add the last response status code in the json result in order to let people filter on code 200 for example?

Have a nice day.

Error in windows

Traceback (most recent call last):
File "cors_scan.py", line 6, in
from common.logger import Log
File "C:\..\..\CORScanner-master\common\logger.py", line 1, in
import fcntl
ImportError: No module named fcntl

Trust_null with wrong result

Hi,

As i tested in portswigger lab - The result is wrong with trust_null.

2020-08-12 17:24:32 INFO Start checking trust_null for https://acbd1f041e7e90af80c6221d008d000c.web-security-academy.net/accountDetails

response_header={'access-control-allow-origin': 'null', 'access-control-allow-credentials': 'true', 'content-type': 'application/json; charset=utf-8', 'x-xss-protection': '0', 'content-encoding': 'gzip', 'connection': 'close', 'content-length': '98'}
=> vulnerable
2020-08-12 17:24:34 INFO nothing found for {url: https://acbd1f041e7e90af80c6221d008d000c.web-security-academy.net/accountDetails, origin: null, type: trust_null}
=> however nothing found

May you please have a look ?
Have a nice day ^^!

RuntimeError: cannot release un-acquired lock

python 3.9

In [1]: from CORScanner.cors_scan import cors_check
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in _load_unlocked(spec)

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap_external.py in exec_module(self, module)

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

~/anaconda3/envs/similarity_search_server/lib/python3.9/site-packages/CORScanner/cors_scan.py in <module>
     10 from common.logger import Log
---> 11 from common.corscheck import CORSCheck
     12 

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in __exit__(self, *args, **kwargs)

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in release(self)

RuntimeError: cannot release un-acquired lock

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-1-9fd17dbd0daa> in <module>
----> 1 from CORScanner.cors_scan import cors_check

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in _find_and_load(name, import_)

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in __exit__(self, *args, **kwargs)

~/anaconda3/envs/similarity_search_server/lib/python3.9/importlib/_bootstrap.py in release(self)

RuntimeError: cannot release un-acquired lock


Remove huge banner

Much as I like the cors Python module, and I appreciate the careful dedication of its author, the huge banner violates a core principal of UNIX / Linux program design. I wish the author would remove it, or only generate it when a user elects to display it by providing a command-line option.

Expect the output of every program to become the input to another, as yet unknown, program.
Don't clutter output with extraneous information.

– Doug McIlroy, the inventor of UNIX pipes and one of the founders of the UNIX tradition, from which Linux has evolved.

Workaround

You can filter out the banner with the following code (might not work on macOS):

cors -u example.com  | sed -n '/^Starting/,$p'

I wrote about this in my blog.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.