Skip to content

AAK-MCP-NOAUTH-DEFAULT: MCP server unauthenticated-by-default / fail-open authentication

Severity
HIGH
Category
MCP Configuration (mcp-config)
Scanner
agent_audit_kit/scanners/mcp_noauth_default.py
Auto-fixable
No.
SARIF name
McpNoAuthDefault

What it detects

An MCP server ships an authentication check that does not actually enforce — distinct from a transport with no auth at all (AAK-MCP-HTTP-NOAUTH-SERVER-001). Three shapes are flagged: (a) an auth / is_authorized / verify_token-style function that returns a truthy/allow value when the secret or token is empty or unset (if not SECRET: return True); (b) a default / placeholder secret literal — a secret-named variable set to "" / "changeme" / "secret" / "admin" etc., or os.environ.get("X_SECRET", "") with an empty default, so the server runs unauthenticated until an operator intervenes; (c) a missing-secret check that only logs a warning and continues while the server binds a non-loopback interface (0.0.0.0 / ::). Anchor: CVE-2026-48814 (Network-AI, CVSS 9.1) — an incomplete fix of CVE-2026-46701 whose added auth gate still admitted requests when the secret was unset. CWE-306 (Missing Authentication for Critical Function) + CWE-862 (Missing Authorization).

How to fix

Fail closed: reject every request when the secret/token is empty, unset, or still a default — never return True on an empty credential and never ship a placeholder secret. Require the secret with no empty fallback (os.environ["MCP_SECRET"], erroring if absent), compare with a constant-time check, bind to 127.0.0.1 behind an authenticating proxy, and turn any 'no secret set' warning into a hard startup failure. Pin Network-AI past the CVE-2026-48814 fix.

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

agent-audit-kit scan . --rules AAK-MCP-NOAUTH-DEFAULT

Limitations

In a .py file that mentions MCP (the whole word mcp, FastMCP, McpServer, Server(, modelcontextprotocol or mcpServers, in any case) it flags a variable whose name contains secret, token, api_key, apikey, password, passwd, auth_key (also authkey) or auth_token when it is set to one of '', changeme, change-me, change_me, secret, password, passwd, admin, default, token, test, placeholder, xxx, none, your-secret-here, your_secret_here, your-token-here or example (any case) or read from the environment with an empty default, second or as default= (os.environ.get("X", ""), os.getenv("X", default="")), a function named is_authorized, authorize, check_auth, verify_token, verify_auth, require_auth, validate_token, validate_auth or authenticate (any case, an optional leading underscore, the underscore inside the name optional, -ise spellings too) that returns a truthy constant when the secret is empty, and a missing-secret check whose body calls a function whose name contains warn, logger, getLogger or print (any case; logging.warning(...) and logger.info(...) count, logging.error(...) does not) and has no raise, return, call named exit, _exit, abort or quit (the whole name or its last part, so sys.exit and os._exit stop and atexit.register does not), .error(...) on a name containing parser (argparse) or .fail(...) on a name containing ctx or context (click), in a file that contains 0.0.0.0, [::] or a quoted ::. In files whose extension is .json, .yaml, .yml, .toml or .env that mention MCP in the same way and contain one of those addresses it flags a key containing secret, token, api_key (also api-key, apikey), password or auth_key (also auth-key, authkey) set to '' or one of changeme, change-me, change_me, secret, password, admin, default, placeholder, xxx, example, token or test (any case), and auth switched off by a flag: auth, authentication, authorization, auth_config, require_auth, requireauth, security or governance set to false, 0, no, none, off or disabled, directly or through an enabled, is_enabled, required or require key within 120 characters, or disable_auth, no_auth, auth_disabled, skip_auth or allow_anonymous set to true, 1, yes or on, each the whole value (quoted, or bare and followed by whitespace, a comma, a closing brace or bracket, or the end of the file), so auth: office365 and auth: 0.5 are not read as off. A key whose name only contains a keyword (AUTH_ENABLED=false, mcp_auth_enabled: false) and a TOML table header ([auth], then enabled = false) are not read as auth off. A weak non-empty default (os.environ.get("X", "changeme")) is not flagged, and neither is the same pattern in a file that mentions none of the MCP words above or, for the warning check and the config files, contains none of those addresses, which covers a loopback bind and a host read from the environment.

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-NOAUTH-DEFAULT.md: the page then shows that text, with the registry reference appended under it.