Back to skill

Security audit

歇后语查询 - 即刻数据

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to perform the promised Chinese phrase lookup, but it has a review-worthy weakness that can redirect the API key and query text to another server if the launch environment is influenced.

Review this before installing if you will use a real Jike API key. Only run it in an environment you control, avoid setting JIKE_API_BASE_URL, and treat the AppKey as exposed if an untrusted process can alter the skill's environment or observe full request URLs.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/xiehouyu_query.py:24
Finding

Unvalidated API Base URL Allows Credential and Query Exfiltration

Content
View full analysis
dict[str, Any]: 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": ""} except urllib.error.URLError as exc: return {"code": 500, "message": f"网络请求失败: {exc.reason}", "data": ""} except Exception as exc: return {"code": 500, "message": f"请求异常: {exc}", "data": ""} ``` ### Technical Analysis The API base URL is read from the undocumented `JIKE_API_BASE_URL` environment variable without validating its scheme or hostname. The resulting value is used directly as the destination for an outbound request. The request places the AppKey in the URL query string alongside user-controlled query parameters. Consequently, a party capable of influencing the process environment can redirect requests to an attacker-controlled endpoint. Because HTTPS is not enforced, the override can also select a plaintext HTTP endpoint. Including credentials in a URL additionally increases exposure through HTTP server logs, reverse-proxy logs, monitoring systems, and other infrastructure that records complete request URLs. This issue requires the attacker to control or influence the environment in which the skill process starts. It does not independently provide local code execution or privilege escalation. ### Attack Path 1. The vict ...[truncated 1166 chars]
Remediation
View remediation
str: parsed = urlparse(value) if ( parsed.scheme != "https" or parsed.hostname not in ALLOWED_API_HOSTS or parsed.username is not None or parsed.password is not None or parsed.fragment ): raise ValueError("Invalid or unapproved API base URL") return value.rstrip("/") API_BASE_URL = validate_api_base_url( os.environ.get("JIKE_API_BASE_URL", DEFAULT_API_BASE_URL) ) ``` ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (5)

Tainted flow: 'url' from os.environ.get (line 149, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/xiehouyu_query.py (reported line 151)May include surrounding context.

python
"""
    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": ""}

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/xiehouyu_query.py (reported line 52)May include surrounding context.

python
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():

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill invokes a Python script, reads environment variables for API keys, and makes outbound network requests, but the manifest does not declare any explicit tool scope such as permissions or allowed-tools. This creates a least-privilege and transparency problem: a host may grant broader execution, file, or network capabilities than users or reviewers expect, increasing the risk of unintended data access or exfiltration if the script is modified or abused.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · _meta.json (reported line 8)May include surrounding context.

json
"title": "歇后语查询 - 即刻数据",
  "description": "歇后语查询。支持按关键词搜索歇后语,也支持随机返回歇后语。",
  "env": "JIKE_XIEHOUYU_QUERY_KEY",
  "api_url": "https://api.jikeapi.cn/v1/xiehouyu/query",
  "homepage": "https://www.jikeapi.cn/"
}

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

该脚本的说明、命令帮助、错误提示和结果标题均以中文固定输出,未见任何语言切换、locale 检测或用户 opt-in 机制。按规则,强制特定语言而不给用户选择,属于自然语言层面的语言/区域政策问题。

Content

No source excerpt is available for this finding.