# AI Agent Authorization > Deciding what an LLM agent may do *on whose behalf*. Agents add a new principal (the agent) between the user and the tools, and every place where the agent's authority exceeds the requesting user's is a confused-deputy privilege escalation that needs no prompt injection: just ask. ## How it works Classic authz checks `(user, action, resource)`. Agentic systems insert a hop: the user asks the agent, and the agent calls tools with **its own** credentials (project credentials, a service token, a human's API key it was handed). The failure modes: - **Scope mismatch**: the permission to *talk to* the agent is checked, but not the permission for each *tool call* the agent makes. Viewer + agent = executor. - **Credential laundering**: restrictions bound to the normal execution path (allowed domains, per-node permissions) don't apply when the same credential is used via a different agent feature (MCP client, tool node). - **Standing, shared identity**: static tokens or keys carry permissions regardless of which human triggered the action, so audit and least privilege collapse (GitGuardian: "the agent inherits the authority of whoever supplied the credential"). - **Approval binding**: human-in-the-loop is a control only if what was approved is what runs. - **Point-in-time policy**: each tool call is individually allowed, but the *sequence* (read secret, then outbound request) is the attack. ## Techniques / payloads - **Ask the agent to do what your role can't.** In n8n (CVE-2026-65015, fixed 2.29.8/2.30.1), `PROJECT_VIEWER_SCOPES` included `agent:execute` but not `workflow:execute`. A Viewer chatted with the project agent, which invoked `run_node_tool`, so the HTTP Request node sent `PROD-SECRET` to an attacker URL, or, where enabled (off by default since n8n 2.0), Execute Command gave a reverse shell. ```ts @Post('/:agentId/chat') @ProjectScope('agent:execute') // only gate export const PROJECT_VIEWER_SCOPES = ['agent:read','agent:list','agent:execute', /*…*/]; ``` - **Re-home a use-only credential.** n8n CVE-2026-59207: a credential with *Allowed HTTP Request Domains = None* could still be attached as header auth to an MCP server pointing at Burp Collaborator. The connection "failed", but the plaintext key had already been sent in `X-Api-Key`. - **Read-only role vs approval APIs.** Pulse `/api/ai/approvals` (CVE-2026-129428): viewers could list pending agent commands and approve or deny other users' requests. - **Approval substitution (Loopjacking)**: render operation A in the approval UI and execute B, either through representation attacks (B omitted or misrepresented) or post-approval state substitution. Reproduced in Agno AgentOS ≤ 3.0.9 and LangGraph Agent Server ≤ 0.14.0. **GhostApproval** is the file-system variant: a symlink in a malicious repo makes the prompt show a workspace path while the write lands outside it (CWE-61 + CWE-451). It affected Amazon Q Developer, Claude Code, Augment, Cursor, Antigravity and Windsurf; AWS, Cursor and Google fixed it. - **Gateway auth gaps**: LiteLLM MCP endpoint (CVE-2026-59822, in CISA KEV) created a valid session from *any* Bearer token. With no auth configured every user got `PROXY_ADMIN`, and 9.6% of 3,074 public instances took the default `sk-1234` or no auth. Microsoft MCP Gateway had an authorization bypass through a user-controlled key. - **Identity by assertion**: ServiceNow Virtual Agent (AppOmni). A static token was identical across all customers, and an email address was accepted as proof of identity, so knowing a target's email gave platform takeover. - **Classic IDOR in AI features**: a private skill ID leaked via a shared chat, then an overlooked endpoint used it ($1,000). ## Defenses - **Authorize every tool call against the end user**, not just the chat entry point: the agent's effective permission = intersection of the agent's and the requesting user's rights. Map scopes so read-only roles can't reach executing tools. - **Propagate user identity**: MCP servers should validate issuer, `aud` (token intended for *this* MCP resource), expiry and `scope` per request and return `403 insufficient_scope`. For downstream APIs, use OAuth **On-Behalf-Of** (e.g. Entra OBO) so the backend's RBAC and audit still see "Alice", rather than a shared service token. - **Bind credential restrictions to the credential**, enforced in the shared HTTP layer for every feature that can use it (nodes, MCP, pass-through). - **Short-lived, intent-scoped, just-in-time credentials**; SPIFFE-attested workload identity and per-workflow OIDC tokens instead of static keys (Identiverse 2026). - **Sequence-aware policy**: AWS Dogwood (Cedar + temporal conditions) evaluates tool calls against prior actions, e.g. require human approval within the last hour, cap call counts, track running totals. It generates action schemas from MCP tool definitions. - **Approval integrity**: canonical rendering of the exact operation, and an exact use-time comparison between approved and executed (Loopjacking mitigations). Resolve symlinks before prompting. - **RAG**: filter retrieval by the user's permissions before the model sees content (SpiceDB `LookupResources` pre-filtering the vector query). - Agent-written code drops ownership checks (Snyk), so push tenancy into the DB ([[Multi-Tenant Isolation]]) and test it ([[Authorization Testing Automation]]). ## Related - [[Authorization Security]] - [[Authorization Policy Engines]] - [[Privilege Escalation]] - [[Function Level Authorization]] - [[MCP Security]] - [[Agentic AI Risks]] - [[Prompt Injection]] - [[AI Coding Assistant Risks]] - [[OAuth 2.0 Vulnerabilities]] ## Sources - [[raw/deturris.io/ask-the-agent-nicely-two-authorization-bypasses-in-n8n-ai-agents-12021|Ask the Agent Nicely: Two Authorization Bypasses in n8n AI Agents]] - [[raw/blog.gitguardian.com/ai-agent-authorization-beyond-authentication-a-look-at-aws-dogwood-12173|AI Agent Authorization Beyond Authentication: A Look At AWS Dogwood]] - [[raw/blog.gitguardian.com/identiverse-2026-the-challenges-of-solving-identity-for-ai-agents-at-s-9845|Identiverse 2026: The Challenges Of Solving Identity For AI Agents At Scale]] - [[raw/arxiv.org/loopjacking-hijacking-human-in-the-loop-approval-12092|Loopjacking: Hijacking Human-in-the-Loop Approval]] - [[raw/wiz.io/ghostapproval-a-trust-boundary-gap-in-ai-coding-assistants-10250|GhostApproval: A Trust Boundary Gap in AI Coding Assistants]] - [[raw/snyk.io/servicenow-s-virtual-agent-vulnerability-shows-why-ai-security-needs-t-8881|ServiceNow's Virtual Agent Vulnerability Shows Why AI Security Needs Traditional AppSec Foundations]] - [[raw/medium.com/understanding-mcp-v2-authorization-with-azure-entra-obo-12954|Understanding MCP v2 Authorization with Azure Entra OBO]] - [[raw/medium.com/mcp-authorization-part-1-overview-server-design-and-implementation-15255|MCP Authorization — Part 1: Overview, Server Design, and Implementation]] - [[raw/github.com/pulse-missing-authorization-in-api-ai-14706|Pulse missing authorization in /api/ai]] - [[raw/github.com/microsoft-mcp-gateway-authorization-bypass-through-user-controlled-key-14030|Microsoft MCP Gateway authorization bypass through user-controlled key]] - [[raw/wiz.io/off-guard-breaking-litellm-from-authentication-bypass-to-cloud-comprom-11992|Off Guard: Breaking LiteLLM from authentication bypass to cloud compromise]] - [[raw/authzed.com/fine-grained-authorization-using-spicedb-for-rag-3959|Fine Grained Authorization using SpiceDB for RAG]] - [[raw/medium.com/the-1000-idor-hiding-behind-a-shared-ai-chat-15473|The $1000 IDOR Hiding Behind a Shared AI Chat]] - [[raw/snyk.io/why-ai-coding-agents-keep-writing-broken-access-control-12183|Why AI Coding Agents Keep Writing Broken Access Control]]