T09 · Insecure Skill Coding Practices
- Location
SKILL.md:38- Finding
API Credential Exposed Through URL Query Parameter and Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 38–40; the same insecure pattern is repeated at lines 77–79
Vulnerability Type: API credential exposure through URL query parameters
Risk Level: MediumVulnerable Code Snippet:
bash claude mcp add --transport http pharma_intelligence \ "https://connect.patsnap.com/096456/Logic-mcp?apiKey=sk-xxxxxxxxxxxx"The displayed value is a placeholder rather than a confirmed live credential. However, the instructions require users to replace it with their real PatSnap API key, preserving the insecure authentication pattern.
Technical Analysis
The Skill directs users to embed an API key in a URL query parameter supplied as a command-line argument. Query-string credentials are liable to be retained or exposed through:
- Shell command history
- Process argument inspection while the command is running
- MCP client configuration files
- Reverse-proxy and application access logs
- Network monitoring and observability systems
- Diagnostic output, crash reports, and support bundles
- Copied terminal transcripts or shared configuration
TLS can protect the request in transit, but it does not prevent the complete URL from being recorded at either endpoint or by local tooling. The behavior is not necessary for the Skill’s biomedical intelligence functionality because authentication can instead be supplied through a protected secret mechanism or authorization header.
The audited file does not instruct the Agent to read local credential files, environment variables, SSH keys, or unrelated sensitive data. No evidence of intentional credential exfiltration was identified. The vulnerability is the insecure handling of a user-supplied secret.
Attack Path
- A user creates a valid PatSnap API key.
- The user replaces
sk-xxxxxxxxxxxxwith the real key and executes the documented command. - The complete secret-bearing UR ...[truncated 924 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the API key from the URL query string.
- Configure the MCP service to transmit authentication through an HTTP
Authorizationheader or another provider-supported authentication field. - Load the credential from a protected secret store or environment variable rather than placing its literal value in the command.
- Ensure the MCP client stores credentials separately from ordinary endpoint configuration and applies restrictive filesystem permissions.
- Redact authorization data from application logs, proxy logs, telemetry, diagnostics, and error messages.
- Avoid examples that encourage users to paste real credentials into interactive shell commands.
- Document immediate revocation and rotation procedures for keys that have appeared in shell history, logs, shared configuration, or support bundles.
- Update both occurrences of the insecure setup command at lines 38–40 and 77–79.
A hardened conceptual configuration should separate the endpoint from the secret:
text Endpoint: https://connect.patsnap.com/096456/Logic-mcp Authorization: Bearer ${PATSNAP_API_KEY}The exact syntax should follow the MCP client and PatSnap authentication mechanisms, without placing the resolved secret in the URL or persistent command history.
