Back to skill

Security audit

A股个股深度分析

Security checks for vulnerabilities and agentic risk

Overview

This stock-analysis skill is mostly purpose-aligned, but it tells the agent to permanently add newly discovered data sources into its own skill instructions without clear review or approval.

Install only if you are comfortable with a stock-analysis skill making external market-data and web requests, reading a specific local a-stock-data skill file, and potentially modifying its own endpoint list. The self-persistence instruction should be removed or changed to require explicit review before any newly discovered data source becomes trusted for future runs.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T02 · Agent Memory Poisoning

Warning
Location
SKILL.md:34
Finding
Persistent Modification of the Skill’s Trusted Endpoint Registry## Vulnerability Details **File Location**: `SKILL.md`, line 34 **Vulnerability Type**: Persistent memory poisoning through automatic skill-file modification **Risk Level**: Medium ### Vulnerable Instruction ```markdown **Successfully obtained data sources and their invocation methods must be persisted into the "Known Available Endpoints" section of this SKILL for direct reuse in the future.** ``` ### Technical Analysis The skill instructs the agent to modify its own persistent definition whenever it successfully obtains a new data source. This converts information discovered during an individual, potentially attacker-influenced session into trusted instructions that affect future sessions. A data source being temporarily reachable or returning syntactically valid data does not establish that it is trustworthy. A user could direct the agent toward an attacker-controlled fallback endpoint, or an external search result could lead to such an endpoint. If one request succeeds, the instruction requires its address and invocation method to be added to `SKILL.md`. Because `SKILL.md` controls future agent behavior, the resulting entry crosses the boundary between untrusted runtime data and persistent trusted configuration. Subsequent invocations may then reuse the poisoned endpoint without repeating provenance, ownership, integrity, or security validation. This is best classified as agent memory poisoning rather than remote payload execution: the confirmed instruction persists remote data-source configuration, but the reviewed file does not explicitly direct the agent to download and execute remote code. ### Attack Path 1. An attacker asks for an analysis that causes the preferred market-data sources to fail or appear unsuitable. 2. The attacker supplies, recommends, or makes discoverable an attacker-controlled endpoint as a fallback data source. 3. The endpoint returns plausible stock-market data, causing the retrieval attempt to be considered successful. 4. ...[truncated 1302 chars]
Remediation
## Remediation Suggestions 1. Remove the instruction that automatically writes discovered endpoints into `SKILL.md`. 2. Treat the installed skill definition as immutable during normal execution. 3. Store runtime discoveries in a session-scoped cache that is discarded after the task completes. 4. If endpoint persistence is operationally necessary, use a separate configuration registry with: - Explicit administrator approval. - A strict domain and protocol allowlist. - TLS certificate validation. - Endpoint ownership and provenance checks. - Authentication and secret-management controls where applicable. - Schema validation and response-size limits. - Audit logs recording who proposed, approved, and changed each endpoint. 5. Never persist endpoints supplied by users or discovered through web search without independent verification. 6. Require manual review before promoting a candidate endpoint into trusted configuration. 7. Pin approved endpoint hostnames and API versions where practical, and periodically revalidate them. 8. Restrict the agent’s filesystem permissions so ordinary skill execution cannot modify its own skill files. 9. Add integrity monitoring or signed hashes for `SKILL.md` so unauthorized changes are detected before future use. 10. Separate “known trusted endpoints” from “temporarily attempted fallback sources” in both configuration and reporting.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Description-Behavior Mismatch

Medium
Confidence
93% confidence
Finding
The manifest description claims coverage of order visibility, gross margin direction, cash-flow matching, capacity expansion drivers, technical barriers, industry positioning, and supply-demand assessment. However, the embedded data-collection script only fetches real-time quotes, K-line indicators, EPS expectations, research reports, unlock schedules, leaderboard activity, sector membership, and fund-flow data; it does not retrieve core financial statements or company-operating data needed for many of the claimed fundamental analyses.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The activation rules are broad enough to trigger on ordinary investing conversation, which can cause the agent to invoke this skill unexpectedly and begin network-heavy collection and analysis. In an agent environment, overbroad routing increases attack surface by causing unintended tool use, external requests, and access to other local skill files without a tightly scoped user intent.

