MCP07
- Location
src/controller/security.ts:518- Finding
Unauthenticated Agent Invocation Through an Unpaired Container Controller ## Remediation Suggestions 1. **Fail closed for non-loopback listeners.** Refuse controller startup on `0.0.0.0`, `::`, or another non-loopback address unless effective inbound authentication is configured. Apply protection equivalent to the worker service’s existing non-loopback startup check. 2. **Separate authentication from pairing state.** Require valid credentials for privileged controller routes regardless of whether devices have been paired. An empty device list must not imply anonymous access. 3. **Secure initial enrollment.** Keep bootstrap enrollment on a loopback-only listener, or require a cryptographically random, short-lived startup secret delivered through a trusted local channel. 4. **Protect HTTP and WebSocket surfaces consistently.** Authenticate agent invocation, task mutation, workspace access, configuration changes, and event subscriptions. Retain browser-origin and fetch-metadata checks as additional defenses. 5. **Preserve protection after device revocation.** Removing the final paired device should leave the controller locked and require secure recovery rather than reopening anonymous API access. 6. **Make network exposure explicit.** Default to loopback even in containers unless the operator deliberately enables remote access. Document authentication requirements and recommended firewall restrictions. 7. **Add regression tests.** Verify that an unpaired controller rejects unauthenticated network requests to intake and other privileged endpoints, including requests without `Origin` or `Sec-Fetch-Site`. Test startup without credentials and behavior after revoking the last device.
- Content
View full analysis
Vulnerability Details
File Location:
src/controller/controller-service.ts:375,413— binds the container controller to all network interfaces.src/controller/security.ts:253–255,518–521— disables authentication when no paired devices exist.src/controller/route-table.ts:513— exposes the controller intake route.src/controller/controller-routes.ts:197–209— accepts and forwards the caller-supplied message.src/controller/controller-intake.ts:649–654— submits the message to the agent runtime.
Vulnerability Type: Missing Authentication for Critical Function — CWE-306
Risk Level: HighTechnical Analysis
The controller determines whether authentication is required from its device-pairing state. When no devices have been paired, requests pass the security middleware without presenting credentials. In container deployments, the controller simultaneously binds to all interfaces rather than restricting access to loopback.
The following code segments establish the request-to-execution path.
Network listener —
src/controller/controller-service.ts:375,413:ts const listenHost = isContainer ? "0.0.0.0" : "127.0.0.1";ts server.listen(port, listenHost, () => {Authentication activation condition —
src/controller/security.ts:253–255:ts export function isProtectionOn(state: TeamState | null): boolean { return (state?.security?.devices?.length ?? 0) > 0; }Unauthenticated allowance —
src/controller/security.ts:518–521:ts if (!protectionOn) { recordNonLanPeerSignal(deps, state, peer, pathname); return true; }Intake route registration —
src/controller/route-table.ts:513:ts { method: "POST", path: "/api/v1/controller/intake", handler: controllerIntakeRoute },Caller-controlled message handling —
src/controller/controller-routes.ts:197–209:ts const body = await parseJsonBody(req); const message = typeof body.message === "string" ? body.messag ...[truncated 3402 chars]
