- Location
- assets/bin/gateway-monitor-server.js:1111
- Finding
- Sensitive Monitoring APIs Exposed on All Network Interfaces Without Authentication<![CDATA[
## Vulnerability Details
**File Location**: `assets/bin/gateway-monitor-server.js:1111-1206, 1307-1308`
**Vulnerability Type**: Unauthenticated network exposure of operational and session data
**Risk Level**: High
### Vulnerable Code
```javascript
const server = http.createServer((req, res) => {
const parsed = url.parse(req.url, true);
const pathname = parsed.pathname;
if (pathname === '/') return serveIndex(res);
if (pathname === '/api/logs/stream') {
return handleLogStream(req, res, parsed.query || {});
}
if (pathname === '/api/minimax-coding-plan') {
const force = String(parsed.query.force || '').trim() === '1';
loadMiniMaxCodingPlan(force)
.then((payload) => json(res, payload))
.catch((err) => json(res, {
now: new Date().toISOString(),
ok: false,
statusMsg: 'request_failed',
keyMasked: null,
source: null,
windowHours: 5,
models: [],
error: String(err?.message || err)
}, 500));
return;
}
if (pathname === '/api/gateway-status') {
const gateway = gatewayStatus();
return json(res, {
now: new Date().toISOString(),
gateway,
model: currentModel(),
context: sessionContextStatus(),
metrics: buildMetrics(gateway)
});
}
if (pathname === '/api/context-status') {
return json(res, {
now: new Date().toISOString(),
context: sessionContextStatus()
});
}
if (pathname === '/api/sessions') {
const ctx = sessionContextStatus();
return json(res, {
now: new Date().toISOString(),
ok: ctx.ok,
primary: ctx.ok ? {
percentUsed: ctx.percentUsed,
totalTokens: ctx.totalTokens,
contextTokens: ctx.contextTokens,
remainingTokens: ctx.remainingTokens,
model: ctx.model,
abortedLastRun: ctx.abortedLastRun
} : null,
sessions: ctx.sessions || [],
error: ctx.error || null
});
}
if (pathname === '/api
...[truncated 2930 chars]
- Remediation
- <![CDATA[
## Remediation Suggestions
1. Bind the server to `127.0.0.1` and, if needed, separately to `::1`:
```javascript
server.listen(PORT, '127.0.0.1', callback);
```
2. If remote monitoring is required, use TLS and strong authentication with per-user authorization.
3. Reject requests with unexpected `Host` and `Origin` headers.
4. Add a comprehensive log-redaction layer for credentials, tokens, authorization headers, cookies, local paths, and personal identifiers.
5. Reduce API responses to the minimum data needed for monitoring.
6. Protect the Server-Sent Events endpoint with the same authentication and authorization controls as normal API routes.
7. Document the network listener and provide firewall guidance.
8. Add automated tests confirming that unauthenticated remote clients cannot access sensitive endpoints.
]]>