Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Python: CORS Bypass #16814

Merged
merged 1 commit into from
Sep 5, 2024
Merged

Commits on Sep 2, 2024

  1. WIP: Python: CORS Bypass

    This PR adds a query to detect a Cross Origin Resource Sharing(CORS) policy bypass due to an incorrect check.
    
    This PR attempts to detect the vulnerability pattern found in CVE-2022-3457
    
    ```python
    if request.method in ['POST', 'PUT', 'PATCH', 'DELETE']:
        origin = request.headers.get('Origin', None)
        if origin and not origin.startswith(request.base):
            raise cherrypy.HTTPError(403, 'Unexpected Origin header')
    ```
    
    In this case, a value obtained from a header is compared using `startswith` call. This comparision is easily bypassed resulting in a CORS bypass. Given that similar bugs have been found in other languages as well, I think this PR would be a great addition to the exisitng python query pack.
    
    The databases for CVE-2022-3457 can be downloaded from
    ```
    https://filetransfer.io/data-package/i4Mfepls#link
    https://file.io/V67T4SSgmExF
    ```
    porcupineyhairs committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    f86570f View commit details
    Browse the repository at this point in the history