T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:68
- Finding
- Gateway Authentication Token Exposed During Triage## Vulnerability Details **File Location**: `SKILL.md:68` **Vulnerability Type**: Authentication token disclosure through command output **Risk Level**: High **Complete Vulnerable Code Snippet**: ```bash # 11. Check OPENCLAW_GATEWAY_TOKEN env var (multi-profile foot-gun) echo "OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN:-unset}" ``` ### Technical Analysis The triage command expands and prints the complete value of `OPENCLAW_GATEWAY_TOKEN`. Because Skill command output can be displayed in a terminal, recorded in an agent transcript, or retained by execution and observability systems, this unnecessarily exposes a reusable authentication credential. Diagnosis only requires determining whether the environment variable is configured. Printing its value violates secret-handling and least-disclosure principles. The token is not hardcoded in the Skill, but it is disclosed at runtime whenever this triage step is executed. ### Attack Path 1. A user or agent invokes the gateway triage protocol while `OPENCLAW_GATEWAY_TOKEN` is set. 2. Shell expansion substitutes the active gateway token into the command output. 3. The complete token is captured in terminal history, agent transcripts, diagnostic records, or monitoring logs. 4. An attacker with access to one of those output channels retrieves the token. 5. The attacker presents the token to a reachable OpenClaw gateway. 6. If no additional control blocks the request, the attacker gains the gateway access associated with that token. ### Impact Assessment Successful exploitation can expose the authentication authority assigned to the gateway token. The precise reachable scope depends on gateway network exposure and server-side authorization, but it may include unauthorized gateway connections and access to operations available to an authenticated client. Exposure can also affect multiple profiles if they share the same profile-agnostic environment token.
- Remediation
- ## Remediation Suggestions Never print the token value. Test only whether the variable is present: ```bash if [ -n "${OPENCLAW_GATEWAY_TOKEN:-}" ]; then echo "OPENCLAW_GATEWAY_TOKEN=set" else echo "OPENCLAW_GATEWAY_TOKEN=unset" fi ``` If profile comparison is necessary, use a non-reversible, narrowly scoped fingerprint and avoid retaining it in logs. Redact existing transcripts and diagnostic records that may contain the token, rotate any token that may already have been exposed, and ensure command tracing such as `set -x` is disabled around secret-handling operations.
