T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_merged_msg.sh:8- Finding
Feishu Credentials and Access Tokens Exposed Through Standard Output and Process Arguments
- Content
View full analysis
/scripts/fetch_merged_msg.sh ``` ```bash python3 -c "import json; d=json.load(open('/root/.openclaw/openclaw.json')); c=d['channels']['feishu']; print(c.get('appId',''), c.get('appSecret',''))" ``` `scripts/fetch_merged_msg.sh:8-19`: ```bash MSG_ID="${1:?Usage: fetch_merged_msg.sh }" APP_ID="${2:?Missing app_id}" APP_SECRET="${3:?Missing app_secret}" # 1. Get tenant access token TOKEN=$(curl -sf -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \ -H "Content-Type: application/json" \ -d "{\"app_id\":\"${APP_ID}\",\"app_secret\":\"${APP_SECRET}\"}" \ | python3 -c "import json,sys; print(json.load(sys.stdin)['tenant_access_token'])") # 2. Fetch message and its sub-messages curl -sf "https://open.feishu.cn/open-apis/im/v1/messages/${MSG_ID}" \ -H "Authorization: Bearer ${TOKEN}" ``` ### Technical Analysis The Skill legitimately needs Feishu credentials to obtain a tenant access token and retrieve merged messages from the official Feishu API. However, its handling of those credentials exceeds the minimum exposure necessary for that operation. The documentation recommends printing the `appSecret` from the root-owned OpenClaw configuration to standard output. It then directs the caller to pass that secret as a positional command-line argument. The script subsequently embeds the secret in curl's `-d` argument. As a result, sensitive data can be exposed through: - Terminal output or captured agent output. - Shell history when a literal invocation is entered interactively. - Process inspection while the script or curl process is running, subject to operating-syst ...[truncated 2410 chars]- Remediation
View remediation
