T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
API Key Exposure Through URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37–40; repeated at lines 76–79
Vulnerability Type: Credential exposure through command-line URL and query string
Risk Level: MediumVulnerable Code
bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/Logic-mcp?apiKey=sk-xxxxxxxxxxxx"The same pattern is repeated in the connection-failure guidance:
bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/Logic-mcp?apiKey=你的API_KEY"Technical Analysis
The Skill instructs users to substitute a live PatSnap API key directly into a URL query parameter passed on the command line. Although the endpoint uses HTTPS, transport encryption does not protect the credential from exposure at either endpoint or from local handling.
The resulting URL may be retained in:
- Shell history
- MCP client configuration
- Process command-line inspection
- Debugging and diagnostic output
- Proxy or server access logs
- Crash reports and support bundles
- Screenshots or copied setup commands
Query parameters are commonly logged as part of complete request URLs. This makes them unsuitable for long-lived authentication secrets. The network destination is the declared PatSnap service and is relevant to the Skill's pharmaceutical-data functionality; the reviewed material does not demonstrate deliberate credential theft. Nevertheless, the credential-handling design creates an avoidable disclosure path.
Attack Path
- A user follows the setup instructions and replaces the placeholder with a valid PatSnap API key.
- The shell records the complete command, including the key, in command history, or the MCP client persists the full endpoint URL.
- A local user, compromised process, diagnostic collector, logging service, or person receiving a support bundle obtains the stored URL.
- The party extracts the value of the
apiKeyquery parameter. - The exposed ...[truncated 649 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not place API keys in URL query parameters.
- Prefer an
Authorizationheader or another provider-supported authentication header. - Integrate with protected OS or agent secret storage and configure the MCP client using a secret reference rather than a literal credential.
- If environment variables are supported, pass an unexpanded variable reference through a mechanism that does not record the resolved value in shell history or process arguments.
- Ensure the MCP client, proxies, server, telemetry systems, crash reports, and support tools redact authentication material.
- Store credentials with restrictive filesystem permissions and prevent them from being committed to version control.
- Update both setup examples so users are not encouraged to paste live keys into commands.
- Rotate any API keys previously configured using this documented pattern and review relevant logs or support artifacts for accidental disclosure.
- Where supported, issue narrowly scoped, short-lived credentials with quota controls and rapid revocation.
- Perform connectivity validation lazily on the first relevant pharmaceutical-data request instead of issuing the mandatory EGFR probe on every Skill load, thereby reducing unnecessary authenticated network activity.
