T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/tts-xiaoye.sh:173
- Finding
- Telegram Bot Token Exposed Through Process Command-Line Arguments## Vulnerability Details **File Location**: `scripts/tts-xiaoye.sh`, lines 173-181 **Vulnerability Type**: Credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code ```bash if [[ -n "$CAPTION" ]]; then RESPONSE=$(curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendVoice" \ -F "chat_id=${TARGET}" \ -F "voice=@${AUDIO_FILE}" \ -F "caption=${CAPTION}") else RESPONSE=$(curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendVoice" \ -F "chat_id=${TARGET}" \ -F "voice=@${AUDIO_FILE}") fi ``` ### Technical Analysis The Telegram bot token is interpolated directly into the URL passed as a command-line argument to `curl`. While the process is running, the complete URL can be exposed through process-inspection mechanisms such as `ps`, process-monitoring utilities, or `/proc/<pid>/cmdline` on systems where another local account or process has sufficient inspection rights. HTTPS protects the token in transit but does not prevent local disclosure from the command line. The network transmission itself is necessary for the declared Telegram delivery feature; placing the credential in an observable process argument is not necessary. ### Attack Path 1. A user invokes the Skill in its default Telegram delivery mode. 2. The wrapper starts `curl` with the Telegram bot token embedded in its URL. 3. A local attacker or compromised monitoring process repeatedly inspects process command lines while the request is active. 4. The attacker extracts the token from the `/bot<token>/sendVoice` URL. 5. The attacker uses the token to invoke Telegram Bot API methods as the affected bot. Exploitation requires local process-observation access and successful timing while `curl` is running. ### Impact Assessment Disclosure grants the attacker the API authority associated with the Telegram bot token. Depending on the bot's configuration and Telegram per ...[truncated 267 chars]
- Remediation
- ## Remediation Suggestions - Do not include secrets in process command-line arguments. - Use an HTTP client implementation that constructs the Telegram URL internally after startup, such as the existing Python `requests` dependency. - If `curl` must be retained, supply sensitive configuration through a protected standard-input configuration rather than an argument, while ensuring error output cannot disclose the URL. - Restrict the `.env` file to the owning account, for example with mode `0600`. - Run the Skill under a dedicated, least-privileged account and restrict cross-process inspection where the operating system supports it. - Rotate the Telegram bot token if command-line exposure may already have occurred.
