Forging a Bearer to take over a LiteLLM MCP session: reproduction and analysis of the OAuth2 passthrough authentication bypass
一个伪造 Bearer 拿下 MCP 会话:LiteLLM MCP OAuth2 passthrough 认证绕过复现与分析
LiteLLM's MCP gateway has an authentication bypass vulnerability GHSA-7488-6r32-c95q, CVSS 3.1 score 8.8, disclosed 2026-06-30, affecting litellm < 1.84.0. The author's reproduction shows that an unauthenticated attacker only needs to carry a forged Bearer header and no x-litellm-api-key to establish an authenticated MCP session and list and invoke MCP tools behind the gateway. The root cause is that, to support OAuth2 token passthrough, the authentication code uses except to swallow the exception when key validation throws 401/403, returning an empty UserAPIKeyAuth(), which downstream treats as a legitimate session. The fix in 1.84.0 (commit 73869f0) only falls back to anonymous passthrough when the request points to an upstream configured with OAuth2 passthrough; the author's testing showed the same attack succeeded on 1.83.6 and was rejected with 401 on 1.84.0.
The author reproduced the LiteLLM MCP gateway authentication bypass with minimal code and reminds auditors of authentication middleware to watch for patterns where authentication failure is allowed through by a fallback.