What happens to AI agent tokens when an MCP server is breached?

Short answer: it depends on what the token is allowed to do. If the MCP server held a credential that carried the user’s whole account, one flaw in the server hands an attacker all of it. If each AI assistant holds its own token, scoped to what the user chose, for as long as the user chose, and checked on every call, the same flaw reaches far less. The flaw still has to be fixed. The token decides how much the flaw is worth.

On October 27, an attacker exploited a flaw in the MCP server of Mittwald, a German hosting provider. Mittwald published a first account on November 7, keeps a FAQ for affected users, and published its postmortem on November 25. All three are in German, and the translations below are ours. We first published this post on November 17 and updated it on November 30 with what the postmortem says. The incident is a clean example of a question every MCP server operator will face: what does the token sitting in your server let a stranger do?

What happened at Mittwald?

Mittwald says an attacker first tested a flaw in its MCP server on the evening of October 21, then moved around its platform as a regular user from October 23, registering test accounts. On October 27 at 14:58 the attacker registered one more account. At 15:03 that account was used to exploit the flaw in the MCP server.

The FAQ describes the server as “an interface through which customers could connect their mStudio to AI assistants.” During the attack, “access credentials (tokens) of users of this interface were read.” Mittwald says these were session tokens, not passwords, and that all of them have been revoked.

Mittwald found the problem on November 4 and shut the MCP server down the same day. It says it forensically analyzed 56 compromised projects and the MCP server. It also says the speed of the attacker’s steps, sometimes seconds apart, points to AI tooling. That is Mittwald’s inference from its logs, not an independent finding. The MCP server stays offline. On November 7 Mittwald said it would publish a fuller account once its analysis is complete.

On November 12, Mittwald’s status page reported that the attackers had resumed, had exploited a vulnerability and had compromised the company website. Mittwald said it had found no access to its internal systems, switched off its customer logins and SSH access as a precaution, and restored them on November 13 with a note that a postmortem would follow. The postmortem says that second break-in came through a previously unknown flaw in the content management system behind the website.

The postmortem also names the first flaw. It was a shell injection in one tool of the MCP server, the tool that created SSH keys. Text supplied in the tool call went into a command line unchecked, so the attacker could run commands inside the server’s container.

And it explains what was there to read. Users signed in to the MCP server with OAuth 2. In the postmortem’s words, the server “receives an access token and a refresh token for the mittwald API and puts both in a session store.” The consequence, again in its words: “The MCP server holds the valid tokens of all active users at all times. Whoever takes over the server can act in the name of all of these people.” Mittwald says the attacker took several thousand tokens. Most had already expired, and several hundred were still valid.

Why was one token such a big problem?

Because of what the token could do. The FAQ answers the user’s question directly: “The token allowed access to your mStudio with your rights. The attacker could access projects you had access to.”

That is the whole story in two sentences. The postmortem puts it the same way: with a valid token the attacker “could do everything in mStudio that you are allowed to do.” So when the server leaked one, the leak was worth what that user could do in mStudio.

The postmortem lists what made the flaw so costly. Two of the items are about the tokens. The session store held the OAuth tokens of all users and could be read from inside the container. And the scopes were wide: “Whoever works through MCP usually grants comprehensive scopes. The assistant is supposed to be able to get as much done as possible.” Mittwald’s own employees used the server too, with accounts that reached many of the company’s production projects. With the tokens, the attacker created SSH users and API tokens in other people’s names and copied configuration files and credentials out of projects.

The cleanup list Mittwald gave affected users shows how far that reach went. Change your password. Turn on two-factor authentication. Check API keys, project tokens and SSH keys in your projects and delete unknown ones. Rotate the credentials for third-party services stored in those projects, such as databases, mail and external APIs. One stolen token became a to-do list that touches every system the user’s projects connect to.

Is this a server bug or a credential design problem?

Both, and they are different problems. The server bug is why the attacker got in. The credential design is why getting in was worth so much.

The postmortem treats them separately too. “In a more tightly bounded environment the flaw would have done considerably less damage,” it says. Mittwald plans to bring the MCP server back only in a new architecture, with a clear separation between tools and sessions and with “narrower, shorter-lived tokens.” It names no date.

Operators can fix the first one with patches, reviews and testing, and they should. No team can promise a server with zero flaws, so the second one deserves equal attention. Assume that some day a flaw reaches the tokens your server handles. The question that matters is what those tokens are worth when it does.

This is the same pattern we described in why AI agent attacks target credentials, not the model. Mittwald’s attacker did not go after a model. The attacker read tokens.

What would a scoped, user-mediated grant have changed?

