T05 · Unauthorized Access and Privilege Escalation
- Location
lib/auth.js:3- Finding
Authentication Bypass When No API Key Is Configured
- Content
View full analysis
{ ``` ### Technical Analysis If neither `API_KEY` nor `GCG_API_KEY` is configured, the effective API key is an empty string. Express can parse a query such as `?api_key=` as an empty string, causing the supplied value to equal the configured empty value. Consequently, authentication fails open rather than refusing to start or rejecting all remote requests. In addition, accepting credentials in query parameters exposes them to access logs, browser history, reverse-proxy logs, and monitoring systems. Because `app.listen(PORT)` does not specify a loopback address, Node.js normally listens on all available interfaces. The documented assumption that the gateway is local therefore does not enforce a network security boundary. ### Attack Path 1. The administrator starts the service without setting `API_KEY` or `GCG_API_KEY`. 2. The service listens on port 8188 on network-accessible interfaces. 3. A remote attacker sends a request such as: ` ...[truncated 835 chars]- Remediation
View remediation
