Skip to main content

Exploiting Broken Access Control in MCP: Cross-Tenant Takeover and The Surface Behind It

· 8 min read
Bandana Kaur
APISec Research Labs

On Thursday evening while most were trying the new GTA VI, we decided to lock in and go hunting for vulnerabilities in an MCP gateway. What we found got us thinking about the one vulnerability that does not pop a shell on camera but hands an attacker access to someone else's objects. We found it in the kind of gateway that fronts many users' private tool endpoints behind one URL and forwards each user's upstream credentials. One could say the sacrifice was worth it.

Jokes apart, the gateway is properly multi-tenant where users own servers, group them into namespaces, and expose them through endpoints (the public URLs an MCP client connects to). It has the right ingredients like re-checking ownership on most reads and writes. But when it creates a server, the handler decides the owner roughly like const owner = body.user_id ?? session.user.id, and that optional user_id in the request body wins. Nothing validates it against who you actually are. That is textbook mass assignment: a privileged, server-owned attribute is quietly client-writable.

If we lean on that one field, we get a full cross-account takeover. Two normal users, Alice and Bob. Alice creates a server and simply tells the API it belongs to Bob, and it lands in Bob's account. On its own that is an integrity bug, but a server record here is not inert data, it carries a command. So Alice plants a STDIO server in Bob's account whose command is hers to choose, Bob sees it as one of his servers and connects a client. When the victim subsequently activates the attacker-created STDIO server, the gateway may execute the embedded command with the operating-system privileges of the gateway process. The resulting impact depends on the runtime configuration, available credentials, and process isolation. But in a general sense, they're cooked. We've anonymised and generalised this case for ethical reasons.

The thing is, everyone auditing MCP servers (us included) wants to talk about command injection and RCE. But could the silent heavyweights of API security be making a comeback in MCP? The bugs that hand a stranger someone else's data with little-to-no detectable exploit signature, that are, BOLA: Broken Object Level Authorization, as well as mass assignment. BOLA has held its throne at #1 on the OWASP API Security Top 10 for years.

In one of our earlier pieces we showed how an MCP tools/list response could expose a big chunk of an MCP's capability (and risk) surface without calling a single tool (full data and methodology here). In this article, we'll examine how a cross-tenant compromise demonstrates what can happen when an MCP gateway trusts caller-controlled identity. Then through a passive survey, we study how frequently the structural conditions that warrant investigating similar authorisation failures appear across the MCP ecosystem. We'll briefly discuss the threat model that makes MCP a fun target, real-world incidents, as well as some pro tips on how to stay ahead of these risks in your own systems.

The delivery pathway​

  1. Recon, passively. Read the tool list and the schema (precisely the floor-plan problem from our earlier writeup, where the schema discloses the object model before a single call.)
  2. Forge the owner. Create a server and set user_id to the victim. Nothing checks it against your session, so the gateway files the object straight into their account.
  3. Arm it. Make that server a STDIO server whose command is yours. A stdio server's command is trusted developer config, by design, so no one looks twice.
  4. Let them pull the trigger. The victim adds their shiny new server to a namespace and an endpoint and connects a client, the normal thing you do with your own gateway, and the gateway spawns your command with their privileges.

The delivery vehicle is the usual MCP client. The attacker doesn't need to touch a password and never trips a classic exploit signature, which is what makes this easy to miss and easy to automate, in APIs as well as MCP.

BOLA in 30 seconds​

A tool takes a parameter that names an object like listing_id, run_id, agent_id, owner_key. The server does the lookup, but BOLA is when the server fetches the object the id points at but never checks that this caller is allowed to touch that object. Change the id, get someone else's thing.

For a normal REST API, that is already pretty bad. For MCP it gets worse, because the caller in MCP is often an LLM agent acting on your behalf, frequently behind a proxy or aggregator that forwards credentials. So the question "who is actually asking for this object?" is blurry before anyone does anything wrong.

Where MCP authorization goes to disappear​

To understand BOLA in MCP deeper, let's take a step back and ask, in the context of an MCP server, where does identity come from?

Server-derived identity. The server figures out who you are from an authenticated credential (a verified token, a session bound to an account) and scopes every object lookup to that identity. This is the generally correct pattern. Object ids become harmless because the fence is drawn server-side.

Client-asserted identity. The server takes your word for who you are, because identity arrives as a tool parameter or a request field you supply: owner_key, client_id, user_id, a client-chosen session-id. This is the trust-me-bro authorization model, and it is the sharp end of BOLA. You are declaring which tenant you are on your way to it. The user_id field above is exactly this, identity reduced to a field you get to fill in.

