T09 · Insecure Skill Coding Practices
- Location
SKILL.md:53- Finding
API Credential Exposure Through a User-Controlled API Base URL
- Content
View full analysis
` ### Get Categories ```bash curl -m 60 -X POST "$X2C_API_BASE_URL" \ -H "Content-Type: application/json" \ -H "X-API-Key: $X2C_API_KEY" \ -d '{"action": "distribution/categories", "lang": "zh-CN"}' ``` ``` ### Technical Analysis The skill instructs the agent to obtain the request destination directly from the `X2C_API_BASE_URL` environment variable and attach the sensitive `X2C_API_KEY` credential to requests sent to that destination. The supplied project does not define the expected production endpoint, require HTTPS, validate the hostname, or establish an allowlist of trusted origins. An attacker who can influence the environment variable or relevant OpenClaw configuration can redirect requests to a server under their control. Because the API key is sent in a request header, the attacker-controlled server can capture it without needing to intercept encrypted traffic. The same request pattern is documented for publishing and wallet functionality. A stolen key may therefore expose all capabilities granted to that credential rather than only the category endpoint shown above. ### Attack Path 1. The attacker influences `X2C_API_BASE_URL` through environment configuration, deployment configuration, or another configuration injection vector. 2. The value is changed to an attacker-controlled HTTP or HTTPS endpoint. 3. A user invokes any documented X2C operation. 4. The agent executes `curl` and attaches `X2C_API_KEY` to the request. 5. The attacker-controlled endpoint records the `X-API-Key` header. 6. The attacker reu ...[truncated 612 chars]- Remediation
View remediation
