T09 · Insecure Skill Coding Practices
- Location
scripts/douyin_diagnosis.py:22- Finding
Hardcoded Shared API Credential Embedded in the Skill
- Content
View full analysis
Vulnerability Details
File Location:
scripts/douyin_diagnosis.py, lines 22-33
Vulnerability Type: Hardcoded secret and plaintext credential exposure
Risk Level: HighVulnerable Code
python API_URL = "https://redfox.hk/story/api/dyUser/queryData" # Skill source identifier (required on all API calls) SOURCE = "Douyin Account Diagnosis-ClawHub" # Built-in default key (used when the user has not configured an API key) DEFAULT_API_KEY = "ak_1e449a28ae344cd1b7aa14ca481de8bb" def resolve_api_key(cli_key=None): """Resolve API key: CLI argument > REDFOX_API_KEY environment variable > built-in key.""" return cli_key or os.environ.get("REDFOX_API_KEY") or DEFAULT_API_KEYTechnical Analysis
A credential with the format of a live RedFox API key is committed directly to the source code and automatically selected whenever neither a command-line key nor
REDFOX_API_KEYis supplied. Anyone who can download, inspect, mirror, or recover this package can extract and reuse the credential independently of the Skill.The behavior also contradicts the security guidance in
README.en.md, which explicitly states that API keys must not be hardcoded or exposed in plaintext. Because the fallback happens silently, users may unknowingly issue requests under a shared credential controlled by the Skill publisher rather than under a credential they configured.HTTPS protects the credential while it is in transit, but it does not mitigate disclosure from the distributed source package. Rotation is also difficult because every installed copy contains the same secret.
Attack Path
- An attacker downloads or otherwise obtains the publicly distributed Skill package.
- The attacker reads
scripts/douyin_diagnosis.pyand extractsDEFAULT_API_KEY. - The attacker sends arbitrary authenticated requests to the RedFox endpoint using the extracted key in the
X-API-KEYheader. - Requests consume the ...[truncated 1213 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed API key through the RedFox control panel.
- Remove
DEFAULT_API_KEYand eliminate the automatic shared-credential fallback. - Require a key through a protected environment variable or a platform-managed secret store.
- Fail closed when no credential is configured, with a concise setup message.
- Do not place replacement credentials in source code, documentation, examples, generated reports, or version-control history.
- Rewrite repository history if the project has been published, while recognizing that history rewriting does not eliminate the need for revocation.
- Prefer per-user, narrowly scoped, revocable credentials with usage limits.
- Add automated secret scanning to CI and pre-commit checks.
- Align
SKILL.mdandreferences/core_workflow.mdwith the secure behavior; they currently advertise and prioritize the embedded fallback. - Consider short-lived tokens or a brokered authorization flow if the service supports them.
