T09 · Insecure Skill Coding Practices
- Location
scripts/china_travel.py:22- Finding
Hardcoded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/china_travel.py, lines 22–38
Vulnerability Type: Hardcoded reusable 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 source code embeds a reusable proxy authentication token and sends it in the
X-Proxy-Tokenrequest header. Any party that can download or inspect the skill package can extract this credential without executing the skill.This also conflicts with
SKILL.md, which declaresPROXY_URLandPROXY_TOKENas environment-based configuration. The implementation never reads those environment variables and instead always uses the embedded values. Consequently, secret distribution, per-installation configuration, revocation, and rotation cannot be managed securely through the declared configuration mechanism.The hardcoded URL is not independently a secret, but it gives an attacker the exact endpoint against which the exposed token can be tested and reused.
Attack Path
- Obtain a copy of the published skill package.
- Inspect
scripts/china_travel.py. - Extract the fixed proxy endpoint and the value assigned to
PROXY_TOKEN. - Construct HTTP POST requests to the endpoint using the exposed value in the
X-Proxy-Tokenheader. - Sub ...[truncated 927 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed token, treating it as compromised.
- Remove the token from source code and repository history.
- Load the endpoint and credential from the declared environment variables or a managed secret store:
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") - Avoid distributing a shared long-lived credential to clients. Prefer short-lived, per-installation, or per-user tokens with narrowly scoped permissions.
- Enforce server-side authentication, authorization, rate limits, request-size limits, quotas, abuse monitoring, and rapid revocation.
- Redact credentials from logs and error reports, and prevent them from being included in future package artifacts.
- Add automated secret scanning to source-control and release pipelines.
- Document what user query data is transmitted to the proxy and ensure the remote service applies appropriate retention, logging, and privacy controls.
