Back to skill

Security audit

积存金价格监控助手

Security checks for vulnerabilities and agentic risk

Overview

This gold-price monitor is not malicious, but it needs Review because it can give buy/sell guidance from an unauthenticated price feed with source-description mismatches.

Review carefully before installing. It does not show exfiltration, destructive actions, credential use, or hidden persistence, but you should not rely on it for financial decisions unless the data source is changed to authenticated HTTPS, source labels are aligned, and price validation or confirmation from a trusted source is added.

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/check_gold_price.py:43
Finding

Unauthenticated Plain-HTTP Financial Price Feed

Content
View full analysis

Vulnerability Details

File Location: scripts/check_gold_price.py, lines 43–74
Vulnerability Type: Unauthenticated transport of integrity-sensitive financial data
Risk Level: High

Vulnerable Code

python
def fetch_ccb_gold_price() -> dict:
    """从新浪财经获取上海金交所 Au99.99 报价(作为建行积存金平替)"""
    ssl_ctx = _create_ssl_context()
    import time
    url = f"http://hq.sinajs.cn/rn={int(time.time()*1000)}&list=gds_AU9999"
    req = Request(url, headers={
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
        "Referer": "https://finance.sina.com.cn/",
    })
    
    with urlopen(req, timeout=15, context=ssl_ctx) as resp:
        data = resp.read().decode("gbk")

    if '="' not in data:
        raise ValueError("新浪财经数据格式异常: " + data)

    content = data.split('="')[1].split('";')[0]
    parts = content.split(',')

    if len(parts) < 13:
        raise ValueError(f"价格数据异常: 字段数量不足 ({len(parts)})")

    current_price = float(parts[0])
    # 新浪接口中:
    # parts[2] 是买一价(Bid),代表买家的最高出价,是客户能够卖出(套现)的价格 (Customer Sell Price)
    # parts[3] 是卖一价(Ask),代表卖家的最低要价,是客户能够买入(建仓)的价格 (Customer Buy Price)
    buy_price = float(parts[3]) if float(parts[3]) > 0 else current_price
    sell_price = float(parts[2]) if float(parts[2]) > 0 else current_price
    update_time = f"{parts[12]} {parts[6]}" # 例如: 2026-03-25 23:22:39

    return {
        "buy_price": buy_price,
        "sell_price": sell_price,
        "mid_price": current_price,
        "update_time": update_time,
    }

Technical Analysis

The quote endpoint uses plain HTTP. Consequently, the response has neither transport confidentiality nor cryptographic integrity, and the SSL context passed to urlopen does not protect this HTTP request.

Any attacker able to intercept or redirect the connection can replace the quote with a forged response. The implemented validation only checks ...[truncated 1824 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace the HTTP endpoint with a documented HTTPS endpoint and retain normal certificate and hostname verification.
  2. Explicitly reject redirects or final response URLs that downgrade the request from HTTPS to HTTP.
  3. Remove the misleading SSL context usage for plain HTTP; an SSL context only provides protection when TLS is actually used.
  4. Validate the complete response schema, expected instrument identifier, field types, positive prices, timestamp format, and timestamp freshness.
  5. Apply reasonable bounds to prices, bid/ask spreads, and single-update movements. Treat exceptional values as errors rather than immediately persisting them.
  6. Confirm alert-triggering movements through an independent trusted data source before issuing financial recommendations or changing the persistent baseline.
  7. Write a new baseline only after the quote passes all integrity and plausibility checks.
  8. Use atomic, permission-restricted writes for local state files to reduce the risk of corruption or local tampering.
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

整体主题仍然是黄金价格监控且适合定时调用,但声明中的关键行为与代码实际实现存在实质偏差。首先,描述称获取“实时国际金价”,而代码实际访问的是新浪财经接口返回的上海金交所 Au99.99 数据,并以人民币/克表示,这属于不同市场与不同类型的数据。其次,描述称“当价格波动超过阈值时发出通知”,但代码并没有调用任何通知渠道,只是输出 JSON 中的 alert 字段和建议文本,需由外部系统处理后才能通知。最后,描述称记录历史价格,但实现上并非每次采样都保存,而是只在首次记录或触发警报时保存为对比基准,因此“历史记录”能力比描述更有限。基于这些差异,应判定为描述与行为不完全一致。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest description and the full SKILL.md content require Chinese comprehension, which effectively forces a specific language for users and downstream agents. The file does not indicate that Chinese is optional, configurable, or justified as a region-specific requirement.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code comments and function naming claim a CCB source, but the implementation performs a request to a Sina Finance endpoint over plain HTTP. Using HTTP allows network attackers to tamper with the returned price data in transit, and the misleading documentation makes such manipulation harder to detect during review or operation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill advertises international gold-price monitoring, but the implementation actually uses a domestic Shanghai Gold Exchange quote sourced from Sina. This is a security-relevant integrity issue because downstream automation or users may make financial decisions based on materially different data than promised, and the mismatch is hidden behind misleading naming and comments.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.