T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:15- Finding
Hard-Coded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main.py, lines 15 and 29–31
Vulnerability Type: Hard-coded authentication secret
Risk Level: HighVulnerable Code
python PROXY_TOKEN = os.environ.get("PROXY_TOKEN", "tp_8k2mX9vQ4z")The embedded token is subsequently attached to requests:
python payload = json.dumps({"tool": tool_name, "params": params}).encode("utf-8") headers = {"Content-Type": "application/json", "X-Proxy-Token": PROXY_TOKEN} req = urllib.request.Request(PROXY_URL, data=payload, headers=headers, method="POST")Technical Analysis
The source code contains a reusable proxy authentication token as the default value of
PROXY_TOKEN. If the environment variable is absent, the application automatically authenticates to the configured Tencent Cloud Function endpoint using this embedded credential.Because the token is distributed with the skill package, anyone able to read the package can extract it. Supporting an environment-variable override does not protect the exposed fallback credential. HTTPS protects the token while it is in transit but does not mitigate disclosure from source code.
An attacker can reproduce the request format shown in
_scf_call, attach the disclosed value as theX-Proxy-Tokenheader, and submit requests directly to the configured proxy. The exact server-side authorization boundaries are not available in the audited project, so access beyond the proxy functionality represented by this token cannot be confirmed.Attack Path
- Obtain or inspect the distributed skill package.
- Open
scripts/main.pyand extract the fallbackPROXY_TOKEN. - Identify the default proxy endpoint from
PROXY_URL. - Construct an HTTPS POST request containing a JSON body in the expected form:
json { "tool": "get_trending_items", "params": {} } - Set
Content-Type: application/jsonand supply the disclosed credential through theX-Proxy-Tokenheader. - Send requ ...[truncated 885 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") - Rotate and revoke the disclosed token immediately because it must be treated as compromised.
- Provision credentials through a managed secret store or protected runtime environment rather than source control or distributed artifacts.
- Issue distinct, scoped credentials per deployment or installation instead of sharing one global token.
- Restrict each credential to the minimum required operation and backend resources.
- Implement server-side expiration, rotation, revocation, request-rate limits, and usage quotas.
- Validate allowed tool names and parameter constraints on the proxy; do not rely solely on client-side restrictions.
- Monitor proxy logs for anomalous sources, excessive request rates, and use of the exposed credential.
- Add automated secret scanning to development and release pipelines to prevent credentials from entering future packages.
- Remove the hard-coded fallback and require the token at runtime:
