T09 · Insecure Skill Coding Practices
- Location
scripts/china_travel.py:23- Finding
Hardcoded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/china_travel.py, lines 23–24 and 31–39
Vulnerability Type: Hardcoded authentication secret
Risk Level: HighVulnerable Code
python PROXY_URL = "https://1439498936-eu423jdjnd.ap-guangzhou.tencentscf.com" PROXY_TOKEN = "tp_8k2mX9vQ4z" def query_tripgenie(query, locale="en", command_type="hotel"): """Query via SCF proxy (token injected server-side, affiliate links auto-injected).""" payload = {"query": query, "locale": locale, "command_type": command_type} data = json.dumps(payload).encode("utf-8") req = urllib.request.Request( PROXY_URL, data=data, headers={ "Content-Type": "application/json", "X-Proxy-Token": PROXY_TOKEN, "User-Agent": "ChinaTravel/2.0", }, method="POST" )Technical Analysis
A proxy authentication token is embedded directly in distributed source code and sent in the
X-Proxy-Tokenrequest header. Anyone who can obtain the skill package can recover this credential without executing the program.The issue is compounded by an implementation mismatch:
SKILL.mddeclaresPROXY_URLandPROXY_TOKENas environment variables, but the script does not read those variables and always uses the hardcoded values. Consequently, secret rotation through deployment configuration is ineffective unless the source itself is changed.The token's precise server-side permissions cannot be established from the repository. Nevertheless, it appears sufficient to authenticate requests to the fixed Tencent SCF proxy, making unauthorized replay feasible.
Attack Path
- Obtain or download the published skill package.
- Inspect
scripts/china_travel.py. - Extract the hardcoded proxy URL and
PROXY_TOKEN. - Construct HTTPS
POSTrequests to the proxy using the recovered value in theX-Proxy-Tokenheader. - Submit arbitrary suppo ...[truncated 740 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed proxy token.
- Remove the token from source code and repository history.
- Load the endpoint and credential from deployment-managed environment variables or a secret manager:
python import os PROXY_URL = os.environ["PROXY_URL"] PROXY_TOKEN = os.environ["PROXY_TOKEN"] - Fail safely at startup when required configuration is absent; do not add an embedded fallback secret.
- Use short-lived, narrowly scoped credentials rather than one static token shared by every installation.
- Enforce server-side authorization by permitted operation, along with rate limits, quotas, replay protections, monitoring, and rapid revocation.
- Avoid distributing reusable upstream credentials to client-side skill packages. Where feasible, authenticate individual installations or users through a controlled credential-exchange mechanism.
- Add automated secret scanning to version control and release pipelines to prevent recurrence.
