T09 · Insecure Skill Coding Practices
- Location
scripts/sector_hunter.py:20- Finding
Shell Command Injection Sink in Search Helper
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is related to A-share stock screening, but it ships mismatched financial-analysis scripts and unsafe command/file/network patterns that users should review before installing.
Install only if you intentionally want a Chinese-language A-share market helper and are comfortable reviewing the scripts. The sector search behavior is not clearly separated from extra moving-average screeners, and the package should be fixed to avoid shell=True, avoid fixed /tmp output, use authenticated HTTPS market-data sources, and accurately document every shipped script before routine use.
scripts/sector_hunter.py:20Shell Command Injection Sink in Search Helper
scripts/ma_filter_fast.py:78Predictable Temporary File Allows Symbolic-Link Overwrite
scripts/ma_filter_em.py:17Market Data Retrieved over Unencrypted HTTP
The declared description says the skill discovers current strong A-share sectors and limit-up leading stocks, with code-prefix filtering and structured output by sector and leader. The supplied code does not analyze sectors,热点板块,涨停 behavior, leader stocks, or real-time searched market themes. Instead, it performs a technical scan over individual stocks using historical daily data and simple moving-average conditions (MA5 above MA10, both trending up). The only overlap is that it filters A-share codes by 00/60 prefixes, but that is incidental and insufficient to match the stated primary purpose. Therefore this is a clear description-behavior mismatch.
声明的核心能力是‘实时获取A股当日活跃板块、涨停龙头股’,重点对象是板块热度与龙头股;而代码完全没有进行板块排名、热度判断、涨停检测、龙头识别,也没有做联网搜索或输出板块维度结果。相反,它通过东方财富接口批量获取个股日线数据,使用MA5/MA10均线条件进行技术面选股。这属于与声明 materially different primary purpose 的情况,因此应判定为明显不匹配。
声明描述的核心能力是“强势板块、热点板块、涨停龙头”的实时探测,这通常需要板块维度数据、涨停数据或市场热点信息。代码中并未获取或分析任何板块信息、涨停信息、龙头股关系或实时热门数据;相反,它对全部00/60开头股票逐只拉取历史日线,计算5日和10日均线,并筛选满足均线多头上行条件的个股。这属于技术指标选股工具,而非板块热点/涨停龙头探测器。虽然都与A股选股相关,且都涉及00/60前缀过滤,但主要目的和实际行为存在明显实质性不一致。
The implementation materially diverges from the declared skill purpose: instead of identifying strong sectors and limit-up leader stocks, it performs a moving-average stock screen over individual A-shares. This kind of capability mismatch is dangerous because callers may trust the manifest and route requests or permissions based on the documented function, leading to misleading outputs, broken policy assumptions, or abuse of the skill under false pretenses.
The file’s actual behavior is a moving-average stock screener that scans all 00/60-prefixed equities and filters on MA5/MA10 conditions, which materially contradicts the declared skill purpose of finding strong sectors and limit-up leaders. In an agent setting, this kind of capability mismatch can cause the system to return misleading financial analysis under false pretenses, leading users or downstream automations to act on incorrect results.
The manifest describes a tool that searches for active A-share sectors and涨停龙头股, then outputs structured sector-plus-leader results with prefix filtering. This script instead performs a moving-average stock screen over all 00/60-prefixed stocks using historical daily price data, and never identifies sectors, hot themes, or limit-up leaders.
This is a true command-injection risk: the tool invocation is assembled as a single shell string and executed with shell=True, allowing user-controlled query text to alter command structure. In the context of an agent skill, natural-language user input is especially attacker-controllable, making exploitation straightforward if an attacker can supply crafted arguments.
cmd = f'python3 "{script_path}" "{query}" --count {count}'
try:
result = subprocess.run(
cmd,
shell=True,
capture_output=True,
The skill advertises network access and a Python script but does not declare any explicit tool scope such as allowed-tools or permissions. That creates a least-privilege failure: a host may grant broader network, shell, or file capabilities than users or reviewers expect, increasing the blast radius if the script is modified, compromised, or behaves unexpectedly.
Broad trigger phrases like '今日热门' or '热点板块' can cause accidental invocation in normal conversation, making the assistant perform unintended network searches or tool-assisted actions. In a skill with external search capability, overbroad activation increases the chance of unreviewed tool use, confusion, and cross-context execution.
Ambiguous invocation examples reinforce loose activation behavior and make it harder for users and orchestrators to distinguish ordinary discussion from a command to run the skill. Because this skill depends on online search, unintended activation can lead to unnecessary external requests and misleading outputs presented as deliberate analysis.
The module docstring explicitly describes a moving-average stock picker, which contradicts the skill metadata advertising strong-sector and leader-stock discovery. This inconsistency is a security-relevant integrity issue because it indicates the artifact may have been repurposed, mispackaged, or swapped, making operator trust and downstream automation decisions unreliable.
The module docstring explicitly states this is a moving-average stock picker, directly conflicting with the skill’s published sector-hunting purpose. This inconsistency is dangerous because it signals specification drift and increases the chance that reviewers, orchestrators, or users will misunderstand what the code does, especially in a finance-related workflow where output semantics matter.
All user-facing text in the module docstring and runtime output is in Chinese, and the file does not provide any language selection or explain that the tool is intentionally limited to a Chinese-speaking audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The module description and all user-facing behavior are written as Chinese-only, and the code later emits Chinese-only status/output strings. For an all-file-types natural-language policy check, this represents a locale/language constraint without user opt-in or documented regional justification.
The code invokes an external web search tool to send the constructed query off-box, but there is no explicit disclosure that user-provided query content will be transmitted to a network service. Although there is a debug print showing the search term, it does not warn about privacy or external data sharing.
The code builds a shell command with untrusted input (query) and executes it with subprocess.run(..., shell=True). Because query comes from CLI/user-controlled text, an attacker can inject shell metacharacters to execute arbitrary commands in the skill environment.
cmd = f'python3 "{script_path}" "{query}" --count {count}'
try:
result = subprocess.run(
cmd,
shell=True,
capture_output=True,
The manifest description and the rest of the file present the skill entirely in Chinese and imply a fixed-language interaction model, but they do not state that the skill is China-region-only or offer users a language option. Under the stated policy, forcing a specific language without opt-in is a natural-language policy concern.
This Python file contains its docstring and all user-facing print output in Chinese, with no option to select another language or statement that the skill is intentionally limited to a Chinese-language audience. Under the policy rule for natural-language constraints, forcing a specific language without user opt-in is a policy concern.
The module title and user-facing descriptions are presented exclusively in Chinese, and the script does not indicate that the user can choose another language or that the tool is intentionally limited to a Chinese-speaking context. This can violate language/locale policy where skills should not force a language without opt-in or justification.
This Python code fetches stock data from an external source via akshare, which implies outbound network requests, but the script does not disclose this behavior to the user before or during execution. While the script prints progress and an investment disclaimer, it does not warn that it will contact remote data services and transmit query parameters such as stock symbols.
The manifest focuses on producing structured板块+龙头个股列表 from real-time search results, but this script additionally persists scan results to /tmp/ma_stocks.txt. Local file output is not implied by the user-facing description of a sector/leader detector.