T09 · Insecure Skill Coding Practices
- Location
SKILL.md:162- Finding
API Key May Be Disclosed to an Arbitrary Configurable Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:162-164
Vulnerability Type: Unrestricted credential forwarding
Risk Level: HighVulnerable Code
text - **API key**: Env `ZCLAW_API_KEY`, or `ZCLAW_API_KEY` in `~/.zclaw/config.json` (see path note below). The bridge also accepts the key via header `X-ZClaw-Api-Key` or body `apiKey`. - **Base URL**: `ZCLAW_BASE_URL` or `ZINIAO_ZCLAW_BASE_URL` (default `http://127.0.0.1:9481`). - **First time / Rotate key**: Obtain a ZClaw API key from your server or Ziniao Ecosystem Center. You can configure it via conversation, environment, configuration file, or an installation script.The invocation workflow further directs the Agent to include the resolved key in every invocation request.
Technical Analysis
Authentication is necessary for the declared browser-bridge functionality. However, the Skill independently resolves the API key and destination URL, then forwards the key to the configured destination without requiring that the endpoint remain on loopback, use HTTPS, or match a trusted hostname.
The environment variables
ZCLAW_BASE_URLandZINIAO_ZCLAW_BASE_URLtherefore act as credential-routing controls. If either variable or the corresponding configuration is modified by an attacker, authenticated requests can be redirected away from the intended local bridge.This exceeds minimum privilege because the Skill only needs to disclose the credential to a known Ziniao bridge, not to an arbitrary environment-selected HTTP origin. The documented default also uses plaintext HTTP, which is acceptable for a strictly loopback-only service but unsafe if the same scheme is used with a remote host.
Attack Path
- An attacker with influence over the Agent's environment or ZClaw configuration sets
ZCLAW_BASE_URLorZINIAO_ZCLAW_BASE_URLto an attacker-controlled endpoint. - The Skill resolves
ZCLAW_API_KEYfrom the conversation, environment, or `~/.zc ...[truncated 1010 chars]
- An attacker with influence over the Agent's environment or ZClaw configuration sets
- Remediation
View remediation
Remediation Suggestions
- Restrict the default configuration to loopback addresses such as
127.0.0.1and::1. - Reject non-loopback destinations unless the user explicitly enables remote bridge access.
- For remote access, require HTTPS and validate the certificate and expected hostname.
- Maintain an explicit allowlist of trusted bridge origins and bind each credential to a specific origin.
- Reject URLs containing user information, unexpected ports, fragments, or non-HTTP protocols.
- Do not forward credentials across redirects; either disable redirects or revalidate the destination after every redirect.
- Display the destination origin and request confirmation before first sending a key to a newly configured remote endpoint.
- Use a narrowly scoped bridge token with expiration, rotation, and per-tool authorization where supported.
- Restrict the default configuration to loopback addresses such as
