T09 · Insecure Skill Coding Practices
- Location
index.js:8- Finding
Configurable API Endpoint Can Expose API Keys and Sensitive Business Data
- Content
View full analysis
Vulnerability Details
File Location:
index.js:8-24
Vulnerability Type: Unvalidated destination for authenticated API requests
Risk Level: MediumVulnerable Code
javascript const API_BASE_URL = process.env.ZHENCAP_API_URL || 'https://www.zhencap.com/api/v1'; const API_KEY = process.env.ZHENCAP_API_KEY; class ZhenCapSkill { constructor() { // Build headers object conditionally const headers = { 'Content-Type': 'application/json' }; // Only add Authorization header if API key exists if (API_KEY) { headers['Authorization'] = `Bearer ${API_KEY}`; } this.client = axios.create({ baseURL: API_BASE_URL, headers: headers }); }Technical Analysis
The destination of every API request can be overridden through
ZHENCAP_API_URL. The implementation does not validate the URL scheme, hostname, port, or origin before attaching the bearer credential.If the process environment is influenced by an untrusted MCP configuration, deployment script, container configuration, or local user, requests can be redirected to an attacker-controlled server. The same Axios client then sends both the
Authorizationheader and user-supplied analysis inputs to that destination.The affected payloads include company names, industries, revenue, growth rates, funding stages, team sizes, and other risk-scoring data. A plaintext
http://URL is also accepted, allowing network interception where such traffic is permitted.Attack Path
- An attacker obtains the ability to modify the Skill's environment or MCP launch configuration.
- The attacker sets
ZHENCAP_API_URLto an attacker-controlled URL, such ashttps://attacker.example/api/v1. - A user starts the Skill with a valid
ZHENCAP_API_KEY. - The user invokes any analysis method.
- Axios sends the bearer credential and request body to the attacker-controlled endpoint.
...[truncated 730 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove production endpoint configurability unless it is operationally required.
- Parse the configured value with the standard
URLclass and reject malformed URLs. - Require the
https:scheme. - Enforce an explicit hostname and port allowlist, preferably permitting only
www.zhencap.comon port 443. - Before adding the authorization header, verify that the final request origin is the approved ZhenCap origin.
- Configure Axios redirect handling so credentials cannot be forwarded to an untrusted redirect destination.
- If custom endpoints are needed for development, require a separate explicit development mode and do not attach production credentials to them.
- Add automated tests confirming that HTTP URLs, user-information URLs, lookalike domains, unapproved ports, and unapproved hosts are rejected.
