T09 · Insecure Skill Coding Practices
- Location
SKILL.md:45- Finding
Hardcoded Gateway Authentication Token in Troubleshooting Documentation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 45–48
Vulnerability Type: Hardcoded authentication credential
Risk Level: HighVulnerable Code
bash # 修复命令(替换为实际 token) echo "5b56cfe28d8675390f3a39691e63999be50947e06dec1007" > ~/.openclaw/gateway.tokenTechnical Analysis
The troubleshooting documentation embeds a 48-character hexadecimal value in a copyable command that writes directly to the OpenClaw Gateway authentication-token file. The value resembles a real credential rather than an unambiguous placeholder.
Although the accompanying comment tells users to replace the token, executing the command as written stores the embedded value in
~/.openclaw/gateway.token. Publishing a potentially valid credential exposes it to every recipient of the Skill. The command can also overwrite an existing legitimate token without confirmation.No evidence establishes that the token remains active. Nevertheless, credential-like values must be treated as compromised once distributed.
Attack Path
- An attacker obtains or views the distributed Skill.
- The attacker extracts the embedded hexadecimal token from
SKILL.md. - The attacker identifies a reachable OpenClaw Gateway associated with that credential.
- If the token is valid and sufficient for Gateway authentication, the attacker submits it during the WebSocket authentication flow.
- The attacker gains whatever Gateway access and operations are authorized to that token.
A separate user-impact path also exists:
- A user follows the troubleshooting instructions without replacing the example value.
- The shell redirects the embedded token into
~/.openclaw/gateway.token, overwriting any existing content. - Subsequent ACP connections authenticate with the unintended token and may fail or operate under unintended authorization.
Impact Assessment
If the embedded value is an active or reused credential, its disclosure could enable unauthorized authentication to a ...[truncated 523 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the embedded token immediately if it was ever valid.
- Replace the value with an unmistakable placeholder:
bash printf '%s\n' "YOUR_GATEWAY_TOKEN" > ~/.openclaw/gateway.token chmod 600 ~/.openclaw/gateway.token- Warn users that the command overwrites an existing file, or prevent accidental replacement:
bash if [ -e "$HOME/.openclaw/gateway.token" ]; then echo "Refusing to overwrite the existing gateway token." >&2 exit 1 fi umask 077 printf '%s\n' "YOUR_GATEWAY_TOKEN" > "$HOME/.openclaw/gateway.token"- Prefer protected interactive input so the credential is not recorded directly in shell history:
bash mkdir -p "$HOME/.openclaw" chmod 700 "$HOME/.openclaw" read -rsp "Gateway token: " GATEWAY_TOKEN printf '\n' umask 077 printf '%s\n' "$GATEWAY_TOKEN" > "$HOME/.openclaw/gateway.token" unset GATEWAY_TOKEN- If documenting extraction from
openclaw.json, avoid printing the token to terminal output or logs, validate the source file's permissions, and write the extracted value directly to a mode-600destination. - Add secret scanning to the publication workflow to reject token-like values before Skill packages are distributed.
