T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/feishu_image.py:9
- Finding
- Hard-Coded Feishu Application Credentials in Python Client<![CDATA[ ## Vulnerability Details **File Location**: `scripts/feishu_image.py`, lines 9-11 **Vulnerability Type**: Hard-coded application secret **Risk Level**: High ### Vulnerable Code ```python def __init__(self, app_id=None, app_secret=None): self.app_id = app_id or "cli_a92d303bf7f9dcc8" self.app_secret = app_secret or "uvP39NArvXPjzPG2bvdZZs2SfZ231YFk" ``` ### Technical Analysis The Python client embeds a live-looking Feishu application ID and application secret directly in source code. Every person or system with access to the Skill package can recover these credentials without executing the script. The credentials are submitted to Feishu's internal tenant-token endpoint by `get_token()`. If they remain valid, an attacker can use them outside this Skill to request a tenant access token. Hard-coding the secret also prevents safe per-user configuration and makes credential rotation difficult. The network transmission itself is necessary for the declared Feishu image-sending functionality and uses an HTTPS Feishu endpoint. The security flaw is distributing a reusable secret in plaintext, not the documented API communication. ### Attack Path 1. An attacker downloads or otherwise reads the Skill package. 2. The attacker extracts the application ID and secret from `scripts/feishu_image.py`. 3. The attacker submits those credentials to Feishu's tenant access-token endpoint. 4. If the credentials remain active, Feishu returns a tenant access token. 5. The attacker invokes Feishu APIs authorized for that application, independently of the Skill and its intended interface. No local privilege escalation is required; read access to the distributed source is sufficient. ### Impact Assessment A successful attacker may obtain the Feishu application privileges associated with the exposed credentials. Based on the declared configuration, this may include uploading image resources and sending messages through the application. The precise reach depends o ...[truncated 452 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed Feishu application secret immediately; removal from the current files alone does not invalidate a copied credential. 2. Remove the application ID and secret from source code, release artifacts, examples, and version-control history. 3. Require credentials through environment variables or an approved secret manager, and terminate with a clear error when they are absent. 4. Do not provide a shared fallback secret. Use separate application credentials for development, testing, and production. 5. Restrict the Feishu application to the minimum API scopes and tenant access required to upload and send images. 6. Review Feishu token issuance, message, and image-upload logs for activity involving the exposed application. 7. Add automated secret scanning to development and release workflows to prevent recurrence. 8. Avoid logging credentials, authorization headers, or tenant access tokens, and ensure runtime secrets are available only to the process that needs them. ]]>
