Post

MCP's July Revision Moved Six Security Checks Into Your Code

The 2026-07-28 MCP specification removed sessions, mirrored tool arguments into HTTP headers, added issuer validation and changed client registration. Each change is sound, and each one leaves a specific check for server, client or gateway authors to write. Here are the six, from the spec text.

MCP's July Revision Moved Six Security Checks Into Your Code

The 2026-07-28 revision of the Model Context Protocol lists nine major changes, and most of the coverage has been about scaling. No more sessions. Any request can land on any instance. Tool lists can be cached.

The security consequences are harder to see, because they’re scattered across the changelog, the authorization specification, the security best practices and a handful of SEPs. Read them side by side and a pattern shows up. Something the transport or protocol used to handle implicitly is now an explicit value on the wire, and a check that used to be somebody else’s problem is now yours.

I count six. For each one below: the spec text that creates it, and the check it leaves you to write.

Six rows: sessions removed, routing headers added, issuer in the response, credentials bound to issuer, CIMD preferred, step-up takes the union. Each shows what now crosses the wire and the check the implementer writes.

Every row is a sound design decision. Every row also moves a trust decision into application code.

1. State handles replace sessions

SEP-2567 removed protocol-level sessions and the Mcp-Session-Id header. A server that needs state across calls now mints a handle, say a cart ID or a workflow ID, returns it in a tool result, and gets it back “as an ordinary tool argument on each request.”

Think about what an ordinary tool argument is. It’s a value the model writes. It sits in the context window, it can be copied into another conversation, and a prompt injection can change it. The security best practices added a whole section for this, State Handle Hijacking, with two requirements in capitals: servers “MUST verify all inbound requests” and “MUST NOT treat possession of a state handle as authentication.” The recommended binding is to key stored state as <user_id>:<handle>, “where the user ID is derived from the verified token rather than supplied by the client.”

The same mistake has already shipped under the old session model, twice this year. The official Python SDK routed requests to an existing session “without verifying that the request was authenticated as the same principal” (GHSA-jpw9-pfvf-9f58, CVE-2026-52869, CVSS 7.1, fixed in 1.27.2). On 7 October 2026, Envoy AI Gateway, now Agent Router, disclosed that it embeds the caller’s JWT sub in the session ID as an anti-hijacking check, and that “the session-resume path never checks that discriminator against the current caller’s identity” (GHSA-953h-535j-jg2v). Its Helm chart also shipped a public default seed, so session IDs could be forged. The binding was designed, and then the check that uses it didn’t run. A state handle gets the same treatment unless someone writes the lookup.

The check: every tool that accepts a handle looks it up under the authenticated user, never on its own. Handles should be random and should expire.

This also changes how to read older findings. At MCPCon Europe I showed a Grafana MCP server accepting a session ID it had never issued. Under the new spec there’s no session ID to forge. The same mistake just moves up a layer and comes back as a handle the server never checks against the caller. I wrote about the migration side in newsletter issue 29.

2. Tool arguments become HTTP headers

SEP-2243 adds standard request headers, Mcp-Method and Mcp-Name, so load balancers and gateways can route without parsing JSON bodies. It also lets a server mark any primitive tool parameter with x-mcp-header, and then clients “MUST mirror the designated parameter values into HTTP headers” named Mcp-Param-{name}. The SEP’s own examples are a region and a tenant ID.

So a model-written value now sits exactly where infrastructure makes decisions. The SEP doesn’t hide from this. Under “Trusting Header Values” it says: “Header values originate from tool call arguments, which may be influenced by an LLM or a malicious client. Intermediaries and servers MUST NOT treat these values as trusted input for security-sensitive decisions.” Values that imply access to a resource, like tenant IDs or regions, “MUST be independently verified against the authenticated user’s permissions.”

The model fills tenant_id, the client mirrors it into Mcp-Param-TenantId, a gateway routes on it, the server checks header equals body. The check that decides access is whether the token's user belongs to that tenant.

The header and body check catches a client that lies to the gateway. It does not catch a model that was told to pick the wrong tenant.

