T09 · Insecure Skill Coding Practices
- Location
scripts/china_travel.py:24- Finding
Hardcoded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/china_travel.py, lines 24–37
Vulnerability Type: Hardcoded authentication 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 source code embeds a reusable proxy authentication token and its associated service endpoint. Because the script is distributed as part of the skill package, any party with access to the package can extract the token without executing the skill.
Although
SKILL.mddeclaresPROXY_URLandPROXY_TOKENas environment variables, the implementation does not read those variables. It instead uses hardcoded values for every request. Packaging configuration therefore provides no protection for the exposed credential.The token is transmitted over HTTPS, which protects it in transit under normal TLS assumptions, but encryption in transit does not mitigate disclosure from source code. The remote service's token scope, quotas, and authorization policy are not visible in the audited files, so broader privileges cannot be established from the available evidence.
Attack Path
- Obtain or inspect the distributed skill package.
- Open
scripts/china_travel.pyand extract the endpoint andPROXY_TOKENconstants. - Construct an HTTPS POST request to the hardcoded Tencent SCF endpoint.
...[truncated 763 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed token immediately; assume it has been compromised.
- Remove the token from source code and repository history.
- Read the endpoint and credential from protected environment variables or a secrets manager, consistent with the declarations in
SKILL.md. - Fail closed when required configuration is absent rather than falling back to embedded credentials.
- Assign a narrowly scoped credential that authorizes only the required proxy operations.
- Apply server-side rate limits, request validation, quotas, expiration, and token rotation.
- Where feasible, bind credentials to specific clients or short-lived sessions instead of distributing a shared static token.
- Review proxy logs for historical misuse of the exposed token.
- Add secret scanning to development and release pipelines to prevent credentials from being packaged again.
- Avoid including secret values in logs, exceptions, test fixtures, or generated artifacts.
