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:23-36
Vulnerability Type: Hardcoded reusable 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", },Technical Analysis
The proxy URL and reusable authentication token are embedded directly in the distributed source code. Anyone with access to the skill package can recover the token without executing the program.
The project metadata declares
PROXY_URLandPROXY_TOKENas environment variables inSKILL.md:6-8, but the implementation does not read those variables. It always uses the hardcoded values. Consequently, deployment-level secret management cannot protect or replace the embedded credential without modifying the source.If the proxy accepts this token as sufficient authorization, an attacker can reproduce the authenticated request outside the skill. The exposed endpoint accepts user-controlled
query,locale, andcommand_typefields, increasing the potential for unauthorized use of the proxy and its upstream service.Attack Path
- Obtain or inspect the published skill package.
- Open
scripts/china_travel.py. - Extract the hardcoded proxy endpoint and
X-Proxy-Tokenvalue. - Construct an HTTP POST request containing arbitrary supported JSON fields.
- Send the token in the
X-Proxy-Tokenheader. - Reuse the proxy under the publi ...[truncated 583 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed proxy token.
- Remove all credentials from source code and repository history.
- Read configuration from environment variables and fail securely when it is absent:
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("Required proxy configuration is missing")- Prefer short-lived, scoped credentials rather than a shared static token.
- Restrict the token to only the required API methods and command types.
- Implement server-side schema validation, request quotas, rate limiting, monitoring, and abuse alerts.
- Bind authorization to an authenticated user or installation where feasible.
- Add secret scanning to the release and continuous-integration pipelines.
- Verify that packaged artifacts do not contain fallback or development credentials.