The spec also requires servers to reject any request whose header doesn’t match the body, with a HeaderMismatch error. That check is necessary. It stops a client from routing one way and executing another. It doesn’t make the value trustworthy, though, because the header and the body come from the same model output. A prompt injection that picks the wrong tenant produces a request that passes the match check every time.

We already have a recent example of what happens when a header chooses where a request goes. CVE-2026-19516 (CVSS 3.1 9.1, published 11 August 2026, fixed in mcp-grafana 1.1.0) is a server-side request forgery in mcp-grafana: “A caller-supplied X-Grafana-URL request header controls the destination of mcp-grafana’s outbound requests,” letting a caller reach “internal, loopback, and link-local network services (including metadata endpoints).” The advisory adds that an earlier fix, for CVE-2026-15583, stopped the service-account token from going to the wrong place “but did not restrict the destinations themselves.”

The check: gateways may route on Mcp-Param-* headers, but no gateway or server grants access, picks a tenant or relaxes a rate limit because of one. Don’t mark secrets or personal data with x-mcp-header either. The SEP points out that Base64 encoding “provides no confidentiality.”

3. The authorization response names its issuer

SEP-2468 brings RFC 9207 issuer identification into MCP. An MCP client talks to many authorization servers over its life, and a malicious one can try to trick the client into sending it a code that an honest one issued. That’s a mix-up attack.

The client “MUST record the issuer value from the selected authorization server’s validated metadata document” before redirecting, and on the way back “MUST apply the validation in RFC9207 Section 2.4 before transmitting the authorization code to any token endpoint.” Comparison is exact string matching. Clients “MUST NOT apply scheme or host case folding, default-port elision, trailing-slash, or percent-encoding normalization.”

The best practices explain why the controls you already have don’t cover this: “PKCE alone does not prevent this attack because the client transmits the code_verifier to the attacker’s token endpoint.” For now, authorization servers only SHOULD send iss, and the spec says a future revision is expected to make it a MUST.

The official Python SDK shows how this check goes missing in practice. Cycode’s Yuval Elbar found that the issuer was “not validated on every discovery path” (GHSA-qx49-fqc8-xw99, 28 September 2026, CVSS 7.5). In mcp 1.9.1 through 1.29.1 there was no issuer check on any path. In 2.0.0 through 2.1.1 the check ran on the modern discovery path only. A malicious MCP server that answered the discovery request with a 404 pushed the client onto a legacy fallback, where the check was skipped. The advisory names a second way in: a 403 insufficient_scope response. The attacker’s metadata named the victim’s real identity provider, so the login page was genuine, and the authorization code, client secret and PKCE verifier went to the attacker’s token endpoint. In Cycode’s words: “The check doesn’t fail. It never runs.” It’s fixed in 1.30.0 and 2.2.0. The general lesson is about where the check sits: it has to run on every branch of the flow, including the ones a server can force.

The check: client authors store the expected issuer next to the PKCE verifier and compare it exactly, on every discovery path. Authorization server operators turn on iss now and advertise authorization_response_iss_parameter_supported.

4. Client credentials are bound to their issuer

SEP-2352 clarifies that client credentials belong to the authorization server that issued them. Clients “MUST key persisted credentials by the issuer identifier, MUST NOT reuse them with a different authorization server, and MUST re-register when the authorization server changes.”

The case it closes: an MCP server whose protected resource metadata suddenly points at a different authorization server. A client that reuses stored credentials would hand them to whoever is listed now.

The check: the client keys credential storage by issuer, and treats a change in the advertised authorization server as something to surface, not work around. The spec says clients “SHOULD surface an error rather than silently attempting to use mismatched credentials.”

5. Client ID Metadata Documents replace dynamic registration

The revision deprecates Dynamic Client Registration “in favor of Client ID Metadata Documents.” With a Client ID Metadata Document (CIMD), the client’s identifier is an HTTPS URL, and the authorization server fetches the JSON document at that URL to learn the client’s name and redirect URIs.

That gets rid of a registration endpoint anyone on the internet could call. It also opens two new surfaces, and the best practices name both.