Had mStudio’s agent access run through AgentAdmit, the damage could have been contained, because the server would have needed no store of every user’s access and refresh tokens, and each AI assistant would have carried its own grant, limited to the scopes and the duration its user chose. Six properties do the work:

  1. The user chooses scope and duration. On an AgentAdmit-hosted consent page, the person picks what the assistant may do and for how long. A token taken from the server would carry that choice and nothing more.
  2. The user hands the credential to the agent. A single-use, short-lived token is shown to the user, who gives it to their agent. No redirect or callback carries it from the app to the agent, so there is no automated delivery channel for prompt injection or misconfiguration to intercept. The agent exchanges it once for its scoped access token. There are no refresh tokens: when a grant ends, continuing takes a new grant from the user.
  3. The server needs no token store. In the pattern our MCP guide documents, the agent sends its access token with each tool call and the server checks it with AgentAdmit before the tool runs. There is no session store holding every active user’s credential for one flawed tool to read.
  4. Every call is checked. The app’s server checks each call with AgentAdmit. A call outside the granted scopes is refused, and so is any call on an expired or revoked grant. The user can also set call ceilings, daily or lifetime counts, when granting access.
  5. Revocation is surgical. One connection can be revoked without touching the others. The app owner can also revoke every connection for one user, or for the whole app, in one operation. See how to audit and revoke an AI agent’s access.
  6. Calls leave a trail and trigger alerts. Each verified call writes a tamper-evident audit row. Volume spikes alert the app owner, and behavior that drifts from a connection’s own pattern is flagged for review.

For the ceilings in particular, see can you set limits on how much an AI agent uses your access. For the underlying model, what is user-mediated authorization.

What would it not have changed?

Four things, stated plainly.

First, AgentAdmit would not have fixed the flaw in the server. An attacker who can run code inside a server can still do what that server can do: read tokens as they pass through it, and use the server’s own keys. A grant limits what the credentials are worth. It does not patch the code.

Second, a stolen scoped token still works within its scopes until it expires or someone revokes it. Smaller is not the same as harmless. And a grant is only as narrow as the user makes it. Mittwald observed that people working through MCP usually grant wide scopes. A user who grants an assistant everything has handed over a token worth everything, until it expires or is revoked. The gain is a smaller blast radius, a duration the user chose, revocation that can take out one connection or all of them, and a record of every call that was checked.

Third, a record is not an alarm. Mittwald says eight days passed between the first targeted access and its discovery, because the attacker worked through its regular API with valid tokens and kept the pattern small. Our alerts fire on volume spikes and on behavior that drifts from a connection’s own pattern. An attacker who stays inside a token’s scopes and its usual pattern may not trip them. What the per-call record gives is the answer afterward: which connection made which calls.

Fourth, this post rests on what Mittwald has published: its FAQ, its status page and its postmortem. What a differently shaped credential would have done in the same position is our reasoning, not a finding of Mittwald’s.

What should an MCP server operator do with this?

Ask five questions about the credential your server handles for each AI assistant.

  • Does your server keep users’ tokens in one place, where a flaw in a single tool can read all of them?
  • Is it the user’s own session or key, or a separate credential made for the assistant?
  • Does it carry only what the user approved, or everything the user can do?
  • When does it expire, and can you revoke one connection without disturbing the rest?
  • If it leaked at 15:03, could you tell by 15:04 what it touched?

Mittwald’s postmortem answers the first question for its own server: it held the valid tokens of all active users, and a flaw in one tool reached them. In Mittwald’s words, whoever takes over the server can act in the name of all of those people.

FAQ

What did the Mittwald MCP server breach expose?

Mittwald says an attacker read the tokens its MCP server held for customers who had connected their mStudio account to AI assistants. Its postmortem describes them as OAuth access and refresh tokens kept in a session store. With a valid token the attacker could do everything in mStudio that the user was allowed to do. Mittwald says no passwords were read and that all tokens have been revoked.

Does a scoped token make an MCP server breach harmless?

No. A scoped token still works inside its scopes until it expires or is revoked. What a scoped, time-limited, revocable grant changes is how much a leaked token is worth, how long it can work and how precisely you can shut it down. The server flaw itself needs its own fix.

Should AI assistants use the user’s own session token?

We think they should not. A session token carries everything the user can do. An assistant should hold a separate credential limited to what the user approved, with its own expiry and its own revocation, so that losing it does not mean losing the account.

How can an MCP server operator limit the damage from a leaked token?

Do not keep every user’s token where one flawed tool can read it. Issue each assistant a separate token, scope it to what the user approved, give it an expiry, verify scope and revocation on every call, and keep an audit trail with alerts. Then a leaked token is worth one connection’s scopes, and its calls can be traced afterward.

AgentAdmit gives apps and MCP server operators that grant model, for their own AI agent and for the agents their users connect: scoped, time-limited, revocable access that a person controls, checked on every call. Patent pending. See agentadmit.com.

Get new posts by email

One short email when a new post goes live. No spam, unsubscribe anytime.