T09 · Insecure Skill Coding Practices
- Location
scripts/word_query.py:25- Finding
Configurable API endpoint permits AppKey exfiltration
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a Chinese dictionary API helper, but it has an under-disclosed endpoint override that can send the API key and user queries to a non-Jike server if the environment is altered.
Review before installing. Use it only with a dedicated low-privilege Jike AppKey, avoid passing the key on the command line, and do not set JIKE_API_BASE_URL unless you fully trust and intend that endpoint. Prefer running it in an environment where outbound access is limited to the official Jike API host.
scripts/word_query.py:25Configurable API endpoint permits AppKey exfiltration
scripts/word_query.py:244AppKey is exposed through command-line arguments and request URLs
The request target is derived from the JIKE_API_BASE_URL environment variable and then fetched with urlopen without any allowlist or validation. In an agent/runtime context, a user or integrator who can influence environment variables could redirect requests to an arbitrary host, causing SSRF-like outbound requests and leaking the AppKey in the query string to an attacker-controlled endpoint.
"""
url = f"{API_BASE_URL}{API_PATH_MAP[command]}?{urllib.parse.urlencode({**params, 'appkey': appkey})}"
try:
with urllib.request.urlopen(url, timeout=15) as response:
return json.loads(response.read().decode("utf-8"))
except urllib.error.HTTPError as exc:
return {"code": exc.code, "message": f"接口请求失败: HTTP {exc.code}", "data": ""}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
env_value = os.environ.get(env_name, "").strip()
if env_value:
return env_value
env_file = Path(__file__).parent / ".env"
if not env_file.exists():
return ""
for line in env_file.read_text(encoding="utf-8").splitlines():
The skill declares executable requirements and clearly relies on environment variables and network access, but it does not declare an explicit tool scope such as permissions or allowed-tools. That creates a policy gap where an agent may invoke code, read environment secrets, and make outbound requests without a tightly constrained contract, increasing the risk of overbroad execution or secret exposure.
The description contains broad natural-language trigger examples like generic requests for meanings, synonyms, and antonyms without clear invocation boundaries. In agent environments, this can cause over-eager routing or accidental activation in loosely related conversations, which may lead to unnecessary external API calls and exposure of user queries to a third-party service.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"title": "汉语词语查询 - 即刻数据",
"description": "支持搜索词语、词语详情、随机词语、近义词查询和反义词查询,返回拼音、解释、出处、用法、近义词和反义词。",
"env": "JIKE_WORD_QUERY_KEY",
"api_url": "https://api.jikeapi.cn/v1/word/query",
"homepage": "https://www.jikeapi.cn/"
}
The module docstring and all user-facing descriptions specify and assume Chinese-only interaction, and the script’s CLI help and output strings are also written in Chinese. This creates a language/locale constraint without any user-selectable language option or explicit opt-in, which matches the policy-violation category for forced language.