The first is SSRF at the authorization server. In the spec’s words, “the authorization server takes a URL as input from an unknown client and fetches that URL.” A malicious client can point it at internal admin endpoints. The usual SSRF defences apply: block private and link-local ranges, send fetches through an egress proxy, and handle DNS rebinding. Backstage got one of those right and missed the next. Its experimental CIMD fetch checked the client_id hostname against private ranges but “does not apply the same validation after HTTP redirects” (GHSA-qp4c-xg64-7c6x, CVE-2026-32236, March 2026). Impact was low, because the response body never came back to the attacker, and the feature was off by default. The fix was to stop following redirects, which is what the IETF draft already requires.

The second is localhost impersonation. The metadata document “proves control of a domain, but it cannot prove which local process is listening on a localhost redirect URI.” An attacker can present a legitimate client’s metadata URL, bind any local port, and receive the code, while “the user will see the legitimate client’s name.” The fix lives on the consent screen: warn on localhost-only redirect URIs and show the redirect host clearly.

The check: authorization servers that accept CIMD treat the metadata fetch as an untrusted outbound request and apply a domain trust policy. The spec lists options running from allowlists all the way to “accept any HTTPS client_id” for open servers.

6. Step-up only adds scopes

When a server answers insufficient_scope, the client asks for a new token. SEP-2350 says the client computes “the union of the client’s previously requested scope set and the scopes from the current challenge,” so it doesn’t lose permissions it already had.

That’s right for usability. It also means a long-running client’s token only ever grows. An agent that reads files, then writes one, then administers a project ends up holding a token that can do all three, for as long as the token lives. The best practices flag the start of the same slope: “Publishing all possible scopes in scopes_supported” is listed under Common Mistakes, because a client with no scope hint falls back to requesting all of them.

The check: servers publish a minimal scopes_supported and send precise challenges. Agent harnesses set a scope ceiling per agent or per task, and shed accumulated scopes by re-authorizing when a task ends. The spec doesn’t require either. Both follow from its own least-privilege guidance.

What the revision did not change

Two limits are worth saying out loud, so nobody reads these six checks as the complete list.

Access tokens are still bearer tokens, presented with the Bearer scheme. Sender-constrained tokens through DPoP are an open proposal (SEP-1932), not part of this revision.

Local servers are still outside the authorization model. The spec says stdio implementations “SHOULD NOT follow this specification, and instead retrieve credentials from the environment.” For local servers the controls in the best practices are consent and sandboxing. Before a one-click install, the client “MUST” show “the exact command that will be executed, without truncation.”

One smaller change is worth a look too. List and read results now carry ttlMs and cacheScope, and cacheScope “controls whether shared intermediaries may cache the response.” If your tool list varies by user, mark it private.

A test pass for each check

Each check can be tested in an afternoon against your own servers and clients.

CheckTest
State handlesMint a handle as user A, present it with user B’s token. Expect a rejection.
Mirrored headersSend Mcp-Param-TenantId for a tenant user A does not belong to, with a matching body. Expect a rejection based on the token, not on the header.
Issuer validationReturn an authorization response with a different iss. Expect the client to discard it without showing the error text.
Issuer-bound credentialsChange the authorization server in protected resource metadata. Expect the client to re-register or raise an error.
CIMD fetchRegister a client_id URL that resolves to 169.254.169.254. Expect the authorization server to refuse the fetch.
Scope accumulationRun a long agent session and log the token’s scopes over time. Compare the final set to what the task needed.

If any of those six tests passes when it should fail, you’ve found the bug before someone else did.

Primary sources

MCP specification, 2026-07-28

Specification Enhancement Proposals

Standards and vulnerability records

Earlier in this series

The Security Lab Newsletter

This post is the article. The newsletter is the lab.

Subscribers get what doesn't fit in a post: the full attack code with annotated results, the measurement methodology behind the numbers, and the week's thread — where I work through a technique or incident across several days of testing rather than a single draft. The RAG poisoning work, the MCP CVE analysis, the red-teaming patterns — all of it started as a newsletter thread before it became a post. One email per week. No sponsored content. Unsubscribe any time.

Join the lab — it's free

Already subscribed? Browse the back-issues →

This post is licensed under CC BY 4.0 by the author.