T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/screenshot-telegram.sh:35
- Finding
- Telegram Bot Token Exposed in Process Command-Line Arguments## Vulnerability Details **File Location**: `scripts/screenshot-telegram.sh:35-37` **Additional Location**: `SKILL.md:59` **Vulnerability Type**: Credential exposure through process arguments **Risk Level**: Medium **Vulnerable Code**: ```bash RESPONSE=$(curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendPhoto" \ -F "chat_id=${CHAT_ID}" \ -F "photo=@${WORKSPACE}/screen.png") ``` ### Technical Analysis The script interpolates the Telegram bot token directly into the URL passed to `curl`. Consequently, the complete API URL, including the secret token, becomes part of the `curl` process command-line arguments while the request is running. Depending on local operating-system permissions and monitoring configuration, command-line arguments can be visible through process inspection utilities, endpoint monitoring agents, diagnostic tooling, shell tracing, or process accounting. A local user or process with sufficient process-observation privileges could capture and reuse the token. The same unsafe invocation is recommended in `SKILL.md`, meaning the documentation propagates the vulnerable pattern even if the bundled script is not used directly. ### Attack Path 1. An attacker obtains local process-observation capability on the host, such as access to process-listing or monitoring facilities permitted by the operating system. 2. The user invokes the Skill to capture and send a screenshot. 3. While `curl` is executing, the attacker inspects its command-line arguments. 4. The attacker extracts the bot token from the URL path following `https://api.telegram.org/bot`. 5. The attacker submits Telegram Bot API requests using the stolen token. 6. The attacker can impersonate the bot and perform operations permitted to that bot in chats where it has access. Exploitation requires local process visibility or equivalent telemetry access; this finding does not provide remote token disclosure by itself. ### ...[truncated 624 chars]
- Remediation
- ## Remediation Suggestions - Do not place the Telegram bot token in command-line arguments. Supply the sensitive URL to `curl` through a protected standard-input configuration instead: ```bash RESPONSE=$( printf 'url = "https://api.telegram.org/bot%s/sendPhoto"\n' "$BOT_TOKEN" | curl --silent --config - \ -F "chat_id=${CHAT_ID}" \ -F "photo=@${WORKSPACE}/screen.png" ) ``` - Ensure shell tracing is disabled around all credential-handling code. If tracing may be enabled by the caller, use `set +x` before reading or using the token. - Avoid logging the complete request URL or bot token in application, proxy, endpoint-monitoring, and diagnostic logs. - Restrict the OpenClaw configuration file containing `botToken` to the owning account, preferably with mode `0600`. - Replace the vulnerable example in `SKILL.md` so users do not reproduce the command-line exposure. - Rotate the Telegram bot token through BotFather if process telemetry or logs may already have captured it.
