Skip to main content

SKY-D243 · Security in code

MCP server open on every network interface without authentication

CriticalCWE-1327

Binding a server to 0.0.0.0 makes it listen on every network interface of the machine, not just on the machine itself. SKY-D243 reports a Python MCP server started with host="0.0.0.0" and no authentication passed to run().

Languages
Python
Quality gate
counted toward the gate limits; a CRITICAL finding fails the gate on its own (full and diff scans)
Finding type
review
Catalog name
MCP network-exposed server without auth
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Everyone on the same network, or on the internet if the port is open, can connect and call the server's tools with no credentials: here, anyone on the office Wi-Fi can issue refunds.

What Skylos flags

server/billing.py · PythonReported on line 15
from fastmcp import FastMCP from billing import payments mcp = FastMCP("billing-tools")  @mcp.tool()def refund(order_id: str, amount_cents: int) -> str:    """Refund part of an order."""    return payments.refund(order_id, amount_cents)  if __name__ == "__main__":    mcp.run(transport="http", host="0.0.0.0", port=8000)

What Skylos leaves alone

server/billing.py · Python
from fastmcp import FastMCP from billing import payments mcp = FastMCP("billing-tools")  @mcp.tool()def refund(order_id: str, amount_cents: int) -> str:    """Refund part of an order."""    return payments.refund(order_id, amount_cents)  if __name__ == "__main__":    mcp.run(transport="http", host="127.0.0.1", port=8000)

Why Skylos leaves it alone

127.0.0.1 only accepts connections from the same machine. The call is still an HTTP server without authentication, so SKY-D241 reports it; it is not open to the network, which is what SKY-D243 is about.

How Skylos decides

  1. Runs with --danger on Python files that import mcp, fastmcp or a module under mcp..
  2. Looks at the same run() calls as SKY-D241: X.run(...) where X was assigned from a call whose name ends in FastMCP or Server, or is named server, mcp or app.
  3. Reports CRITICAL when host= is the literal "0.0.0.0", whatever the transport, and the call passes none of auth, authenticator, auth_server_provider, middleware or auth_middleware.
  4. The same call is also reported as SKY-D241, the missing authentication on a network transport.

How to fix it

Bind to 127.0.0.1 when only this machine needs the server. When other machines must reach it, for example from inside a container, keep 0.0.0.0 but require a credential on every request; the same middleware also clears SKY-D241.

server/billing.py · Python · the fix, against the flagged file
from fastmcp import FastMCPAdded: from starlette.middleware import Middleware from billing import paymentsAdded: from billing.auth import RequireBearerToken mcp = FastMCP("billing-tools")  @mcp.tool()def refund(order_id: str, amount_cents: int) -> str:    """Refund part of an order."""    return payments.refund(order_id, amount_cents)  if __name__ == "__main__":Removed:     mcp.run(transport="http", host="0.0.0.0", port=8000)Added:     mcp.run(Added:         transport="http",Added:         host="0.0.0.0",Added:         port=8000,Added:         middleware=[Middleware(RequireBearerToken)],Added:     )

When it can be wrong

  • Authentication configured on the server object, such as FastMCP("billing", auth=provider), is not seen, so the call is still reported.
  • Any middleware= or auth= keyword silences it, even one that checks no credential.
  • Missed: the IPv6 form host="::", a host read from a variable or the environment, and a host set on the server object (FastMCP("x", host="0.0.0.0") in the official MCP SDK) or passed to uvicorn.run().

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Mark the run( line when a proxy or the server object enforces authentication, and say which.

    Python
    mcp.run(transport="http", host="0.0.0.0")  # skylos: ignore[SKY-D243] auth= on FastMCP()
  • skylos baseline ., then --baseline, accepts existing findings by file and line.

  • [tool.skylos] ignore = ["SKY-D243"] turns the check off for the project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.