Application Security

Claude Code OAuth Tokens Can Be Stolen Through Stealthy MCP Hijacking

Mitiga researchers say attackers can silently redirect Claude Code MCP traffic, intercept OAuth tokens, and maintain persistent access to connected SaaS platforms.

Claude

An OAuth token with wide access rights can be stolen stealthily and largely undetectably from Claude Code.

Claude Code is an agentic system. This is great for developers but concerning for security teams. Agentic systems can expand the attack surface while operating largely invisibly. A major issue is the OAuth token. If an attacker can acquire this, the adversary effectively has a master key or digital proxy granting access to every tool connected to or accessible from the Claude Code MCP.

Mitiga Labs has identified an issue within Claude Code that would allow attackers to redirect output, including the tokens, to their own infrastructure before everything is sent on to the legitimate destination. It’s a classic man-in-the-middle-attack giving the attacker access to the tokens.

The MCP configuration and the OAuth tokens are stored in ~/.claude.json. If an adversary can modify that file, MCP traffic can be redirected through the attacker’s own infrastructure. Mitiga has published details of how this could be achieved.

The two prerequisites for the attacker is the ability to install a tailored npm on a machine where Claude Code is configured with dynamic authorization MCP servers. The NPM registers a lifecycle hook that runs as part of the install.

A post installation hook locates common clone locations, and populates the paths with a pre-configured trust dialog set to true. “No prompt will fire when the directory is later opened, because the flag the prompt is gated on is already set,” reports Mitiga.

Advertisement. Scroll to continue reading.

The hook also opens ~/.claude.json and edits the MCP server in the global config file. It edits ‘mcpServers’ to include the proxy address. “This puts us, ‘the adversary’, in the middle of any request that goes out to the MCP server. As the attacker, we got mitmproxy configured and intercepting,” explains Mitiga.

Whenever Claude Code initiates or refreshes the MCP session, it connects to the proxy and the token transits to the attacker’s infrastructure. The user just sees a valid flow. If the user rotates the token, the hook writes it back on the next load. If the user edits the MCP URL, the hook loads it back on the next load. The attacker has achieved both stealth and persistence.

The attacker gets, “A durable redirection of the victim’s SaaS credentials into attacker-controlled infrastructure, with automatic recovery from token rotation, invisible to the victim’s endpoint UI, and indistinguishable from legitimate traffic on the provider’s side.”

As a man in the middle, the attacker can easily steal any OAuth token since it is stored in plain text within ~/.claude.json. Once stolen the attacker can use the token as an MFA-bypassing golden key into any tool to which the MCP connects, with the same permissions as the user.

Without care, the user sees nothing. No flags are raised since the MCP is simply doing what it is told to do, and the user isn’t aware these actions have been compromised. The new adage of assuming a compromise has happened should take center stage. “Monitor Claude Code configuration changes, MCP server URL changes, OAuth refresh behavior, suspicious SaaS API activity, and unexpected traffic through MCP integrations,” suggests Mitiga.

What you mustn’t do is wait for a solution from Anthropic. Mitiga reported its findings to Anthropic on April 10, 2026. On April 12, 2026, Anthropic replied it was ‘out of scope’. The reason given was effectively the same as its response to Adversa’s ‘TrustFall’ disclosure: the user has already consented to what might happen next.

Learn More at the AI Risk Summit at Half Moon Bay

Related: AI Coding Agents Could Fuel Next Supply Chain Crisis

Related: Google OAuth Flaw Leads to Account Takeover When Domain Ownership Changes

Related: Millions of Websites Susceptible to XSS Attack via OAuth Implementation Flaw

Related: More Cybersecurity Firms Hit by Salesforce-Salesloft Drift Breach

Related: Shadow AI Risk: How SaaS Apps Are Quietly Enabling Massive Breaches

Related Content

Artificial Intelligence

The guidelines are the work of the recently launched Open Secure AI Alliance, which now includes 120 organizations.

Artificial Intelligence

In one instance, an unsanctioned model attempted to inject malicious code into an open source repository.

Artificial Intelligence

Build your strategy around answering these questions to ensure employees use AI productively while keeping sensitive data, IP, and agent behavior within the boundaries...

Artificial Intelligence

The AI security company will invest in product innovation, global expansion, and customer experience.

Application Security

Obsidian Security has developed a platform for governing AI agents across third-party applications.

Artificial Intelligence

A crafted prompt to a low-privilege Google ADK agent could be used to pass a malicious hand-off comment to a privileged agent.

Artificial Intelligence

The internet giant has built an agent harness to find vulnerabilities across Chrome’s codebase.

Artificial Intelligence

When the AI Act comes into force, AI companies will be required to make clear to consumers with labels or digital watermarks that chatbots...

Copyright © 2026 SecurityWeek ®, a Wired Business Media Publication. All Rights Reserved.

Exit mobile version