T09 · Insecure Skill Coding Practices
- Location
scripts/feishu_image.py:9- Finding
Hard-Coded Feishu Application Credentials in Python Client
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill does what it says by sending images to Feishu, but it ships reusable Feishu app credentials in plaintext and can send local files externally under that shared identity.
Do not install this version unless you trust the publisher's Feishu app identity and accept that local image paths you provide will be uploaded to Feishu. The publisher should revoke and rotate the exposed secret, remove bundled credentials, require user-supplied secure configuration, validate image inputs, and add clear confirmation before sending files.
scripts/feishu_image.py:9Hard-Coded Feishu Application Credentials in Python Client
scripts/send.sh:4Hard-Coded Feishu Application Credentials in Shell Launcher
This duplicate mismatch finding identifies the same core issue: the skill understates its actual behavior by omitting embedded Feishu credentials and direct messaging to a specific open_id/user. Such discrepancies are dangerous because they prevent informed review and can conceal credential abuse or unapproved outbound communications.
This duplicate mismatch finding identifies the same core issue: the skill understates its actual behavior by omitting embedded Feishu credentials and direct messaging to a specific open_id/user. Such discrepancies are dangerous because they prevent informed review and can conceal credential abuse or unapproved outbound communications.
The script hardcodes a Feishu app ID and app secret directly in source code, which exposes reusable credentials to anyone with code access and enables unauthorized token minting against the Feishu tenant. In a skill whose purpose is image sending, embedding live credentials is unnecessary and materially increases the chance of account abuse, impersonation, and unauthorized API access.
The code uses embedded application credentials to request a tenant access token without any disclosure or user consent, allowing the skill to authenticate to Feishu automatically with developer-controlled secrets. This creates a covert trust boundary crossing: anyone running the skill may unknowingly operate under a third-party tenant context, enabling unauthorized messaging or other API actions tied to that app.
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
fi
# 获取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).get('tenant_access_token',''))")
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
fi
# 上传图片
IMAGE_KEY=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/images" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: multipart/form-data" \
-F "image_type=message" \
The skill declares no explicit tool scope or permissions even though its documented behavior requires both shell execution and outbound network access. This weakens user and platform awareness of what the skill can do, making it easier for the skill to perform external actions without clear consent boundaries.
The skill documentation does not clearly warn users that local image files and recipient identifiers are transmitted to Feishu's external services. This creates a data handling and privacy risk because users may unknowingly send sensitive images or personal identifiers outside the local environment.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"""获取tenant_access_token"""
url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"
data = {"app_id": self.app_id, "app_secret": self.app_secret}
resp = requests.post(url, json=data)
result = resp.json()
return result.get("tenant_access_token")
The function reads a local file path and uploads the file contents to Feishu without an explicit warning that local data will be transmitted to an external service. Although uploading an image is aligned with the skill's stated purpose, the lack of disclosure and confirmation increases the risk of accidental exfiltration of sensitive local files if the path is misused or misunderstood.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"content": json.dumps({"image_key": image_key})
}
resp = requests.post(url, headers=headers, json=data)
return resp.json()
This request transmits a hardcoded Feishu app ID and app secret to obtain an access token. Embedding production credentials in a distributed script is a direct secret-exposure vulnerability: anyone with access to the skill can recover and abuse the secret to impersonate the application and send or access data via the Feishu API.
fi
# 获取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).get('tenant_access_token',''))")
The script silently sends both embedded credentials and user-supplied image content to Feishu without any disclosure, confirmation, or consent mechanism. In an agent-skill context this is risky because users may not realize local files are being exfiltrated to a third-party service, and the hardcoded app secret further increases the sensitivity of what is being transmitted.
This request sends a message containing an uploaded image to an external Feishu recipient, which is the intended behavior of the skill but still constitutes data exfiltration of user-provided content. In this context the danger is elevated because the skill accepts arbitrary local file paths and transmits the resulting content off-host without validation, policy checks, or recipient restrictions.
fi
# 发送图片消息
RESULT=$(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 "{
No suspicious patterns detected.