T09 · Insecure Skill Coding Practices
- Location
scripts/china_travel.py:22- Finding
Hardcoded Proxy Authentication Token in Source Code
- Content
View full analysis
Vulnerability Details
File Location:
scripts/china_travel.py, lines 22-36
Vulnerability Type: Hardcoded authentication credential
Risk Level: Mediumpython 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 authentication token is embedded directly in distributable source code. Any party able to download or inspect the Skill can recover and reuse this credential independently of the intended script.
This implementation also conflicts with
SKILL.md, which declaresPROXY_TOKENandPROXY_URLas environment-provided configuration. Embedding a shared credential prevents secure per-deployment configuration and requires a source release to rotate it. HTTPS protects the token in transit but does not protect it from source-code disclosure.Attack Path
- An attacker downloads or otherwise obtains the published Skill package.
- The attacker reads
scripts/china_travel.pyand extracts the proxy URL andX-Proxy-Tokenvalue. - The attacker constructs direct HTTPS POST requests to the proxy using the recovered header.
- If the server accepts the shared token without further authorization controls, the attacker submits unauthorized queries outside the Skill.
- The attacker can continue using the credential until it is revoked or rotated.
Impact Assessment
...[truncated 535 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed token.
- Remove
PROXY_TOKENfrom source code and retrieve it from the environment, a platform secret store, or another protected runtime credential provider. - Fail closed when the required secret is absent rather than falling back to a bundled credential.
- Configure separate, narrowly scoped credentials for different deployments or users where practical.
- Apply server-side rate limiting, usage quotas, request validation, and monitoring because client-side secrecy cannot be guaranteed for distributed Skills.
- Restrict the token to only the required proxy operation and upstream API capabilities.
- Review source history and previously published package versions for the exposed value.
- Add secret scanning to the publication workflow.
A safer configuration pattern is:
python import os PROXY_URL = os.environ["PROXY_URL"] PROXY_TOKEN = os.environ["PROXY_TOKEN"]
