T09 · Insecure Skill Coding Practices
- Location
SKILL.md:35- Finding
API Key Exposed Through URL Query Parameter and Command-Line Argument
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 35–38
Vulnerability Type: API credential exposure through insecure configuration
Risk Level: MediumVulnerable Code
bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/logic-mcp?apiKey=sk-xxxxxxxxxxxx"The same insecure configuration pattern is repeated in the connection-failure guidance at lines 73–77:
bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/logic-mcp?apiKey=你的API_KEY"Technical Analysis
The setup instructions require the user to replace the placeholder with a real PatSnap API key and embed that key in a URL query parameter passed as a command-line argument.
Although the endpoint uses HTTPS, transport encryption does not prevent the credential from being exposed through:
- Shell history containing the complete command.
- Process inspection while the command is running.
- MCP client configuration that may persist the complete endpoint.
- Application, proxy, monitoring, or server logs that record complete URLs.
- Diagnostic output, screenshots, terminal transcripts, or configuration backups.
URL query parameters are particularly unsuitable for secrets because URLs are routinely retained and logged by infrastructure. The behavior is necessary only insofar as the Skill requires authenticated access to PatSnap; placing the credential directly in the URL and command line exceeds the minimum exposure necessary for authentication.
No evidence indicates that the placeholder itself is a live secret or that the Skill intentionally sends credentials to an unrelated party. The risk arises when users follow the instructions with their real API keys.
Attack Path
- A user creates a valid PatSnap API key.
- The user substitutes the key into the documented URL.
- The user executes the
claude mcp addcommand. - The complete URL and API key are retained in shell histo ...[truncated 1089 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not place API keys in URL query parameters.
- Configure the service to accept credentials through an
Authorizationheader or another dedicated secret-bearing header. - Provide the key through a protected environment variable, operating-system credential store, secret manager, or interactive secret prompt that does not echo or retain it.
- If the MCP client must persist authentication, store the credential separately from the endpoint in a permission-restricted secret store.
- Ensure clients, proxies, monitoring systems, and servers redact authorization material from logs and diagnostics.
- Document least-privilege key scopes, expiration, revocation, and rotation procedures.
- Warn users who followed the existing instructions to remove affected shell-history and configuration entries and rotate the exposed key.
- Replace both documented command examples with a secure configuration pattern so the failure-recovery instructions do not reintroduce the vulnerability.
