T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:37
- Finding
- API and application secrets exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 37–50 and 58–67 **Vulnerability Type**: Sensitive credentials passed through command-line arguments **Risk Level**: High ### Vulnerable Code ```bash ssh root@<IP> 'export NVM_DIR=/root/.nvm; . "$NVM_DIR/nvm.sh"; openclaw config set "models.providers.<名称>" --json "{ \"baseUrl\": \"<代理地址>\", \"apiKey\": \"<API_Key>\", \"api\": \"anthropic-messages\", \"models\": [{ \"id\": \"claude-sonnet-4-6\", \"name\": \"Claude Sonnet 4.6\", \"reasoning\": true, \"input\": [\"text\", \"image\"], \"contextWindow\": 200000, \"maxTokens\": 32000 }] }"' ``` ```bash ssh root@<IP> 'export NVM_DIR=/root/.nvm; . "$NVM_DIR/nvm.sh"; openclaw config set "channels.feishu" --json "{ \"enabled\": true, \"domain\": \"feishu\", \"groupPolicy\": \"open\", \"appId\": \"<App_ID>\", \"appSecret\": \"<App_Secret>\" }"' ``` ### Technical Analysis The documented commands place an AI provider API key and a Feishu application secret directly inside SSH command-line arguments. After users replace the placeholders, the complete secrets can be exposed through: - Local shell history. - Terminal session recording and clipboard history. - CI/CD or automation logs that echo commands. - Operating-system process inspection while the command is running. - SSH wrappers, auditing systems, or administrative session logs. - Persisted OpenClaw configuration if its file permissions are overly broad. Quoting the remote command does not remove this risk. The initiating shell still receives and may record the complete command, and the SSH client receives the remote command as an argument. ### Attack Path 1. An administrator replaces the placeholders with a valid provider API key or Feishu application secret. 2. The administrator executes the documented SSH command. 3. The command is retained in shell history, a session transcript, an automation log, or process metadata. 4. An attacker with read acc ...[truncated 793 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not place API keys or application secrets directly in command-line arguments. 2. Use OpenClaw's supported secret store, protected environment-file integration, or credential-provider mechanism where available. 3. If interactive input is required, read secrets without terminal echo and pass them through standard input or a protected file descriptor rather than the process argument list. 4. Create temporary configuration files only with restrictive permissions such as `0600`, avoid shared temporary directories, and securely remove temporary material after use. 5. Ensure the resulting OpenClaw configuration is owned by the dedicated service account and is not readable by other users. 6. Disable command echoing around secret-handling steps in automation and configure CI/CD systems to mask all relevant credentials. 7. Add explicit warnings that shell history and session recording must not retain substituted commands. 8. Rotate any credential previously entered using these command templates if command histories or logs may have been accessible. 9. Prefer short-lived, scope-limited credentials and configure provider-side usage limits, network restrictions, and monitoring. ]]>
