T09 · Insecure Skill Coding Practices
- Location
generator.py:128- Finding
Hard-Coded Feishu Application Credentials
- Content
View full analysis
Vulnerability Details
File Location:
generator.py:128-133
Vulnerability Type: Hard-coded application secret
Risk Level: Highpython app_id = "cli_a92550a0def91bb4" app_secret = "gKxq8vGTcr13awNezls7Uh6kqhv4AEwB" # Obtain token token_url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" token_resp = requests.post(token_url, json={"app_id": app_id, "app_secret": app_secret})Technical Analysis
A plaintext Feishu application identifier and secret are embedded directly in distributable source code. Anyone who can read the Skill package, source repository, deployment artifact, backup, or execution environment can recover and reuse these credentials independently of the intended application.
The credential is transmitted to Feishu's official token endpoint, which is necessary for the documented authentication flow and is not evidence of transmission to an unknown party. The vulnerability is the static inclusion and uncontrolled distribution of a reusable secret, rather than the destination of the request.
The permissions available to an attacker would be bounded by the scopes and tenant access granted to this Feishu application. The surrounding code demonstrates that a resulting tenant token is used to upload files and send messages.
Attack Path
- An attacker obtains read access to the Skill package, source repository, deployment bundle, or a copy of
generator.py. - The attacker extracts the hard-coded
app_idandapp_secret. - The attacker submits those credentials to Feishu's tenant-token endpoint.
- If the credentials remain valid, Feishu returns a tenant access token.
- The attacker invokes any Feishu APIs authorized for the application, potentially including file upload and message delivery.
- The attacker repeats token issuance until the secret is revoked or rotated.
Impact Assessment
Successful exploitation could allow unauthorized u ...[truncated 575 chars]
- An attacker obtains read access to the Skill package, source repository, deployment bundle, or a copy of
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed Feishu application secret immediately; merely deleting it from the current source does not invalidate copies in prior artifacts or history.
- Store credentials in an approved secret manager or protected environment variables, and retrieve them only when Feishu delivery is explicitly requested.
- Fail closed when credentials are absent rather than falling back to embedded defaults.
- Restrict the Feishu application's scopes to the minimum permissions required for file upload and message delivery.
- Apply recipient restrictions, audit logging, rate limits, and credential-use monitoring.
- Ensure secrets are excluded from source control, packages, logs, exception messages, and generated reports.
- Add automated secret scanning to development and release pipelines.
- Handle HTTP errors safely by adding request timeouts, status validation, and sanitized error reporting.