That identity model is what decides everything. A tool taking listing_id can be fine if the server already knows you own only listings 1 through 9. A tool taking owner_key as an input is announcing in the schema that it will scope data to whatever key you hand it.

What the data actually says​

Across the 234 endpoints, 1,191 of 3,253 tools (36.6%) take at least one object-addressing parameter, and 174 of 234 servers (74.4%) expose at least one such tool. Median object-addressing tools per exposed server is 5 and the max is 127.

The raw count is not the most interesting part though. We found that the parameter names split cleanly into two populations:

Public-catalog identifiers. slug (197 tools), listing_slug (109). These address things meant to be addressable by anyone.

Tenant-scoped and caller-asserted identifiers. owner_key (112), client_id (14), database_id (13). These are the sharp precondition, the same class as the user_id field we abused.

Among some of the miscellaneous ones we have: agent_id (252) and run_id (161) which top the frequency chart, so agent-orchestration surfaces are dense with object references. And database_id (13) and r2path (17) double as backend leakage, naming storage internals right in the parameter list. Free infrastructure recon stapled to your authorization bug.

We need to also note the clustering forces: owner_key, contact_uri, and agent_name each appear on exactly 112 tools. Identical counts across unrelated names may not be coincidence. That could be like a handful of large, templated platforms contributing many tools apiece, not 112 independent design decisions. One misconfigured multi-tenant template could theoretically mint hundreds of BOLA-shaped tools in a single deploy. But this could be a story for another day…

Potential attack pathways​

Beyond the specific chain above, the routes into a BOLA-shaped MCP surface could look like these:

  1. ID enumeration. This is the classic IDOR pattern where the object id is sequential, short, or otherwise guessable. The agent-friendly schema even documents the identifier types for you. The MCP Python SDK shipped exactly this: its experimental task handlers registered tasks/list and friends with no session filter, so one client could enumerate and cancel another client's tasks (CVE-2026-52870).
  2. ID leakage, then reuse. One tool, or an unauthenticated health or debug route, returns ids that another tool will happily act on. Recon feeds exploitation and you never have to brute-force anything, Chained Disclosure BOLA as per the taxonomy in our deep dive.
  3. Caller-asserted scope swap. The tool trusts a scoping identifier you control (owner_key, client_id, a session id). Supply a different tenant's value, receive a different tenant's objects. This is the cleanest cross-tenant BOLA there is, and the class our gateway finding lives in. The MCP Python SDK did it with session ids (CVE-2026-52869): its HTTP transports looked a session up by the Mcp-Session-Id header and never checked the caller had created it, so anyone who learned a session id could ride it with their own token.
  4. Transport or session confusion in aggregators. A proxy keys sessions on a client-supplied id with no binding to the authenticated tenant or the endpoint. Your request gets dispatched into someone else's namespace and executes with their forwarded credentials. You never needed their password. The proxy brought it for you. The open-source Obot gateway was a clean example (GHSA-vw82-7fv8-r6gp): its /mcp-connect/{id} route skipped its own access-control rules, so any authenticated user holding a server id could reach a server they did not own and call its tools with the owner's stored OAuth credentials.
  5. Mass-assignment adjacency. Write-capable tools that accept an owner or id field let you reassign what is on your side of the fence, which is precisely how the user_id takeover started.

If you build this stuff​

Derive identity server-side. Never accept a scoping identifier (owner_key, client_id, user_id, session id) as a caller-supplied tool parameter or an unbound header. Bind every session to an authenticated tenant and to the endpoint.

Scope every object lookup to the authenticated principal, not to the id in the request.

Don't leak ids. Health, debug, and status routes that enumerate sessions or namespaces are recon gifts.

Treat the tool list as documentation an adversary reads first, and don't name your database in a parameter while you are at it. And treat a server definition as hostile input the instant one principal can write it and another can execute it.

The limitations​

Surface is not vulnerability. The census was fully passive: no tool was invoked and no authorization check was tested there. A tool taking file_id is a BOLA precondition, but not a confirmed BOLA (yet ;). A readable, unauthenticated tool list also does not mean the tool executes without auth; that would need invocation, which we never did in this passive scan. Because schemas are only capturable where the list was readable, "object-addressing" and "object-addressing and unauthenticated" nearly coincide by construction.

What we do map is the shape of the risk at scale. Confirming any single bug is a separate, hands-on, in-scope job we'll spend more of our evenings on (sorry, GTA!). The shape is still enough to triage, though. Before you touch a thing, sort tools into public-catalog, tenant-scoped, and client-asserted-identity, and spend your effort on that last bucket. The schema already told you where to look.

References​