T09 · Insecure Skill Coding Practices
- Location
SKILL.md:10- Finding
Feishu Credentials Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 10–16 and 19–28
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumComplete Code Snippet:
sh APP_SECRET=$(python3 -c "import json; c=json.load(open('/root/.openclaw/openclaw.json')); print(c['channels']['feishu']['appSecret'])") APP_ID=$(python3 -c "import json; c=json.load(open('/root/.openclaw/openclaw.json')); print(c['channels']['feishu']['appId'])") TOKEN=$(curl -s -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'])") IMAGE_KEY=$(curl -s -X POST 'https://open.feishu.cn/open-apis/im/v1/images' \ -H "Authorization: Bearer $TOKEN" \ -F "image_type=message" \ -F "image=@/path/to/image.png" \ | python3 -c "import json,sys; print(json.load(sys.stdin)['data']['image_key'])") curl -s -X POST 'https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id' \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"receive_id":"收信人open_id","msg_type":"image","content":"{\"image_key\":\"'$IMAGE_KEY'\"}"}'Technical Analysis
The documented commands read a Feishu application secret from
/root/.openclaw/openclaw.json, expand it into curl's-dcommand-line argument, and subsequently expand the tenant bearer token into curl's-Hargument. Although these credentials are legitimately needed to authenticate to Feishu, placing them in process arguments is unnecessary and unsafe.Depending on operating-system configuration and local permissions, command-line arguments may be observable through process-listing utilities,
/proc, system auditing, monitoring agents, diagnostic tooling, or command telemetry. This can expose both the long-lived application se ...[truncated 2643 chars]- Remediation
View remediation
Remediation Suggestions
- Replace shell commands that interpolate secrets into argv with a small, reviewed client using an HTTP library. Construct the JSON request body and authorization headers in process memory.
- If curl must be retained, pass the authentication body through standard input rather than
-dwith expanded secrets. Use a securely permissioned temporary header/config file or another mechanism that does not expose the bearer token in argv, and delete temporary material immediately. - Run the Skill under a dedicated, unprivileged account rather than relying on
/root/.openclaw/openclaw.json. - Store only the required Feishu credentials in a dedicated secret store or configuration file readable exclusively by the service account.
- Restrict the Feishu application's scopes to image/file upload and message sending only where possible.
- Validate and explicitly approve the local file path and intended recipient before transmission to prevent accidental disclosure.
- Avoid verbose command tracing and ensure logs, monitoring systems, and shell history do not record credentials or authorization headers.
- Rotate the Feishu application secret immediately if it may already have appeared in process telemetry or logs, and revoke active tokens where supported.
