OAuth Token Misuse Prevention Controls for AI Agents Running Automated MCP Tool Calls
Five linked controls close the gaps attackers exploit in agent OAuth.

Securing OAuth credentials for AI agents making automated MCP tool calls requires five connected layers, namely issuer and audience checks, task-scoped credentials, tool integrity verification, runtime policy enforcement, and tamper-proof audit logs. These controls must share identity and policy context, or attackers can exploit the gaps between them.
Why standard OAuth flows break down when AI agents run automated MCP tool calls
OAuth was designed for delegated human authorization, with a person reviewing consent screens and permission grants. AI agents remove that review loop as they make automated calls across many MCP servers without pausing for consent. A permission grant that looked reasonable when approved can become excessive when an agent moves to a different task.
The MCP specification formally introduced OAuth 2.1 authentication in late 2025, but many already-deployed servers still lack authentication entirely. When agents use those servers, there is no token validation. Even where authentication exists, agents can accumulate scopes nobody revisits, relay tokens intended for one server to another, and retain credentials beyond the task or user account they were provisioned for. Documented production incidents show how attackers exploit these permission gaps.
The four OAuth abuse patterns that agents make exploitable
OAuth mix-up starts with a false claim about identity. An MCP server that is malicious or compromised names its own authorization server in protected-resource metadata. A client that leaves stored credentials unbound to their original issuer can send a client secret or refresh token to the attacker. The official TypeScript SDK flaw, CVE-2026-104850, and Python SDK flaw, CVE-2026-115563, exposed this failure, while the Rust SDK had a related resource-binding failure in CVE-2026-63127. High-severity advisories for all three came out in September–October 2026.
The TypeScript reproduction exposed a further implementation trap. A client upgraded to the first fixed release still leaked credentials when created without the expectedIssuer parameter. Token passthrough creates a different route around authorization boundaries, as an agent or server forwards a received token as its own credential. That bypasses per-server consent and scope design. The July 2026 MCP specification explicitly prohibits passthrough, but older implementations still use it.
Confused-deputy attacks misuse a server’s right to act elsewhere. An MCP server proxying a third-party API uses a stolen authorization code to obtain an access token without the user’s consent. Rug pulls take advantage of approval already given to a tool that seemed harmless. The malicious lookalike npm package postmark-mcp, which was not Postmark’s official server, added a single BCC line in version 1.0.16 and blind-copied outgoing email to the attacker.
Why enterprise agent deployments make all four patterns worse at scale
Growing agent fleets spread these weaknesses across decentralized provisioning. Developers and non-developers add MCP servers to Claude Code, Cursor, VS Code, and Claude Desktop configurations without review. As more people connect tools, permissions and credentials multiply outside a central view, making isolated fixes inadequate for the deployment as a whole.
Human identity and access management frameworks compound the problem because they were not designed around these non-human identities. Most enterprise agents hold excessive OAuth privileges, while security teams often cannot identify their tokens, how long they have been active, or whether anyone has abused them. This is more than a monitoring shortfall. The provisioning model itself separates access from the agent’s current task. Rules that require logging also make teams answer to regulators for this visibility gap, alongside their own security concerns.
The first control layer: issuer binding and audience restriction at the protocol level
The first control is to bind credentials to their issuer and restrict tokens to their intended audience. Issuer binding prevents a client from treating an attacker’s authorization server as interchangeable with the server that issued its stored credentials. Audience restriction prevents a token issued for one server from being accepted by another. Both boundaries need enforcement. Higher-level policy cannot compensate for a client that has already sent its credentials to the wrong destination.
The July 2026 specification also prohibits servers from forwarding received tokens as their own credentials. A client upgrade cannot repair a server that continues doing that. The Checkmarx MCP security guide describes the underlying requirement as a chain of delegation, with the user, client, server, token, and target resource validated at every hop. Trust must not simply pass from the previous hop. Protocol compliance closes the token-relay class of attacks, but it does nothing about excessive scopes or a tool changing after approval.
The second control layer: least-privilege scoping and just-in-time credential issuance per task
Task-scoped credentials limit what authorized or stolen access can do. Each task needs its own authorization context, with only the permissions required and a lifetime tied to completion. The CSA Agentic MCP Security Best Practices Guide illustrates this with a data-fetching agent that receives read-only credentials. Credentials should expire when the task ends.
A developer’s personal token with full access, shared across several MCP servers, is the most common form of scope excess found in enterprise inventories. It also creates a path between otherwise separate tools. If one token covers multiple tools, compromising its access through any one of them exposes the others. Isolating scopes between tools breaks that lateral path. Just-in-time issuance addresses the separate time dimension by avoiding credentials that remain available indefinitely.
Kexin Chu’s A Systematic Survey of Security Threats and Defenses in LLM-Based AI Agents finds that principal trust inversion is the root cause of every Tool Execution layer attack it surveyed. In plain terms, the agent receives more trust than its current task warrants. Scope minimization directly addresses that mismatch. It reduces the authority available for misuse, but cannot establish that an approved tool is still the same tool.
The third control layer: cryptographic tool integrity verification to catch post-approval changes
Each invocation needs comparison against an immutable record of what was approved, including the tool’s definition and declared permissions. The Enhanced Tool Definition Interface, or ETDI, formalized by Bhatt, Narajala, and Habler in arXiv:2506.01333, combines cryptographic identity verification, immutable versioned definitions, and explicit permission management. It can leverage OAuth 2.0 while a dedicated policy engine evaluates capabilities dynamically.
ETDI gives changes a new version identifier, checks definition integrity through mechanisms that can include API contract hashes, and requires re-approval for changes in version or declared scope. The Deadbugz campaign in August 2026 demonstrated why that review cannot be optional. Its malicious “productivity-suite” server behaved harmlessly for its first several interactions before changing behavior. Approval given only when the tool was installed would have missed the switch. For teams without full cryptographic checking, pinning tool versions and re-checking updates against allowlists, new network destinations, and new instructions provides an interim practice pending stronger integrity verification.
The fourth control layer: how to enforce access policies on enterprise MCP tool calls
A valid token with narrow scopes does not answer whether this agent may use this tool with these argument values in the current context. A gateway or proxy should evaluate that combination before execution, using a policy engine such as Open Policy Agent or Cedar. The result can be permission, denial, or a queue for human approval. Platform and security teams should own this enforcement infrastructure rather than leave it to individual developer settings.
Each agent also needs its own identity, with SSO-linked credentials provisioned through an identity-management protocol. Without that identity, the policy engine has no distinct subject to check, and the audit record cannot reliably tell agents apart. Identity must remain attached to every action. The LASM survey describes a non-transferability property in which a control at one architectural layer has zero detection power against an attack localized at another. Tool-call enforcement therefore addresses legitimate-looking invocations that protocol checks and credential restrictions do not evaluate.
Enforcement should start with write and destructive calls. The Checkmarx guide specifies a minimum posture that allows reads while requiring approval for writes or deletes, enforced through managed configuration users cannot override. Actions with irreversible downstream effects can warrant review even when their credentials are correctly scoped. This lets security teams allow routine agent use without having to review every call.
The fifth control layer: tamper-proof audit logging with agent identity and tool-call arguments captured
Audit logging makes the other controls open to inspection. It connects the earlier need to establish what is deployed to evidence about which agent acted, which tool it called, and what happened across its activity. OWASP’s MCP08 entry specifies timestamp, agent ID, session ID, tool invoked, parameters, response summary, and user identity where applicable. It recommends structured formats such as JSON, CEF, or OTEL for interoperability with SIEM pipelines. Those fields support incident response and the logging obligations that make visibility a compliance concern.
The MCP logging specification prohibits credentials or secrets, personal identifying information, and internal system details that could aid attacks. Although that logging feature was deprecated as of protocol version 2026-07-28, those restrictions need enforcement at the logging layer rather than an assumption that upstream redaction worked. The record itself also needs protection. Append-only storage with cryptographic integrity guarantees makes tampering detectable, while editable records cannot provide dependable incident or audit evidence.
Full OpenTelemetry tracing connects individual entries across MCP servers and sessions so that an agent’s sequence of actions can be reconstructed. The LASM survey identifies this temporal visibility as absent from current security benchmarks. A single call can look ordinary on its own. Its place in a longer sequence may be essential to understanding what the agent did. Logging remains reactive, however, and must sit inside the same platform as the identity and policy controls that act before execution.
Assembling the five layers into a coherent control architecture rather than a fragmented stack

The five layers form a dependency chain. Issuer binding underpins trustworthy identity attachment, identity gives runtime policy a subject, and policy context makes audit records actionable. Scope limits constrain authority while integrity checks test whether the approved tool has changed. These are different jobs. Treating any one as a substitute for the others leaves part of the attack model uncovered.
A separate credential manager, gateway, and audit tool can create seams where identity context disappears or policy state is not shared. The relevant comparison is therefore not simply whether each product offers OAuth or logging. It is whether the complete architecture preserves issuer and audience boundaries, task scopes, approved tool versions, agent identity, and policy decisions through execution and audit. Separate components need to share enforcement context as well as a dashboard.
Inventory is the entry point for that architecture. Discovery must cover MCP servers on developer machines and in Cursor, VS Code, Claude Desktop, and production before governance can reach them. Security and IT teams enable adoption when they own unified infrastructure for access, enforcement, and evidence. The secure path then becomes the ordinary path employees use to get work done.


