-
Notifications
You must be signed in to change notification settings - Fork 27
[BUG] Security: Overly Permissive CORS Configuration Allows Any Origin to Access API #20
Copy link
Copy link
Closed
CortexLM/vgrep
#3Labels
bugSomething isn't workingSomething isn't workinginvalidThis doesn't seem rightThis doesn't seem rightvgrep
Description
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 GMTSystem Information
Bounty Version: 0.1.0
OS: Ubuntu 24.04 LTS
CPU: AMD EPYC-Genoa Processor (8 cores)
RAM: 15 GBScreenshots
No response
Steps to Reproduce
- Start the vgrep server: vgrep serve
- 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}' - 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinginvalidThis doesn't seem rightThis doesn't seem rightvgrep