T09 · Insecure Skill Coding Practices
- Location
scripts/trip_com.py:20- Finding
Hardcoded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/trip_com.py, lines 20-36
Vulnerability Type: Hardcoded credential exposure
Risk Level: MediumVulnerable Code
python PROXY_URL = "https://1439498936-eu423jdjnd.ap-guangzhou.tencentscf.com" PROXY_TOKEN = "tp_8k2mX9vQ4z" def query_tripgenie(query: str, command_type: str = "query") -> dict: """Query TripGenie API through SCF proxy.""" payload = {"query": query, "locale": "zh", "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": "TripCom-CN/1.0", }, method="POST", )Technical Analysis
The proxy authentication token is embedded directly in the distributed source code. Anyone with access to the Skill package can extract and reuse it. Although
SKILL.mddeclaresPROXY_URLandPROXY_TOKENas environment variables, the implementation does not read those variables and instead always uses the hardcoded values.Hardcoded credentials cannot be independently protected, rotated per deployment, or reliably restricted to an authorized runtime. If the remote proxy treats this token as sufficient authentication, possession of the package grants the same proxy access as the Skill.
Attack Path
- An attacker obtains or downloads the Skill package.
- The attacker reads
scripts/trip_com.pyand extracts the proxy URL and token. - The attacker constructs requests containing the exposed value in the
X-Proxy-Tokenheader. - The attacker submits requests directly to the proxy outside the intended Skill workflow.
- The proxy processes the requests under the identity, quota, or billing context associated with the exposed token.
Impact Assessment
Exploitation may per ...[truncated 365 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed token immediately because it must be treated as compromised.
- Remove the token and endpoint configuration from source code.
- Load both values from the declared environment variables and fail closed when they are missing:
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") - Supply the token through a managed secret store rather than repository files, command-line arguments, or logs.
- Apply server-side rate limits, expiration, narrow API scopes, and per-deployment credentials.
- Monitor historical proxy traffic for evidence that the exposed token has already been reused.
- Avoid returning authentication details in proxy errors and ensure request headers are redacted from logs.
