T09 · Insecure Skill Coding Practices
- Location
SKILL.md:33- Finding
API Credential Exposed Through URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 33–35; repeated at lines 72–75
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 credential-passing pattern is repeated in the connectivity-error guidance:
bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/logic-mcp?apiKey=YOUR_API_KEY"Technical Analysis
The setup instructions require users to insert a PatSnap API key directly into a URL query parameter. Although the URL uses HTTPS and therefore receives transport encryption, query-string credentials may still be retained outside the encrypted network channel.
The complete credential-bearing URL may be exposed through:
- Shell command history
- Claude MCP configuration or diagnostic output
- Process inspection while the setup command runs
- Proxy, gateway, load balancer, or server access logs
- Error reports, telemetry, screenshots, and support bundles
- Browser or monitoring records if the URL is reused outside the CLI
API keys are bearer credentials. Anyone who obtains the URL may be able to replay the key without possessing additional authentication factors. This behavior is related to the Skill's declared PatSnap integration, but placing the secret in the URL exceeds the minimum exposure necessary to authenticate requests.
No real hardcoded API key was present in the reviewed file; the displayed values are placeholders. The vulnerability arises when a user follows the instructions and substitutes a live credential.
Attack Path
- A user follows the setup instructions and replaces the placeholder with a valid PatSnap API key.
- The credential-bearing command is saved in shell history, MCP config ...[truncated 1245 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove API keys from URL query parameters. Prefer an HTTP authorization header, such as
Authorization: Bearer, if supported by the service and MCP client. - Use protected secret storage. Configure the MCP connection through an operating-system keychain, MCP secret-reference facility, or another credential manager rather than embedding the key directly in configuration.
- Avoid command-line expansion of secrets. If environment variables must be used, ensure the client resolves the secret securely without persisting the expanded value in shell history, process arguments, or generated configuration.
- Redact credentials from telemetry and logs. Explicitly filter
apiKey, authorization headers, and credential-bearing URLs from client, proxy, gateway, server, and diagnostic logs. - Apply least privilege to issued keys. Restrict each key to the minimum APIs, datasets, quotas, and account permissions required by this Skill.
- Support credential lifecycle controls. Document key rotation and immediate revocation procedures, and use short-lived credentials where supported.
- Update both affected examples. Replace the setup command at lines 33–35 and the error-guidance command at lines 72–75 so users are not directed back to the insecure pattern.
- Warn existing users to rotate exposed keys. Keys previously entered into URL-based configurations should be revoked and replaced after shell histories, configurations, and relevant logs are sanitized.
- Remove API keys from URL query parameters. Prefer an HTTP authorization header, such as
