TL;DR: Wildcard CORS, no authentication, shared transports, and issuer-free OAuth wrappers make MCP reference server deployments able to leak environment secrets and redirect credentials, according to Adversa AI’s October MCP security digest and related papers. Local trust assumptions collapse once a browser tab or untrusted server can reach the tool surface without boundary checks.
At a glance
What this is: NHI Mgmt Group's analysis, drawing on Adversa AI's research: MCP reference server flaws let unauthenticated local access, shared transports, and issuer-free OAuth paths expose environment secrets and redirect credentials.
Why it matters: This matters because MCP now sits inside developer workflows where browser reach, local trust, and delegated access can turn a convenience layer into a secret-handling boundary failure.
Context
The core problem is that MCP deployments often inherit browser-era and localhost assumptions that do not hold once tools, transports, and OAuth flows are exposed to untrusted callers. A server that can read environment variables, accept cross-origin requests, or trust whatever authorization server it is told to use has already lost the boundary that identity governance expects.
That failure is an NHI governance problem because MCP servers act as machine identities with secrets, session state, and delegated access. When the server, client wrapper, or transport layer is treated as trusted by default, the control plane is no longer separated from the runtime path that can reach credentials and tool outputs.
The issue is not just one flawed server implementation. It is a pattern of weak authentication, weak origin validation, and over-broad credential handling across MCP stacks, including reference servers and shared SDK patterns.
Key questions
Q: How should security teams secure a remote MCP server?
A: Security teams should place an authentication and authorization layer in front of the MCP server, keep the tool service private where possible, and validate every request before it reaches connected tools. That approach reduces unauthorized invocation, creates a policy point for roles and scopes, and makes tool use attributable in logs.
Q: What is the difference between a shared transport and per-session isolation?
A: A shared transport lets multiple sessions use the same connection or channel, so session state must be separated in application logic. Per-session isolation gives each session its own transport, context, or execution boundary, reducing cross-talk between secrets, tokens, and requests. In machine access design, isolation limits token replay and accidental disclosure across concurrent workloads.
Q: How does issuer binding protect machine-to-machine OAuth flows?
A: Issuer binding ties an OAuth token or assertion to the trusted authorisation server that issued it, so a resource server can reject tokens minted by another issuer. In machine-to-machine flows, it prevents token substitution across tenants or environments and helps stop replay of valid-looking credentials from an untrusted source.
Q: What should teams do first when an MCP server can read environment variables?
A: First, remove or strictly gate access to environment variables, because they often contain secrets such as API keys, tokens, and certificates. An MCP server that can read them can exfiltrate credentials or impersonate workloads, so teams should run it with least privilege, scrub inherited variables, and split sensitive values into dedicated secret stores or scoped runtime mounts.
Technical breakdown
Why unauthenticated MCP transports become secret exfiltration paths
MCP transports that bind to localhost or expose SSE and HTTP endpoints are not inherently safe. If they accept requests without authentication and do not validate Host and Origin, any browser session that can reach the endpoint may drive tools and read returned data. In the server-everything case, a simple get-env tool exposed process.env, which turns a development helper into a credential disclosure mechanism. The security issue is not the tool name itself, but the combination of transport reachability, permissive cross-origin policy, and unguarded output. See the MCP Security Guide.
Practical implication: Require authentication, origin validation, and explicit allowlists before any MCP transport can expose sensitive runtime data.
How shared MCP server instances break session isolation
JSON-RPC ids are only safe when they are unique within a connection boundary. In the TypeScript server SDK issue, message routing relied on the request id alone, while common clients number requests from zero and can collide in normal use. If one server or transport instance is shared across users, responses and notifications can be delivered to the wrong session. That is a failure of session isolation, not merely a bug in message handling, because the server object becomes a cross-user conduit when it should be scoped per request or per session. Read What Is MCP? The Model Context Protocol Explained (2026).
Practical implication: Scope each MCP server or transport to a single request or session when the implementation cannot prove connection isolation.
Why issuer binding matters in machine-to-machine OAuth for MCP
Machine-to-machine OAuth depends on the client knowing which authorization server it is supposed to trust. If a client wrapper accepts an issuer from the server without binding it to a pre-approved authority, the server can redirect the client secret or assertion to an attacker-controlled endpoint. That is a trust-anchor failure, not just an OAuth configuration mistake. The credential may still be valid cryptographically, but it has been presented to the wrong authority, which turns delegated access into credential relay risk. See the Machine-to-Machine OAuth (Client Credentials) Guide.
Practical implication: Bind every OAuth client credential flow to an expected issuer and reject authorization servers that do not match policy.
Threat narrative
Attacker objective: The attacker wants to steal secrets or impersonate trusted MCP traffic so they can access data and tools that belong to another session or service.
- Entry occurs when a browser tab or untrusted MCP server can reach a local or shared transport that lacks authentication and origin checks.
- Credential exposure follows when the server returns environment variables, forwards client secrets, or misroutes session-bound messages across users.
- Impact occurs when the attacker reads secrets, impersonates a client against a trusted authorization server, or operates inside another user's backend session.
Breaches seen in the wild
- Smithery.ai MCP hosting breach 2025: A Smithery.ai build flaw gave GitGuardian a live fly.io token controlling 3,000+ hosted MCP servers and the API keys their clients sent.
- EmeraldWhale Git config credential theft: Tokens in exposed .git/config files let EMERALDWHALE clone private repositories and steal more than 15,000 cloud credentials.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
MCP turns local trust into an identity problem, not just a transport problem: Once a server can expose process secrets, accept browser-origin traffic, or redirect OAuth flows, the security question is who the server is allowed to trust at runtime. That is why MCP governance has to cover authentication, origin control, and credential audience binding together. The practitioner implication is simple: treat MCP endpoints as governed identities with explicit trust boundaries.
Session isolation is the named concept this topic exposes: Shared transports and shared server objects create a cross-user path that conventional request handling assumptions do not catch. If one instance can route messages for multiple users, message identity becomes a security boundary, not a coding convenience. The practitioner implication is to stop assuming that a single long-lived server object can safely mediate separate users.
Issuer drift is the failure mode that makes machine-to-machine OAuth fragile in MCP ecosystems: A client secret or signed assertion is only as trustworthy as the issuer that received it. When a server can steer the client toward an arbitrary authorization server, delegated access becomes redirectable rather than bound. The practitioner implication is to re-evaluate any MCP integration that trusts server-advertised issuers without pre-binding.
These flaws show why NHI governance has to extend beyond secret storage into runtime trust enforcement: Secret rotation alone does not prevent a browser from reading exposed environment variables or a shared transport from misrouting messages. The control gap is not the absence of a vault, but the absence of runtime checks that preserve the intended identity boundary. The practitioner implication is to govern MCP servers as active credential consumers, not passive configuration files.
From our research library:
- 24,008 unique secrets were exposed in MCP configuration files in 2025 alone, the protocol's first year of widespread adoption, according to the State of Secrets Sprawl 2026.
- Read next: MCP Gateway and MCP Server Governance Guide
What this signals
Runtime trust will become the MCP control point: The next wave of MCP governance will move from static configuration checks to issuer binding, origin validation, and session scoping. Once tools can be reached from browsers, shared transports, or untrusted servers, trust has to be enforced at request time rather than assumed at deployment time.
Secret exposure is now a transport problem as much as a storage problem: Environment variables, client secrets, and session state are all reachable through MCP paths if the server trusts the wrong caller. 24,008 unique secrets were exposed in MCP configuration files in 2025 alone, according to the State of Secrets Sprawl 2026, which shows why runtime disclosure and secret hygiene have to be governed together.
Governance teams should expect more overlap between NHI security and agentic application security: MCP sits between tool access, delegated identity, and model-driven execution, so a weak trust boundary can cascade into credential theft or cross-user action. The practical response is to treat MCP as a governed identity surface, not a convenient integration layer.
For practitioners
- Enforce authentication on every MCP endpoint Require explicit authentication before any HTTP or SSE transport can expose tools, session state, or runtime values to a caller.
- Validate Host and Origin on local MCP servers Block browser-origin requests and DNS rebinding paths by checking both Host and Origin instead of trusting a localhost bind address.
- Bind OAuth clients to a trusted issuer Set an expected issuer for machine-to-machine OAuth flows and reject authorization servers that do not match the approved authority.
- Scope MCP server instances per session Avoid sharing one long-lived transport or server object across users when the implementation routes messages by request id alone.
- Reduce generic tools to narrow capabilities Replace broad tools such as environment readers or command runners with purpose-built functions that return only the minimum required data.
Key takeaways
- MCP reference server weaknesses can expose environment secrets, session state, and OAuth credentials when authentication and origin checks are missing.
- Shared transports and issuer-free OAuth wrappers extend the same failure pattern by breaking session isolation and redirecting trust to the wrong authority.
- Practitioners should govern MCP as an identity surface with explicit authentication, issuer binding, and least-privilege tool exposure.
Related NHI Mgmt Group resources: MCP Security Guide · Machine-to-Machine OAuth (Client Credentials) Guide · MCP Gateway and MCP Server Governance Guide · What Is MCP? The Model Context Protocol Explained (2026)
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and MITRE ATT&CK define the specific risk controls and attack patterns relevant to this term.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | MCP servers exposing environment variables and client secrets create direct secret leakage risk. |
| NHI-04 — Insecure Authentication | Unauthenticated MCP endpoints and issuer-free OAuth flows weaken identity assurance at the transport boundary. | |
| NHI-05 — Overprivileged NHI | Broad environment access and generic tools give MCP servers more privilege than their task requires. | |
| Recommendation — Scan MCP transports and tools for exposed secrets and remove any path that can return process credentials. Require authentication and issuer binding before an MCP server can accept requests or forward credentials. Reduce MCP server privileges to the minimum tool and data scope needed for each session. | ||
| MITRE ATT&CK | TA0006; TA0008 — Credential Access; Lateral Movement | The article describes secret theft and cross-session use of those credentials for broader access. |
| Recommendation — Map exposed MCP secret paths to credential access and lateral movement, then hunt for cross-session abuse. | ||
Key terms
- Model Context Protocol: Model Context Protocol is an open protocol that lets AI agents connect to tools and data sources. It expands what an agent can reach, so governance has to cover not only the model and its prompts, but also every system that can receive or return agent-driven data.
- Host and Origin validation: Host and origin validation is a web security check that compares a request’s Host header and browser origin against an allowlist. It helps a server confirm which site or application a request is meant for, reducing risks such as host header attacks, cache poisoning, and some cross-site request forgery scenarios.
- Cross-Origin Resource Sharing: CORS is a browser security control that decides whether one origin may read responses from another origin. It does not authenticate users or protect servers by itself. Instead, it governs which browser-based requests may be exposed to JavaScript after the server returns a response.
- Issuer Binding: The requirement to verify which authorization server issued an authorization response and to bind credentials to that issuer. For MCP, it reduces mix-up attacks and keeps client trust aligned with the correct authorization authority.
Deepen your knowledge
NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are responsible for identity security strategy or NHI governance in your organisation, it is worth exploring.
Published by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org