Skip to content

AAK-MCP-SIDECAR-REBIND-001: Loopback bind used as access control with no Host-header allow-list

Severity
HIGH
Category
Transport Security (transport-security)
Scanner
agent_audit_kit/scanners/mcp_sidecar_http.py
Auto-fixable
No.
SARIF name
McpSidecarRebind

What it detects

An HTTP listener beside an MCP server binds 127.0.0.1 / ::1 and relies on that bind as its access control, with no Host-header allow-list (CWE-350, Reliance on Reverse DNS Resolution). This is the DNS-rebinding precondition: an attacker page resolves its own hostname to a public IP, then re-resolves it to 127.0.0.1, and the browser delivers the request to the loopback listener with an attacker-chosen Host header. The bind address never enters into it, because the packet genuinely does arrive on loopback. Only a Host-header allow-list rejects it. Suppressed when the app enforces request-borne credentials (bearer token, API-key header), which a rebinding attacker cannot supply; not suppressed by cookie or session auth, which the browser attaches on the attacker's behalf. Complements AAK-DNS-REBIND-001, which owns the MCP SDK's own StreamableHTTP transport; this rule stands down on those.

How to fix

Add a Host-header allow-list to the listener — FastAPI/Starlette's TrustedHostMiddleware, or an equivalent check that rejects any Host not in {localhost, 127.0.0.1, ::1}. Keep the loopback bind, but stop treating it as the control.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCP-SIDECAR-REBIND-001

Limitations

Detects a literal loopback bind. A bind address read from config at runtime is not resolved, so a server that defaults to loopback via a settings object will not be flagged.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-SIDECAR-REBIND-001.md: the page then shows that text, with the registry reference appended under it.