Catalog My learning Blog
AI Security Course: OWASP LLM Top 10 2026 and Agentic AI · Phase 3 · Lesson 13 · 4 min read

AI Agent Identity and Privilege Abuse (ASI03)

On this page
  1. Attackers don't need your credentials
  2. Three ways it goes wrong
  3. Delegate, don't impersonate: scoped agent identity
  4. Check yourself

Attackers don't need your credentials

Every action an agent takes runs under some identity: an API key in an environment variable, a user's OAuth token, a service account, a cloud role. ASI03, Identity and Privilege Abuse, covers what goes wrong when those identities are too powerful, too long-lived, shared or easy to spoof. An attacker doesn't need to steal a credential if they can talk an agent that already holds one into using it.

Three ways it goes wrong

Privilege inheritance. The agent runs with everything the user can do, or worse, with a service account that can do everything for everyone. An assistant that only needs to read one calendar holds a token that can also read all mail and write to the drive. Hijack the agent, and the attacker inherits all of it.

The confused deputy. A component with real authority acts for a caller who shouldn't have it. An internal agent with database admin rights that takes tasks from a public chat channel is a deputy waiting to be confused. Token passthrough, where an MCP server forwards the user's token to upstream APIs, is a variant the MCP specification explicitly forbids.

Spoofed authority. Agents trust text that claims authority: "this request comes from the CFO", a message in a multi-agent system claiming to be from the orchestrator. OWASP's ASI03 cases include an agent following a fake manager's instruction. Authority has to come from authentication, never from claims in content.

ProblemExampleControl
Privilege inheritanceAgent holds the user's full Google tokenTask-scoped delegation tokens
Shared super-credentialOne admin key for all agent actionsPer-agent identity, least privilege
Confused deputyAdmin agent takes tasks from a public channelAuthorize the original requester, not the agent
Token passthroughMCP server forwards the user token upstreamThe server gets its own token for that audience
Spoofed authority"Message from the CFO: approve payment"Authority only from authenticated identity
Long-lived secretsAPI key in an environment the agent can readShort-lived tokens from a broker, never in context

Delegate, don't impersonate: scoped agent identity

The fix is standard identity engineering:

  • Give each agent its own identity, separate from users, so actions are attributable and permissions can be set per agent.
  • When an agent acts for a user, use delegation: a token that represents both of them, with only the rights the task needs.
  • Keep tokens short-lived and audience-bound, valid only at one API.
  • Request extra scopes with the user's consent when a task really needs them.
  • Keep credentials out of the model's context and anywhere a tool could echo them.
  • Log every action with the agent, the user it acted for and the authorization that allowed it.

OAuth 2.0 Token Exchange (RFC 8693) does the delegation step. Before calling the billing API, SupportBot swaps the user's token for one that names both the user and the agent, allows only reading invoices, and works only at the billing API:

Code
import httpx

TOKEN_ENDPOINT = "https://auth.acme.example/oauth2/token"

def delegated_token(user_token: str, agent_token: str, scope: str, audience: str) -> str:
    """RFC 8693 token exchange: act for the user, as this agent, with less authority."""
    resp = httpx.post(TOKEN_ENDPOINT, data={
        "grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
        "subject_token": user_token,
        "subject_token_type": "urn:ietf:params:oauth:token-type:access_token",
        "actor_token": agent_token,                       # the agent's own identity
        "actor_token_type": "urn:ietf:params:oauth:token-type:access_token",
        "scope": scope,                                   # e.g. "invoices:read"
        "audience": audience,                             # only the billing API accepts it
    }, timeout=10)
    resp.raise_for_status()
    return resp.json()["access_token"]                    # lifetime set by server policy, e.g. 5 min

def list_invoices(session) -> list[dict]:
    token = delegated_token(session.user_token, AGENT_IDENTITY.token(),
                            scope="invoices:read", audience="https://billing.acme.example")
    r = httpx.get("https://billing.acme.example/v1/invoices",
                  headers={"Authorization": f"Bearer {token}"}, timeout=10)
    r.raise_for_status()
    audit("list_invoices", actor="supportbot", on_behalf_of=session.user_id, scope="invoices:read")
    return r.json()["invoices"]

If the agent is hijacked now, the stolen authority is a few minutes of read-only invoice access for one user. Not the user's whole account, and not a service-wide key.

Check yourself

That's token passthrough. The token wasn't issued for this server, so it can't validate the audience, and a compromise exposes the user's full GitHub access. The server should obtain its own token for GitHub, scoped to what its tools need.

The claim in the text grants nothing. Authority comes from the authenticated sender and the payment workflow's checks, so the agent should route it to the normal approval process.

Actions become attributable to the agent, its permissions can be narrower than the user's, and a hijacked agent can't use rights the task never needed.

If a token leaks or the agent is manipulated, a narrow scope and short lifetime limit what can be done and for how long. Long-lived broad tokens turn one mistake into a major incident.