T09 · Insecure Skill Coding Practices
- Location
scripts/china_travel.py:24- Finding
Hard-Coded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/china_travel.py, lines 24–38
Vulnerability Type: Hard-coded credential exposure
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 is embedded directly in the distributed Python source and transmitted in the
X-Proxy-Tokenheader. Anyone with access to the Skill package can recover this credential without executing the script.This also conflicts with the configuration declared by
SKILL.md, which listsPROXY_URLandPROXY_TOKENas environment variables. The implementation does not read either value from the environment. The function documentation states that the token is injected server-side, but the client actually supplies a static token.Hard-coded credentials cannot be independently protected or rotated without changing and redistributing the package. If the proxy treats this value as an authorization credential, an attacker can reuse it outside the Skill and submit their own requests.
Attack Path
- An attacker downloads or otherwise obtains the published Skill package.
- The attacker opens
scripts/china_travel.pyand extracts the proxy URL and token. - The attacker constructs arbitrary HTTPS POST requests to the disclosed proxy ...[truncated 960 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed proxy token.
- Remove the token and endpoint configuration from source control and published artifacts.
- Read configuration from the declared environment variables, failing securely when credentials are unavailable:
python import os PROXY_URL = os.environ["PROXY_URL"] PROXY_TOKEN = os.environ["PROXY_TOKEN"] - Prefer short-lived, installation-specific credentials rather than one token shared by all users.
- Store deployment credentials in a managed secret store and inject them only at runtime.
- Restrict the token to the minimum required API operations and enforce server-side request validation.
- Add per-client rate limits, quotas, expiration, credential rotation, and abuse monitoring.
- Review proxy logs for use of the exposed token and investigate anomalous requests.
- Add automated secret scanning to the publication pipeline to prevent future embedded credentials.
