T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:39
- Finding
- API Credential Exposed Through URL Query Parameters## Vulnerability Details **File Location**: `SKILL.md:39-42` and `SKILL.md:77-82` **Vulnerability Type**: API credential exposure through command-line and URL query parameters **Risk Level**: Medium ### Vulnerable Code ```bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/logic-mcp?apiKey=sk-xxxxxxxxxxxx" ``` The connectivity-error guidance repeats the same insecure configuration pattern: ```bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/logic-mcp?apiKey=YOUR_API_KEY" ``` The values shown are placeholders rather than live credentials. However, the instructions explicitly require users to replace them with real API keys in URL query parameters. ### Technical Analysis Placing a secret in a URL can disclose it through multiple secondary channels, including: - Shell command history - MCP client configuration files - Process inspection while the command is running - HTTP client, proxy, gateway, and server access logs - Telemetry, diagnostics, and copied error messages - Screenshots or support bundles containing the configured URL URL query strings are routinely retained and logged as ordinary request metadata. Consequently, TLS protects the URL while it is in transit but does not prevent disclosure through endpoint configuration, local history, or intermediary and server-side logging. The skill also mandates a network connectivity probe before processing every query at `SKILL.md:63-67`. Network access to PatSnap is consistent with the declared research functionality, but repeating the probe for every query is broader than necessary. It increases external request volume and credential use without providing additional capability once connectivity has already been established. ### Attack Path 1. A user follows the documented setup command and substitutes a valid PatSnap API key. 2. The complete URL containing t ...[truncated 1124 chars]
- Remediation
- ## Remediation Suggestions 1. Do not place API keys in URLs or literal command-line arguments. 2. Prefer an authorization header supported by the MCP service, such as a bearer token supplied through protected client configuration. 3. If the client supports environment interpolation, reference an environment variable rather than embedding the secret: ```bash export PATSNAP_API_KEY="..." ``` Ensure the value itself is not entered into committed files or exposed in shell tracing. 4. Store credentials in the operating system credential manager, an MCP-supported secret store, or another access-controlled secrets manager. 5. Configure clients, proxies, gateways, and servers to redact authorization values and any legacy `apiKey` query parameter from logs, telemetry, diagnostics, and errors. 6. Restrict credential files to the owning user and document their expected storage location and permissions. 7. Scope API keys to the minimum required services, operations, quotas, and lifetime. Provide documented revocation and rotation procedures. 8. Treat any key previously used in a query string as potentially exposed and rotate it after migrating to secure authentication. 9. Perform the EGFR connectivity probe once during setup or once per session, then retry only after connection failures rather than before every user query. 10. Clearly notify users that research terms are transmitted to the external PatSnap service and advise against submitting confidential or regulated data unless organizational policy permits it.
