-
Notifications
You must be signed in to change notification settings - Fork 209
Unauthenticated Server Bound to All Network Interfaces #305
Copy link
Copy link
Open
Description
Summary
The Express HTTP server is unconditionally started on the wildcard address '0.0.0.0', binding to every network interface, and no authentication middleware is registered on any route:
// src/server.ts:233
app.listen(port, '0.0.0.0', () => { // ← binds to ALL interfaces
console.error(`MCP server endpoint at http://localhost:${port}/mcp`);
});No API key, Bearer token, or any other credential check exists anywhere in the middleware chain. Any TCP connection reaching the port — whether from loopback, LAN, VPN, or a Docker bridge — is served as a fully privileged MCP client.
Related | CVE-2026-23744 (MCPJam Inspector — 0.0.0.0 bind + no auth)
Scenario
- Developer starts
dbhub --transport=http --dsn="postgres://..."on a
workstation connected to a shared office network. - Any other machine on the same subnet sends a single HTTP POST to
http://<developer-LAN-IP>:8080/mcpwith a JSON-RPCinitializerequest —
no credentials required. - After the handshake, the attacker calls
execute_sqlto dump, modify, or
delete data in the connected database:
Patch Idea
Step 1 — Bind to loopback only unless the operator explicitly overrides:
// src/config/env.ts — add bind address resolution
export function resolveBindAddress(): string {
return process.env.DBHUB_BIND_ADDRESS ?? '127.0.0.1';
}// src/server.ts — replace '0.0.0.0' with the resolved address
const bindAddress = resolveBindAddress();
app.listen(port, bindAddress, () => { ... });Step 2 — Add token-based authentication for production use:
// src/server.ts — add before all routes
const API_TOKEN = process.env.DBHUB_API_TOKEN;
if (API_TOKEN) {
app.use('/mcp', (req, res, next) => {
const auth = req.headers.authorization ?? '';
if (auth !== `Bearer ${API_TOKEN}`) {
return res.status(401).json({ error: 'Unauthorized' });
}
next();
});
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels