T09 · Insecure Skill Coding Practices
- Location
SKILL.md:214- Finding
Shell Command Injection Through Unquoted Parameter Interpolation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is meant to send files to Feishu/Lark, but it handles credentials and shell execution in ways users should review carefully before installing.
Only use this with a least-privilege Feishu/Lark app, non-sensitive test files first, and a clearly confirmed recipient. Avoid putting app_secret in command lines or transcripts, do not print secrets, and replace the shown exec pattern with structured arguments and secret loading from a protected location.
SKILL.md:214Shell Command Injection Through Unquoted Parameter Interpolation
SKILL.md:158Feishu Application Secret Exposed Through Terminal Output and Command-Line Arguments
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
# 获取 tenant_access_token
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'])")
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
| python3 -c "import json,sys; print(json.load(sys.stdin)['tenant_access_token'])")
# 上传文件获取 file_key
FILE_KEY=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/files" \
-H "Authorization: Bearer $TOKEN" \
-F "file_type=stream" \
-F "file_name=report.html" \
The skill instructs users to send local files and provide app credentials to an external Feishu/Lark API, but it does not clearly warn that file contents and secrets leave the local environment. In an agent setting, this omission can cause users to disclose sensitive files or credentials without informed consent.
The skill text claims applicability to document conversion, format conversion, and content extraction even though the described implementation is only for uploading and sending files/images to Feishu/Lark. This scope mismatch can mislead an agent or user into supplying unrelated local documents for processing or transmission, increasing the chance of inappropriate data handling or execution paths.
The examples pass app_secret directly as a command-line argument, which can be exposed via shell history, process listings, audit logs, and agent telemetry. This is a common credential-handling flaw that can leak the Feishu/Lark application secret to other local users or monitoring systems.
The manual curl example includes app_secret directly in an inline request body without guidance on secret handling. While the API call itself is legitimate, documenting this pattern without warnings encourages insecure operational practices and increases the chance of credential leakage through shell history, logs, and copied transcripts.
This command sends app credentials to Feishu's external API to obtain a tenant access token. Although that is expected for the product's function, it is still a real data-exfiltration boundary because sensitive credentials leave the local environment; in an agent context, that requires explicit disclosure and consent.
# 获取 tenant_access_token
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'])")
This command transmits a message payload referencing an uploaded file to the external Feishu API. Because the skill's purpose is to send files/messages externally, this is intended behavior, but it is still security-relevant since it can disclose local work product or sensitive communications if triggered without clear user awareness.
# 发送文件消息
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\":\"file\",\"content\":\"{\\\"file_key\\\":\\\"$FILE_KEY\\\"}\"}"
The credential verification example sends app_id and app_secret to an external endpoint, which is operationally valid but still transmits sensitive data off-host. Without accompanying warnings, users may test production secrets in insecure shells or shared agent sessions.
# 验证凭证
curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d '{"app_id":"your_app_id","app_secret":"your_app_secret"}'