T09 · Insecure Skill Coding Practices
- Location
SKILL.md:28- Finding
Bearer Token Disclosure Through a User-Configurable MCP Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 28–41
Vulnerability Type: Unvalidated credential destination
Risk Level: MediumThe Skill permits
MCD_MCP_URLto control the destination of authenticated requests. It then sends the user'sMCD_TOKENto that destination as an HTTP bearer credential.bash # Optional configuration documented at line 28: # MCD_MCP_URL: MCP service address, default https://mcp.mcd.cn MCD_URL="${MCD_MCP_URL:-https://mcp.mcd.cn}" MCD_AUTH="Authorization: Bearer ${MCD_TOKEN:-<YOUR_TOKEN>}" curl -s -X POST "$MCD_URL" \ -H "$MCD_AUTH" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"<tool name>","arguments":{<parameters>}},"id":1}'Technical Analysis
MCD_MCP_URLis accepted without validating its scheme or hostname. The bearer authorization header is attached to the request regardless of whether the selected endpoint is the intendedhttps://mcp.mcd.cnservice.If an attacker can influence the agent's environment or convince a user to configure a malicious endpoint, the prescribed command will transmit
MCD_TOKENdirectly to that endpoint. An HTTP URL could additionally expose the credential to network interception. The default endpoint is HTTPS and appears legitimate; exploitation therefore depends on modifying the optional configuration rather than the default behavior.Attack Path
- The victim obtains a valid
MCD_TOKENand makes it available to the agent. - An attacker, compromised configuration, or unsafe setup instruction sets
MCD_MCP_URLto an attacker-controlled URL. - The victim requests any documented MCP operation, such as listing available coupons.
- The agent follows the Skill instructions and executes
curlagainst the configured URL. - The request includes
Authorization: Bearer ${MCD_TOKEN}. - The attacker-controlled server records the bear ...[truncated 521 chars]
- The victim obtains a valid
- Remediation
View remediation
Remediation Suggestions
- Remove endpoint configurability if custom MCP deployments are not required, and always send authenticated requests to
https://mcp.mcd.cn. - If configurability is necessary, parse and validate the URL before sending credentials:
- Require the
httpsscheme. - Maintain an explicit allowlist of trusted hostnames.
- Reject embedded user information, unexpected ports, IP literals, and deceptive hostname suffixes.
- Require the
- Do not attach the authorization header until the destination has passed validation.
- Keep redirects disabled for credential-bearing requests, or validate every redirect destination before forwarding authorization headers.
- Use a dedicated MCP client or credential broker that binds tokens to an approved origin instead of constructing authenticated requests through a general-purpose shell command.
- Document that changing
MCD_MCP_URLcan disclose the token and should only be done for explicitly trusted endpoints. - Limit token lifetime and privileges, support prompt revocation, and rotate any token suspected of having been sent to an untrusted endpoint.
- Remove endpoint configurability if custom MCP deployments are not required, and always send authenticated requests to
