Back to skill

Security audit

股票技术分析

Security checks for vulnerabilities and agentic risk

Overview

The skill is a stock-analysis helper, but its command instructions and file-writing behavior are under-scoped enough to warrant Review before installation.

Install only if you are comfortable giving this skill Python execution and a stock-data API key. Prefer using it in a constrained workspace, validate ticker/period/indicator inputs, avoid direct shell interpolation, and direct outputs to a dedicated safe directory. Expect some commands in the documentation to need correction before the skill works reliably.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:32
Finding

Shell Command Injection Through Unquoted User-Controlled Arguments

Content
View full analysis
--period <周期> --count <数量> ``` ```bash python3 {baseDir}/tools/indicator_engine.py --symbol <代码> --indicators <指标列表> ``` ```bash python3 {baseDir}/tools/pattern_recognizer.py --symbol <代码> --period daily ``` ```bash python3 {baseDir}/tools/trend_analyzer.py --symbol <代码> ``` ```bash python3 {baseDir}/tools/volume_analyzer.py --symbol <代码> ``` ```bash python3 {baseDir}/tools/chart_generator.py --symbol <代码> --type comprehensive --output /tmp/chart.png ``` ### Technical Analysis The Skill instructs the agent to invoke these commands through an `exec` tool while directly substituting stock symbols, periods, indicator lists, and related user-controlled values into shell command strings. The documented commands do not quote the substituted values or require strict validation before execution. If the `exec` implementation invokes a shell, metacharacters embedded in a supplied stock symbol or another argument can terminate or alter the intended command and introduce an additional command. Python `argparse` validation does not mitigate this issue because shell interpretation occurs before the Python process receives its arguments. Market-specific stock identifiers have narrow, predictable formats, but the Skill does not prescribe an allowlist or reject unexpected characters. ### Attack Path 1. An attacker submits a technical-analysis request containing a crafted stock symbol or other command argument with shell control characters. 2. The agent substitutes the attacker-controlled value into one of the command templates in `SKILL.md`. 3. The agent passes the resulting string to the shell-backed `exec` tool. 4. The shell interprets the injected metacharacters and executes an additional attacker-selected command. 5. The injected co ...[truncated 751 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
tools/chart_generator.py:46
Finding

Unsafe Temporary Files and Unrestricted Output File Overwrite

Content
View full analysis
--type comprehensive --output /tmp/chart.png ``` ### Technical Analysis `tempfile.mktemp()` generates a pathname without securely creating and opening the corresponding file. Another local process can create a file or symbolic link at the selected pathname between name generation and the later chart write, resulting in a time-of-check/time-of-use race. The fixed names `/tmp/kline.json`, `/tmp/trend.json`, `/tmp/volume.json`, and `/tmp/chart.png` are predictable and may be shared across users or concurrent Skill runs. The JSON tools subsequently open their paths with mode `w`, which follows symbolic links and tr ...[truncated 2187 chars]
Remediation
View remediation
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • 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
Findings (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个完整的股票技术分析技能,涵盖多市场分析、形态识别、指标计算、趋势与量价分析,并输出可操作报告。但提供的代码块只是“图表生成器”:读取已有K线数据,调用mplfinance绘图,支持少量图表类型和MA均线叠加;若库不可用则输出文字版K线列表。代码没有看到针对A股/美股/港股市场的特定分析逻辑,也没有形态识别、趋势判断、量价关系分析、交易建议或报告生成流程。因此其实际行为与声明的核心能力存在明显且实质性的偏差。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述的是一个完整的技术分析技能,涵盖多市场股票分析与报告生成;但给出的代码块实际只是一个K线数据获取工具。它调用 StockDataAdapter.get_kline 拉取行情数据,做字段标准化后返回/写入JSON,没有任何分析逻辑、指标计算、形态识别、趋势评估或报告输出。市场参数虽在CLI中声明支持A/US/HK,但函数内部也未基于market做差异化处理。因此该代码与声明的核心用途存在明显不匹配;它更像是技术分析技能的底层数据准备组件,而非所宣称的完整分析能力。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

该代码与声明中的一部分相符,尤其是“K线形态识别”以及部分技术分析中的支撑/阻力和成交量分布处理。但声明强调的是“全面技术分析”,包含技术指标、趋势判断、量价分析和报告生成;而当前代码块只覆盖了其中的局部功能,主要是K线形态识别和支撑阻力检测。没有发现越权访问、外部资源访问或隐藏的无关能力,但其实际能力明显小于且不同于声明的完整范围,因此应判定为描述与实际行为不完全一致,构成不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

声明描述的是一个“全面技术分析”技能,范围包括K线形态识别、技术指标计算、趋势判断、量价分析和报告生成。实际代码的核心功能较窄,主要是基于close/high/low数据做趋势判断:通过MA5/10/20/60判断均线排列,使用近20日线性拟合斜率评估趋势强弱,计算R²评估稳定性,并基于均线、近20日高低点和布林带给出支撑/阻力位。代码中虽然读取了volume列,但没有任何量价分析逻辑;也没有K线形态识别、MACD/RSI/KDJ等更广泛技术指标,且输出只是简要JSON结果而非完整可操作报告。因此,代码与声明相比存在明显能力缺失,属于描述大于实际行为的功能不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill invokes multiple local Python tools and explicitly writes an output file to /tmp/chart.png, yet it declares no tool scope such as allowed-tools or permissions. This creates an overbroad execution surface where the runtime may permit more capabilities than intended, reducing containment if the called scripts are modified or abused.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains user-facing natural-language text only in Chinese, starting with the module docstring and continuing through the CLI description/help text. Per the policy, forcing a specific language without user choice is a natural-language policy violation unless the locale constraint is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code file contains natural-language documentation that is exclusively Chinese, and the CLI help text is also Chinese-only. Under the policy, forcing a specific language without offering a user choice or documenting a justified locale constraint is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The argparse description and argument help strings are presented only in Chinese, which fixes the user-facing interface to one language. There is no indication that users can choose another locale or that the restriction is justified by a region-specific purpose.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script prepends a computed filesystem path to sys.path, altering Python's import resolution at runtime. If that directory or its parent tree is writable or replaceable by an attacker, the import of stock_data_adapter could be hijacked to load malicious code, turning a data-fetch utility into a code-execution vector.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The CLI accepts an arbitrary --output path and writes JSON to it without restriction. In an agent or automated execution context, an attacker who can influence arguments could overwrite or create files outside the intended workspace, which exceeds the stated purpose of fetching market data and creates a file-write primitive.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and all user-facing pattern labels are written exclusively in Chinese, indicating the skill is designed to operate in a single language. The file does not offer a language choice or explain that the skill is intentionally limited to a Chinese-speaking or region-specific context, which matches the locale-policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring presents the skill entirely in Chinese, and the command-line description and user-facing messages are also Chinese-only. This imposes a specific language on users without any opt-in, fallback, or documented justification that the tool is intended only for a Chinese-speaking or region-specific context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file contains natural-language docstrings and CLI descriptions entirely in Chinese, including the module description and argument help text. Under the stated policy, forcing a specific language without offering the user a choice or documenting a justified locale constraint is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The argparse description, help strings, and printed status/error messages are presented only in Chinese. This imposes a language choice on users without opt-in or justification, matching the language/locale policy violation criteria.

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 · tools/indicator_engine.py (reported line 399)May include surrounding context.

python
for ind in indicators:
            method = f"calc_{ind.lower().strip()}"
            if hasattr(engine, method):
                getattr(engine, method)()
        results = engine.results

    print(json.dumps(results, ensure_ascii=False, indent=2))

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 · tools/pattern_recognizer.py (reported line 65)May include surrounding context.

python
o, h, l, c = df["open"], df["high"], df["low"], df["close"]

    for func_name, info in PATTERNS.items():
        func = getattr(talib, func_name, None)
        if func is None:
            continue
        result = func(o, h, l, c)

Static analysis

No suspicious patterns detected.