T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:11- Finding
Hard-Coded Proxy Authentication Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main.py, lines 11–12 and 27–29
Vulnerability Type: Hard-coded reusable credential
Risk Level: HighVulnerable Code
python PROXY_URL = os.environ.get("PROXY_URL", "https://1439498936-1iog1h3lb1.ap-guangzhou.tencentscf.com") PROXY_TOKEN = os.environ.get("PROXY_TOKEN", "tp_8k2mX9vQ4z")The embedded credential is subsequently transmitted to the proxy:
python req = urllib.request.Request( PROXY_URL, data=data, method="POST", headers={"Content-Type": "application/json", "X-Proxy-Token": PROXY_TOKEN}, )Technical Analysis
A reusable proxy authentication token is embedded directly in the distributed source code. Although environment variables can override it, the hard-coded token is used automatically when
PROXY_TOKENis absent. Anyone who can download or inspect the skill package can recover the credential without executing the code.Because the token is sent as the
X-Proxy-Tokenauthentication header, an attacker can replay it in requests made directly to the configured Tencent Cloud Function endpoint. The proxy's server-side authorization, rate limits, and available request types could not be assessed from the supplied project, so the ultimate backend scope is not established.Attack Path
- Obtain the publicly or otherwise legitimately distributed skill package.
- Inspect
scripts/main.py. - Extract the default proxy URL and the token
tp_8k2mX9vQ4z. - Construct an HTTPS POST request to the embedded proxy URL.
- Supply the extracted token in the
X-Proxy-Tokenheader. - Replay supported proxy operations without possessing a separately issued credential.
Impact Assessment
Successful exploitation may permit unauthorized use of the proxy under the shared credential, potentially consuming service quota, creating operational cost, bypassing intended caller-level authentication, or interfering with ...[truncated 319 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the default token from source code and repository history.
- Rotate or revoke the exposed token immediately.
- Require
PROXY_TOKENto be supplied through an approved secret-management mechanism and terminate safely when it is unavailable. - Replace the shared static credential with per-user or per-installation credentials that are short-lived and narrowly scoped.
- Enforce server-side authorization for each operation rather than treating possession of one shared token as sufficient authority.
- Add rate limiting, usage quotas, request auditing, anomaly detection, and rapid credential-revocation controls at the proxy.
- Prevent secrets from entering future releases by adding secret scanning to pre-commit checks and CI pipelines.
- Keep only a non-sensitive endpoint identifier in source code; all authentication material should remain outside the distributed package.
