T09 · Insecure Skill Coding Practices
- Location
scripts/send_feishu_voice.sh:3- Finding
Feishu Tenant Access Token Exposed Through Command-Line Arguments
- Content
View full analysis
[receive_id_type] # receive_id_type: open_id (default), chat_id, user_id, union_id, email set -e OGG_FILE="$1" RECEIVE_ID="$2" TOKEN="$3" ``` The corresponding invocation documented in `SKILL.md:49` is: ```bash scripts/send_feishu_voice.sh /tmp/voice.ogg [receive_id_type] ``` ### Technical Analysis The Feishu tenant access token is supplied as the third command-line argument and copied into the `TOKEN` shell variable. Depending on the operating system and runtime environment, command-line arguments may be exposed through process inspection facilities, diagnostic tools, audit systems, shell command history, CI/CD logs, or orchestration telemetry. Although access to another process's arguments may be restricted by operating-system policy, placing credentials in `argv` unnecessarily expands their exposure. The script only needs the credential in memory when constructing the Feishu authorization header; accepting it through a protected environment variable, file descriptor, or secret manager would reduce exposure. The script subsequently uses the credential as a bearer token: ```bash -H "Authorization: Bearer $TOKEN" ``` Possession of this token permits calls to Feishu APIs within the permissions granted to the associated application. ### Attack Path 1. A user invokes the documented command and supplies a valid tenant access token as the third argument. 2. While the process is active, a local user or monitoring component with sufficient visibility inspects the process command line. Alternatively, the command is retained in shell history, CI logs, or execution telemetry. 3. The observer extracts the tenant access token. 4. Th ...[truncated 619 chars]- Remediation
View remediation
&2 exit 1 fi ``` - Update `SKILL.md` so examples do not place secrets directly in command lines. - Prevent commands containing secrets from being written to shell history or CI/CD logs. - Ensure secret values are redacted from diagnostic output. - Grant the Feishu application only the API scopes needed to upload and send audio messages. - Rotate or revoke any token suspected of having been logged or exposed. ]]>
