AAK-AUTHZ-CALLER-INPUT-001: An MCP tool's authorization decision reads a tenant, user, role or scope from its own arguments
- Severity
- HIGH
- Category
- Trust Boundaries (
trust-boundary) - Scanner
agent_audit_kit/scanners/mcp_authz_code.py- Auto-fixable
- No.
- SARIF name
McpAuthzOnCallerInput
What it detects
A tool handler decides access on a tenant, org, user, role or scope the caller sends: a handler parameter named org_id, tenant_id, user_id, role or scope, or args["org_id"], passed to an authorization check or compared with a privilege, instead of the authenticated principal (the request context, the access token, a principal contextvar). The check runs and passes while evaluating attacker input. The same check on the principal does not fire, and neither does a parameter compared with the principal.
How to fix
Read the tenant, user, role and scope from the authenticated principal. A parameter that names a tenant or a user may only be compared with it, never trusted on its own.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-AUTHZ-CALLER-INPUT-001
Limitations
Python only, in a function decorated @<name>.tool(...), .call_tool, .resource, .prompt or .completion. It reads a parameter or an arguments[...] read named org_id, organization_id, tenant, tenant_id, user_id, account_id, role, roles, scope or scopes, passed to a check named like authorize, check_access, has_permission, require_role or enforce; a role or scope compared with a privilege word (admin, owner, root, superuser, sudo, write, delete, or a value with a colon); or an id in a test whose body raises a permission error. A call or a test that also names the principal (ctx, token, claims, identity, session) does not fire, whether or not it compares the two. A helper the handler calls with the value is not followed, and a SQL filter on the value is not read as a decision. A source file over 512 KB is not read.
References
- OWASP MCP Top 10: MCP07:2025 (Insufficient Authentication & Authorization)
- OWASP Agentic Top 10: ASI03 (Identity and Privilege Abuse)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-AUTH-01 (Missing Authentication)
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-AUTHZ-CALLER-INPUT-001.md: the page then shows that text, with the registry reference appended under it.