Back to skill

Security audit

星座配对 - 即刻数据

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward zodiac-pairing API wrapper, with a real but limited credential-handling caution around configurable endpoints and URL query parameters.

Install only if you are comfortable sending zodiac query inputs and your Jike AppKey to Jike API. Avoid setting JIKE_API_BASE_URL unless you trust the endpoint, and prefer a scoped/low-risk AppKey because the key is sent as a URL query parameter.

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/zodiac_pairing_query.py:22
Finding

Configurable API Endpoint Can Disclose the AppKey and Query Data

Content
View full analysis

Vulnerability Details

File Location: scripts/zodiac_pairing_query.py, lines 22 and 137–139
Vulnerability Type: Unvalidated API endpoint override and credential exposure
Risk Level: Medium

Vulnerable Code:

python
API_BASE_URL = os.environ.get("JIKE_API_BASE_URL", "https://api.jikeapi.cn").rstrip("/")
python
url = f"{API_BASE_URL}{API_PATH}?{urllib.parse.urlencode({**params, 'appkey': appkey})}"
try:
    with urllib.request.urlopen(url, timeout=15) as response:

Technical Analysis

The API base URL is taken from the undocumented JIKE_API_BASE_URL environment variable without validating its scheme or hostname. The script subsequently includes the AppKey in the query string and sends the resulting request to the configured origin.

An attacker who can influence the process environment can replace the expected https://api.jikeapi.cn origin with an attacker-controlled endpoint. When the skill is invoked, the request discloses the AppKey and zodiac query parameters to that endpoint.

Placing the AppKey in the URL also increases its exposure because complete URLs may be retained by HTTP servers, reverse proxies, monitoring systems, or diagnostic logs.

The environment-modification prerequisite limits exploitability: this flaw does not independently grant an attacker local execution or permission to change environment variables.

Attack Path

  1. The attacker gains the ability to influence the environment used to launch the skill, such as through an unsafe wrapper, deployment configuration, or inherited process environment.
  2. The attacker sets JIKE_API_BASE_URL to an endpoint under their control.
  3. A user or AI agent invokes the documented zodiac-pairing script with legitimate query parameters.
  4. The script reads a valid AppKey from the CLI, environment, or scripts/.env.
  5. The script constructs a URL containing the AppKey and query parameters.
  6. `urllib.request.urlop ...[truncated 822 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the runtime endpoint override and use a fixed trusted endpoint:

    python
    API_BASE_URL = "https://api.jikeapi.cn"
    
  2. If endpoint configurability is required for testing, parse the URL and enforce an explicit allowlist:

    • Require the https scheme.
    • Require the exact approved hostname.
    • Reject embedded credentials, unexpected ports, fragments, and unapproved subdomains.
    • Keep testing overrides unavailable in production builds.
  3. Prefer transmitting the AppKey in an authorization header rather than in the query string if the service supports it. This reduces exposure through URL logging and monitoring infrastructure.

  4. Ensure application logs, exceptions, proxy logs, and telemetry redact credentials and sensitive query parameters.

  5. Isolate the skill's execution environment so untrusted users or workloads cannot set or override security-sensitive environment variables.

  6. Rotate the AppKey if the script may previously have run with an untrusted JIKE_API_BASE_URL, and review API usage records for unauthorized activity.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (7)

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

Critical
Category
Data Flow
Confidence
91% confidence
Finding

The request target is derived from JIKE_API_BASE_URL, an environment variable, and then used in urllib.request.urlopen(). In agent or hosted execution environments, untrusted or misconfigured environment variables can redirect requests to attacker-controlled endpoints, causing SSRF-like behavior, exfiltration of query contents including the appkey in the URL, or use of insecure transports if HTTP is supplied.

Content

Scanner excerpt · scripts/zodiac_pairing_query.py (reported line 141)May include surrounding context.

python
"""
    url = f"{API_BASE_URL}{API_PATH}?{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/zodiac_pairing_query.py (reported line 54)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 API credentials from environment variables, and makes outbound network requests, but it does not declare any explicit tool scope or permissions boundaries. This creates an avoidable least-privilege gap: a host agent may grant broader capabilities than users expect, making credential access and external communication less transparent and harder to govern.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
82% confidence
Finding

The skill is designed to send user-supplied zodiac inputs and an API key to an external third-party endpoint. While this is expected functionality, it is still an external data transmission surface involving credentials and potentially user-derived data, so it carries privacy, key-exposure, and supply-chain trust risks if the endpoint, transport handling, or logging are mishandled.

Content

Scanner excerpt · SKILL.md (reported line 30)May include surrounding context.

直接调用 API:

text
GET https://api.jikeapi.cn/v1/zodiac_pairing?boy_zodiac=双鱼座&girl_zodiac=天蝎座&appkey=YOUR_APPKEY

AI 使用步骤

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_ZODIAC_PAIRING_QUERY_KEY",
  "api_url": "https://api.jikeapi.cn/v1/zodiac_pairing",
  "homepage": "https://www.jikeapi.cn/"
}

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module docstring presents the skill description only in Chinese, and the rest of the user-facing help and output strings in the file follow the same pattern. This forces a specific language for user interaction without any visible opt-in or justification that the skill is intended only for a Chinese-speaking or region-specific audience.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/zodiac_pairing_query.py (reported line 121)May include surrounding context.

python
"""
    params = {}
    for param_name, _ in REQUIRED_PARAMS + OPTIONAL_PARAMS:
        value = getattr(args, param_name, "")
        value = validate_date_param(param_name, str(value))
        if value:
            params[param_name] = value