T09 · Insecure Skill Coding Practices
- Location
SKILL.md:8- Finding
Unvalidated API Base URL Can Disclose the Bearer Credential
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 8 and 20-44
Vulnerability Type: Credential disclosure through an unvalidated configurable API destination
Risk Level: MediumVulnerable Code
yaml metadata: { "openclaw": { "emoji": "📰", "requires": { "env": ["LB_API_KEY", "LB_API_BASE"] }, }, }markdown ## Instructions for the hosting agent 1. **Environment variables**: If `LB_API_KEY` or `LB_API_BASE` is missing, ask the user to configure it according to **Setup** below. 2. **Only use paths and parameters listed in the "Endpoints" section of this document**; do not invent endpoints. ## Setup ### Obtain an API Key 1. Visit [https://stock.quicktiny.cn](https://stock.quicktiny.cn), register an account, and sign in. 2. Open the Developer API page at `/developer`. 3. Select Create Key. The system generates an API key beginning with `lb_`. 4. Copy and save it immediately; the key is shown only once. ### Configure Environment Variables ```bash export LB_API_KEY="lb_your_key_here" export LB_API_BASE="https://stock.quicktiny.cn/api/openclaw"Authentication
bash curl -s -H "Authorization: Bearer $LB_API_KEY" "$LB_API_BASE/endpoint"text ### Technical Analysis The Skill treats `LB_API_BASE` as a trusted request destination and unconditionally places `LB_API_KEY` in the HTTP `Authorization` header. Although the setup example recommends the legitimate `https://stock.quicktiny.cn/api/openclaw` URL, the hosting-agent instructions only check whether the environment variable exists. They do not require validation of its URL scheme, hostname, port, or path. Consequently, an attacker who can influence the agent's environment or deployment configuration can set `LB_API_BASE` to an attacker-controlled endpoint. When the agent follows any documented API request, `curl` transmits the bearer credential to that endpoint. Redirect behavior also requires explicit hardening so that future com ...[truncated 1487 chars]- Remediation
View remediation
Remediation Suggestions
-
Remove
LB_API_BASEfrom user-controlled configuration and hard-code the trusted service origin where operationally possible:bash LB_API_BASE="https://stock.quicktiny.cn/api/openclaw" -
If configurability is required, parse and validate the URL before attaching credentials. Require all of the following:
- Scheme exactly equal to
https. - Hostname exactly equal to
stock.quicktiny.cn. - An approved port, normally
443. - Path equal to or contained beneath
/api/openclaw. - No embedded username or password.
- No hostname suffix, substring, or wildcard matching.
- Scheme exactly equal to
-
Instruct the hosting agent to reject requests when validation fails rather than silently using the supplied destination.
-
Harden transport behavior and prevent unsafe protocol or redirect handling. For example:
bash curl --silent --show-error --fail \ --proto '=https' \ --max-redirs 0 \ -H "Authorization: Bearer $LB_API_KEY" \ "https://stock.quicktiny.cn/api/openclaw/endpoint" -
If redirects are later enabled, verify every redirect target against the same strict origin allowlist before forwarding the authorization header.
-
Store the API key in a managed secret store with narrowly scoped access. Avoid exposing it in logs, shell tracing, diagnostic output, or error messages.
-
Support rapid key revocation and rotation. Revoke any key suspected of having been used while
LB_API_BASEpointed to an untrusted destination.
-
