Skip to content

AAK-MCP-REQUESTSTATE-001: Server code trusts an echoed requestState as proof of approval or identity

Severity
HIGH
Category
Trust Boundaries (trust-boundary)
Scanner
agent_audit_kit/scanners/mcp_server_code.py
Auto-fixable
No.
SARIF name
McpRequestStateTrusted

What it detects

A server takes the requestState a client echoes back (the 2026-07-28 input-required round trip) as proof of approval or identity, without verifying an HMAC or AEAD over it, or without binding it to the principal, an expiry and a digest of the request. The client holds that value between requests and can rewrite or replay it. The spec says that if it "influences authorisation, resource access, or business logic, servers MUST protect its integrity (e.g. HMAC or AEAD)". hmac.compare_digest over a state that carries the principal, an expiry and a request digest does not fire.

How to fix

Sign or encrypt the state, verify it in constant time before reading it, and bind it to the authenticated principal, a short expiry and the method plus a digest of its parameters. Those measures do not guarantee single use, so enforce that on the server if an approval may run only once.

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

agent-audit-kit scan . --rules AAK-MCP-REQUESTSTATE-001

Limitations

Reads Python, TypeScript and JavaScript by pattern, one file at a time: requestState or request_state, a decode (b64decode, atob, json.loads, JSON.parse, Buffer.from), and a read of an approval or identity key (approved, approval, authorized, allowed, principal, user, identity, role, scope) from a name holding state. A check in another file counts as absent, and any HMAC, AEAD, Fernet or JWT call in the file counts as present, whether or not it covers this value. The binding is read as those words appearing in the file, not as a comparison being made. A state stored server-side and looked up by an opaque id is not this shape, and does not fire. 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-MCP-REQUESTSTATE-001.md: the page then shows that text, with the registry reference appended under it.