SKY-D243 · Security in code
MCP server open on every network interface without authentication
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
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
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
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
- Runs with
--dangeron Python files that importmcp,fastmcpor a module undermcp.. - Looks at the same
run()calls as SKY-D241:X.run(...)whereXwas assigned from a call whose name ends inFastMCPorServer, or is namedserver,mcporapp. - Reports CRITICAL when
host=is the literal"0.0.0.0", whatever the transport, and the call passes none ofauth,authenticator,auth_server_provider,middlewareorauth_middleware. - 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.
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=orauth=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 touvicorn.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.