Vague Triggers

Medium
Confidence
97% confidence
Finding
Ambiguous triggers such as '这个股怎么样' and '给XXX做个分析' make accidental invocation likely, especially in broad market discussions or multi-topic chats. Because this skill instructs the agent to perform external lookups and cross-skill reads once activated, loose phrasing materially increases unintended execution risk.

Skill Enumeration

Medium
Category
Agent Snooping
Content
## 分析前准备

1. 用户必须提供股票代码(6 位数字),若只提供名称则先确认代码
2. 先读取 `~/.agents/skills/a-stock-data/SKILL.md` 确认端点
3. 运行内置数据采集脚本
4. 任何数据源失败 → 尝试 fallback(联网搜索 / 其他公开 API)
5. 所有尝试失败 → 标注「⚠️ 数据不可获取」,不编造
Confidence
91% confidence
Finding
The skill explicitly instructs reading `~/.agents/skills/a-stock-data/SKILL.md`, which reveals internal filesystem structure and enumerates other installed skills. In agent systems, cross-skill file discovery can leak environment details and expand what an attacker can probe or socially engineer, especially when activation is broad and user-controlled.

External Transmission

Medium
Category
Data Exfiltration
Content
reports = []
    for page in range(1, 4):
        params = {"industryCode": "*", "pageSize": "50", "industry": "*", "rating": "*", "ratingChange": "*", "beginTime": (datetime.now()-timedelta(days=180)).strftime("%Y-%m-%d"), "endTime": TODAY, "pageNo": str(page), "qType": "0", "orgCode": "", "code": CODE, "rcode": "", "p": str(page), "pageNum": str(page), "pageNumber": str(page)}
        r = em_get("https://reportapi.eastmoney.com/report/list", params=params, headers={"Referer": "https://data.eastmoney.com/"}, timeout=30)
        rows = (r.json().get("data") or [])
        if not rows: break
        for row in rows:
Confidence
88% confidence
Finding
The script performs outbound requests to third-party sites using user-influenced stock codes and collects externally sourced content into the agent workflow. While market data retrieval is the skill's purpose, unrestricted external transmission and ingestion still expand the attack surface through data exfiltration opportunities, dependency on untrusted content, and possible prompt/tool-chain contamination from parsed remote responses.

Skill Enumeration

Medium
Category
Agent Snooping
Content
## 执行流程总结

1. 读取 `~/.agents/skills/a-stock-data/SKILL.md` 确认端点
2. 运行数据采集脚本:`python3 /tmp/stock_analysis.py <代码>`
3. 检查各模块数据完整性,缺失项尝试联网搜索补充
4. 按上述报告模板撰写分析
Confidence
91% confidence
Finding
Repeating the instruction to read another skill's local SKILL.md reinforces a pattern of internal skill enumeration and local path disclosure. This is dangerous because it normalizes cross-skill inspection and may let adversarial prompts pivot from one skill into discovering or abusing other installed capabilities.

Description-Behavior Mismatch

Low
Confidence
88% confidence
Finding
The description states the analysis is based on the a-stock-data toolkit's real data, suggesting that toolkit is the primary operational basis. In practice, the documented retrieval strategy and code depend directly on Tencent, Eastmoney, Tonghuashun, mootdx, web_search, and even web_crawl fallbacks, making the skill broader than the description implies.

Intent-Code Divergence

Low
Confidence
84% confidence
Finding
The report template states that recent news should prioritize a-stock-data and only use web_search as a fallback. But the '已知可用端点' table lists news solely as 'web_search 联网搜索' when Eastmoney APIs are unavailable, and the embedded code contains no a-stock-data-based news retrieval at all, so the documentation overstates what the implementation does.

Static analysis

No suspicious patterns detected.