T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:9- Finding
Hard-Coded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main.py:9-19
Vulnerability Type: Hard-coded credential and credential disclosure through a configurable endpoint
Risk Level: HighVulnerable Code
python PROXY_URL = os.environ.get("PROXY_URL", "https://1439498936-cv2nww3ykf.ap-guangzhou.tencentscf.com") PROXY_TOKEN = os.environ.get("PROXY_TOKEN", "tp_8k2mX9vQ4z") TIMEOUT = 30 def _call_proxy(tool_name, params): """Call the SCF proxy using the type+params format.""" body = json.dumps({"type": tool_name, "params": params}).encode("utf-8") req = urllib.request.Request( PROXY_URL, data=body, method="POST", headers={"Content-Type": "application/json", "X-Proxy-Token": PROXY_TOKEN}, )Technical Analysis
The source code contains a default proxy authentication token. Because the project distributes this source, any party able to obtain the package can extract the token without needing runtime access to a protected secret store.
The token is transmitted in the
X-Proxy-TokenHTTP header. The destination URL is independently controlled through thePROXY_URLenvironment variable, while the embedded token remains active wheneverPROXY_TOKENis not overridden. An attacker who can influence the process environment can therefore redirect a legitimate invocation to an attacker-controlled HTTPS endpoint and capture the credential. Independently of that redirection scenario, the exposed token can be copied directly from the source and tested against the default proxy.The repository does not reveal the proxy's server-side authorization policy, so the exact permissions and validity of the token cannot be established from the audited files. Nevertheless, embedding a reusable authentication token in client-distributed code violates secret-management and least-exposure principles.
Attack Path
- Obtain or inspect the distributed Skill package.
- Read `scripts/ma ...[truncated 1347 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove the default token from source code and require
PROXY_TOKENto be supplied through a protected runtime secret store. -
Immediately rotate or revoke the exposed token because deleting it from a later revision does not remove it from existing packages or repository history.
-
Fail closed when the token is absent rather than silently using a shared fallback:
python PROXY_TOKEN = os.environ.get("PROXY_TOKEN") if not PROXY_TOKEN: raise RuntimeError("PROXY_TOKEN must be supplied through the runtime secret store") -
Do not allow an arbitrary endpoint to receive credentials. Fix the proxy origin in trusted configuration or validate
PROXY_URLagainst an explicit HTTPS hostname allowlist before attaching the authentication header. -
Scope replacement credentials to only the product-list operation and apply short expiration, rotation, per-installation identity, request quotas, and server-side rate limiting.
-
Monitor proxy logs for prior misuse of the exposed token, including unusual request volume, source addresses, parameters, and invocation times.
-
Avoid logging authentication headers and redact the token from exception telemetry, diagnostics, and support bundles.
-
