T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
API Key Exposed Through an MCP Endpoint Query String
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37–38
Vulnerability Type: API credential exposure through command-line arguments and 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"Technical Analysis
The setup instructions require the user to substitute a real API key directly into an MCP endpoint URL. Although HTTPS protects the request while it is transmitted to the declared PatSnap service, it does not prevent local or downstream disclosure of the complete URL.
The credential can be retained or exposed through:
- Shell history files
- MCP client configuration
- Process command-line inspection
- Debug and diagnostic logs
- Proxy, gateway, or monitoring logs that record full URLs
- Crash reports and support bundles
- Accidental copying or sharing of the configured endpoint
Authentication secrets should not be placed in URL query strings. Protected environment variables, operating-system secret stores, or authorization headers provide better separation between endpoint configuration and credentials.
The network destination and authentication behavior are consistent with the Skill's declared pharmaceutical-intelligence functionality. There is no evidence that the Skill intentionally sends the key to an unrelated party. Nevertheless, the chosen credential-handling mechanism creates an avoidable disclosure risk and does not follow least-exposure principles.
Attack Path
- A user follows the documented command and replaces the placeholder with a valid PatSnap API key.
- The shell records the full command in its history, or the MCP client stores the complete URL in configuration.
- A local user, extension, diagnostic utility, log collector, support bundle recipient, or other party with access to the retained data reads the URL.
...[truncated 1035 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the API key from the endpoint query string.
- Configure authentication using a protected authorization header or an MCP-supported secret field.
- If direct secret fields are unavailable, reference a protected environment variable without expanding it into documentation, logs, or persistent endpoint configuration.
- Store credentials in an operating-system credential manager or dedicated secret-management service with restrictive access controls.
- Ensure the MCP client, proxies, and diagnostic systems redact authorization values and URL query parameters.
- Grant the API key only the minimum scopes required for pharmaceutical data retrieval and apply appropriate usage limits.
- Document key expiration, rotation, and revocation procedures.
- Warn existing users that commands containing real keys may remain in shell history and should be securely removed.
- Rotate any key that has already appeared in logs, command history, screenshots, support bundles, or shared configuration.
- Consider making the mandatory connectivity probe lazy or user-initiated so that the Skill does not contact the external service before a task actually requires it.
