Skip to content

[BUG] Security: Overly Permissive CORS Configuration Allows Any Origin to Access API #20

@EnthusiasticTech

Description

@EnthusiasticTech

Project

vgrep

Description

The vgrep server configures CORS with allow_origin(Any), allow_methods(Any), and allow_headers(Any). This allows any website to make cross-origin requests to the vgrep API, potentially enabling malicious websites to extract indexed code from users' machines when the server is running.

Error Message

Debug Logs

< HTTP/1.1 200 OK
< content-type: application/json
< vary: origin, access-control-request-method, access-control-request-headers
< access-control-allow-origin: *
< content-length: 43
< date: Mon, 19 Jan 2026 11:49:03 GMT

System Information

Bounty Version: 0.1.0
OS: Ubuntu 24.04 LTS
CPU: AMD EPYC-Genoa Processor (8 cores)
RAM: 15 GB

Screenshots

No response

Steps to Reproduce

  1. Start the vgrep server: vgrep serve
  2. Run the following curl command to simulate a request from an external origin:
    curl -v -X POST http://127.0.0.1:7777/search \ -H "Content-Type: application/json" \ -H "Origin: https://evil-website.com" \ -d '{"query": "password", "max_results": 3}'
  3. Observe the response headers

Expected Behavior

The server should reject requests from untrusted origins, or at minimum restrict CORS to localhost (127.0.0.1) by default. The response should NOT include access-control-allow-origin: *.

Actual Behavior

The server accepts the request and returns:
access-control-allow-origin: *
The request from https://evil-website.com is processed and results are returned.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem rightvgrep

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions