Back to skill

Security audit

国际实时金价 - 即刻数据

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it claims, but an undocumented API-base override can redirect the user's AppKey to an arbitrary endpoint.

Review before installing. Use only for explicit live or historical gold-price lookups, provide a low-privilege Jike API key, and ensure JIKE_API_BASE_URL is unset or locked to https://api.jikeapi.cn. Rotate the key if it may have run with an untrusted base URL, and avoid treating returned prices as investment advice.

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

Error
Location
scripts/gold_wgc_query.py:23
Finding

Unrestricted API Base URL Override Can Disclose the AppKey

Content
View full analysis

Vulnerability Details

File Location: scripts/gold_wgc_query.py, lines 23 and 128–130
Vulnerability Type: Unrestricted endpoint configuration and credential disclosure
Risk Level: High

Vulnerable Code

python
API_BASE_URL = os.environ.get("JIKE_API_BASE_URL", "https://api.jikeapi.cn").rstrip("/")

The configurable value is subsequently used to construct a request containing the AppKey:

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"))

Technical Analysis

The undocumented JIKE_API_BASE_URL environment variable can replace the expected https://api.jikeapi.cn origin with an arbitrary URL. The script performs no validation of the URL scheme, hostname, port, embedded credentials, or destination address.

The AppKey is included directly in the query string sent to the configured endpoint. Consequently, any party capable of influencing the process environment can redirect the request to an attacker-controlled server and capture the credential. A plaintext HTTP endpoint can also be selected, exposing the AppKey to network interception.

Because the returned JSON is trusted as the API response, a malicious endpoint can additionally supply fabricated gold-price data. Depending on network access available to the process, the configurable destination may also permit outbound requests to internal services, although the fixed API path is appended to the selected base URL.

Attack Path

  1. The attacker gains the ability to set or influence JIKE_API_BASE_URL in the environment used to launch the skill.
  2. The attacker assigns an endpoint under their control, such as https://attacker.example.
  3. A user or agent invokes the documented latest or history command.
  4. The script constructs a request such as `https://attacker.example/v ...[truncated 892 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the JIKE_API_BASE_URL override in production and use a fixed HTTPS origin:
python
API_BASE_URL = "https://api.jikeapi.cn"
  1. If endpoint overrides are required for testing, enable them only through an explicit test mode that cannot be activated in normal production execution.

  2. Validate any permitted override using parsed URL components:

    • Require the https scheme.
    • Allow only explicitly approved hostnames.
    • Reject embedded usernames or passwords.
    • Reject unexpected ports.
    • Reject fragments and preexisting query strings.
    • Normalize and compare hostnames before sending credentials.
  3. Avoid placing secrets in query strings where the API supports an authorization header. Query parameters may be exposed in server, proxy, monitoring, or access logs.

  4. Use separate, low-privilege test credentials for development endpoints and rotate any AppKey that may have been exposed through an untrusted override.

  5. Document every supported security-sensitive environment variable so deployment reviewers can identify and restrict configuration that affects network destinations.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 130, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
95% confidence
Finding

The request URL is partially derived from the environment variable JIKE_API_BASE_URL and then passed directly to urllib.request.urlopen. In an agent or automation environment, an attacker who can influence environment variables can redirect requests to arbitrary hosts, causing SSRF-style behavior, credential leakage of the appkey in the query string, or access to internal network resources. The skill context increases risk because this tool is explicitly designed to make outbound network requests and includes a secret in the generated URL.

Content

Scanner excerpt · scripts/gold_wgc_query.py (reported line 132)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/gold_wgc_query.py (reported line 49)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
91% confidence
Finding

The skill declares operational capabilities via metadata and usage examples that require environment variables, file access to local scripts, and outbound network access, but it does not explicitly constrain tool scope with permissions or allowed-tools. In agent environments, this ambiguity can cause the runtime to grant broader access than necessary or make it harder to enforce least privilege, increasing the chance of unintended data access or external calls.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The description says the skill should be used for broad categories like related data queries, date queries, or market queries, which creates ambiguous activation boundaries. In an agentic system, overly broad routing criteria can cause the skill to be invoked for loosely related financial requests, resulting in unnecessary external data transmission and overuse of a third-party integration.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

The skill is designed to transmit data to an external API endpoint, which is a genuine security-relevant behavior even if it is expected functionality. In context this is less suspicious than hidden exfiltration because the endpoint is disclosed and aligned with the skill purpose, but it still creates privacy, dependency, and secret-handling risk, especially since the API key is passed in the request URL and may be exposed via logs or intermediaries.

Content

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

直接调用 API:

text
GET https://api.jikeapi.cn/v1/gold/wgc/latest?appkey=YOUR_APPKEY

AI 使用步骤

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The AI usage steps map common user questions directly to this skill without guardrails, exclusions, or confirmation requirements. That increases the likelihood of automatic invocation for ordinary finance-related queries, sending requests to the external provider even when the user did not clearly ask for third-party retrieval or when a safer local answer would suffice.

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_GOLD_WGC_QUERY_KEY",
  "api_url": "https://api.jikeapi.cn/v1/gold/wgc/latest",
  "homepage": "https://www.jikeapi.cn/"
}