T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:16- Finding
Hard-Coded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main.py, lines 16 and 28
Vulnerability Type: Hard-coded authentication credential
Risk Level: HighVulnerable Code
python PROXY_TOKEN = os.environ.get("PROXY_TOKEN", "tp_8k2mX9vQ4z")The credential is subsequently placed in an outbound authentication header:
python headers = {"Content-Type": "application/json", "X-Proxy-Token": PROXY_TOKEN}Technical Analysis
The script embeds a reusable proxy authentication token as the default value of
PROXY_TOKEN. Although the environment can override it, any execution without an explicit environment value uses the credential distributed in the source code.Source packages cannot provide confidentiality for embedded secrets. Anyone able to download or inspect the Skill can extract the token without running it. The token can then be supplied in an
X-Proxy-Tokenheader to the hard-coded Tencent Cloud Function endpoint.The exposed token should be treated as compromised. The server-side authorization scope and controls were not available during this static audit, so access beyond the proxy's accepted operations is not established.
Attack Path
- An attacker downloads or otherwise obtains the published Skill.
- The attacker inspects
scripts/main.pyand extracts the defaultPROXY_TOKEN. - The attacker identifies the proxy endpoint from the adjacent
PROXY_URLconfiguration. - The attacker constructs POST requests containing the extracted value in the
X-Proxy-Tokenheader. - If the token remains valid, the proxy accepts requests under the exposed credential, subject to its server-side authorization and rate limits.
- The attacker may automate requests until the token is rotated, revoked, rate-limited, or otherwise rejected.
Impact Assessment
Successful exploitation may permit unauthorized use of the proxy and its exposed product-query functionality. Potential consequences include:
- Consumption of service quotas ...[truncated 516 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the hard-coded fallback and require the token at runtime:
python PROXY_TOKEN = os.environ.get("PROXY_TOKEN") if not PROXY_TOKEN: raise RuntimeError("PROXY_TOKEN is required")- Immediately rotate or revoke the exposed token; deleting it from a future release does not invalidate copies already published.
- Provision the replacement credential through a protected runtime secret manager rather than source code, metadata, documentation, command-line arguments, or repository files.
- Prefer short-lived, narrowly scoped credentials. Authorize only the specific product-query operation required by this Skill.
- Enforce server-side rate limits, quotas, request validation, and abuse monitoring per credential.
- Avoid distributing a single shared static credential to all Skill installations. Where practical, issue per-installation or per-user credentials to support revocation and attribution.
- Review proxy logs for unexpected use of the exposed token and alert on unusual request volume, source locations, parameters, or operation names.
- Add automated secret scanning to source-control and release pipelines to prevent credentials from being packaged again.
