T09 · Insecure Skill Coding Practices
- Location
SKILL.md:29- Finding
API Key Exposed Through URL Query-String Configuration
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 29-38; the unsafe configuration pattern is repeated at lines 66-75
Vulnerability Type: API credential exposure through URL query parameters
Risk Level: MediumVulnerable Code
bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/logic-mcp?apiKey=sk-xxxxxxxxxxxx"The same credential-passing pattern appears again in the mandatory connectivity-check instructions:
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 place a PatSnap API key directly in the MCP endpoint's URL query string. HTTPS protects the URL while it is transmitted, but it does not prevent the complete URL from being exposed at either endpoint or through local configuration.
Query-string credentials can be retained in:
- Shell command history
- MCP client configuration files
- Process arguments or diagnostic information
- HTTP proxy and server access logs
- Application telemetry and error reports
- Screenshots, copied commands, or shared configuration output
Access to the PatSnap service is necessary for the Skill's declared pharmaceutical research functionality. However, placing the credential in the endpoint URL exceeds minimum safe credential exposure because a secret-specific mechanism, such as an authorization header or protected secret store, would provide better isolation.
The supplied value is only a placeholder and is not itself an active hardcoded credential. The vulnerability occurs when a user follows the documented procedure and substitutes a real API key.
Attack Path
- A user creates a valid PatSnap API key.
- The user substitutes the real key into the documented MCP command.
- The complete command and credential-bearing URL are retained in she ...[truncated 1257 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not place API keys in endpoint URLs or query parameters.
- Configure authentication through an
Authorizationheader or another credential header supported by both the MCP client and PatSnap, for example:text Authorization: Bearer ${PATSNAP_API_KEY} - Load the key from a protected environment variable, operating-system credential manager, or MCP secret-management facility rather than embedding it directly in a command or configuration URL.
- Ensure configuration files containing credential references have restrictive filesystem permissions and are excluded from source control.
- Redact query parameters, authorization headers, and environment-variable values from application logs, proxy logs, telemetry, diagnostics, and error messages.
- Issue narrowly scoped keys with only the permissions required for pharmaceutical research operations. Apply expiration dates and usage limits where supported.
- Document key rotation and immediate revocation procedures for users who may have followed the existing instructions.
- Review shell histories, MCP configuration files, and relevant logs for previously exposed credentials. Rotate any key that may have been recorded.
- Run the fixed EGFR connectivity probe once during initial setup, once per session, or after a connection error rather than before every query, thereby minimizing unnecessary outbound requests.
