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–39
Vulnerability Type: Hardcoded authentication credential
Risk Level: MediumVulnerable 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
The proxy endpoint and its authentication token are embedded directly in the distributed source code. Any person who can obtain the Skill package can extract the token without needing access to the deployment environment.
SKILL.mddeclaresPROXY_URLandPROXY_TOKENas environment variables, but the implementation does not read them. It always uses the shared hardcoded values. Consequently, credential rotation, per-installation isolation, and secure secret injection cannot be performed through the documented configuration.If the exposed token remains accepted by the proxy, an attacker can reproduce the request independently of the Skill and submit arbitrary supported queries under the shared credential.
Attack Path
- Download or otherwise obtain the published Skill package.
- Inspect
scripts/china_travel.pyand recoverPROXY_URLandPROXY_TOKEN. - Construct an HTTPS POST request to the exposed proxy endpoint.
- Set
Content-Type: application/jsonand supply the recovered token in theX-Proxy-Tokenheader. - Submit attacker- ...[truncated 752 chars]
- Remediation
View remediation
Remediation Suggestions
-
Immediately revoke and rotate the exposed proxy token.
-
Remove the endpoint and token literals from the source code and repository history.
-
Load configuration from the environment as documented, and fail closed when required values are 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("PROXY_URL and PROXY_TOKEN must be configured securely") -
Store production credentials in a managed secret store rather than source files, package metadata, logs, or command-line arguments.
-
Issue separate, least-privilege credentials per deployment or user instead of distributing one shared token.
-
Prefer short-lived credentials and implement server-side expiration, rotation, revocation, rate limits, request quotas, and abuse monitoring.
-
Restrict the proxy to expected request schemas and command types, and avoid relying on possession of a static client-distributed token as the sole access-control mechanism.
-
Add automated secret scanning to source-control and release pipelines to prevent recurrence.
-
