T09 · Insecure Skill Coding Practices
- Location
scripts/china_travel.py:23- Finding
Hard-Coded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/china_travel.py, lines 23–39
Vulnerability Type: Hard-coded authentication credential
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 reusable proxy authentication token and its associated service endpoint are embedded directly in distributable source code. Any person able to access the package can recover the token without executing the skill.
The project metadata in
SKILL.mddeclaresPROXY_URLandPROXY_TOKENas environment variables, but the implementation does not read those variables. It always uses the hard-coded constants. Consequently, external secret injection does not protect or override the exposed credential.Because the token is sent in the
X-Proxy-Tokenheader, an attacker can reproduce the authenticated request independently of this client. Whether the proxy applies additional authorization, strict command validation, or rate limiting cannot be established from the reviewed client code.Attack Path
- Obtain or inspect the published skill package.
- Open
scripts/china_travel.pyand extract the proxy URL andPROXY_TOKENvalue. - Construct an HTTPS
POSTrequest to the exposed proxy URL. - Supply the recovered token in the
X-Proxy-Tokenheader a ...[truncated 919 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed proxy token.
- Remove the token and endpoint from source code and repository history.
- Load both values from the environment or a managed secret store, consistent with the declarations in
SKILL.md:python import os PROXY_URL = os.environ.get("PROXY_URL") PROXY_TOKEN = os.environ.get("PROXY_TOKEN") if not PROXY_URL or not PROXY_TOKEN: raise RuntimeError("PROXY_URL and PROXY_TOKEN must be configured securely") - Do not provide secret-bearing fallback values in source code.
- Restrict the replacement token to the minimum required API operations and apply short expiration periods where possible.
- Enforce server-side request validation, per-token rate limits, usage quotas, and abuse monitoring.
- Store production secrets in the deployment platform’s secret manager and prevent them from appearing in logs or error messages.
- Add automated secret scanning to development and release pipelines.
- Review proxy access logs for unauthorized use of the exposed token and invalidate related credentials if suspicious activity is identified.
