Back to skill

Security audit

Technical Indicators

Security checks for vulnerabilities and agentic risk

Overview

This stock-analysis skill is mostly coherent, but it includes unsafe model loading that can run arbitrary code if a user loads an untrusted scaler file.

Install only if you are comfortable treating this as a Chinese-market research tool, not an automated trading authority. Do not load model or scaler files from third parties unless you fully trust their source, because the pickle scaler loader can execute code. Use a virtual environment, review and pin dependencies, and treat all buy/sell, target-price, stop-loss, and position-size outputs as informational signals requiring independent judgment.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
ml_predictor.py:597
Finding
Unsafe Pickle Deserialization in Model Loading## Vulnerability Details **File Location**: `ml_predictor.py:597-612` **Vulnerability Type**: Unsafe deserialization **Risk Level**: High ### Vulnerable Code ```python def load_model(self, path: str = "lstm_model.keras"): """加载模型和 scaler""" import pickle if TF_AVAILABLE: from tensorflow.keras.models import load_model # 自动检测文件格式 if path.endswith('.h5'): from tensorflow.keras.models import load_model as load_h5 self.model = load_h5(path, compile=True) else: self.model = load_model(path) # 加载 scaler scaler_path = path.replace('.keras', '_scaler.pkl') try: with open(scaler_path, 'rb') as f: self.scaler = pickle.load(f) ``` ### Technical Analysis The `load_model()` method derives a scaler filename from a caller-provided model path and deserializes that file with `pickle.load()`. Python pickle is not a data-only format: serialized objects can define reduction operations that invoke arbitrary Python callables during deserialization. The code performs no authenticity, integrity, ownership, or trusted-directory validation before loading the scaler. Consequently, a malicious scaler file supplied alongside a model, downloaded from an untrusted source, or placed through local filesystem access can execute code before the method returns. Merely inspecting the expected object type after deserialization would not prevent exploitation because execution occurs during `pickle.load()` itself. ### Attack Path 1. An attacker creates a malicious pickle whose reduction method invokes an operating-system or Python function. 2. The attacker distributes it as the scaler associated with a model, such as `shared_model_scaler.pkl`, or replaces an existing scaler file in a writable model directory. 3. A user or integrating Agent calls `load_model("shared_model.keras")`. 4. The method derives `sha ...[truncated 816 chars]
Remediation
## Remediation Suggestions 1. Do not use pickle for scaler persistence. Store data-only scaler attributes such as `mean_`, `scale_`, `var_`, and `n_features_in_` in JSON or NumPy files and reconstruct a known scaler class explicitly. 2. Treat both model and scaler files as executable or security-sensitive artifacts. Load them only from an application-controlled directory. 3. Verify artifacts using a cryptographic signature or an authenticated manifest before parsing them. A hash obtained from the same untrusted source is insufficient. 4. Reject symlinks and paths outside the approved model directory after resolving the canonical path. 5. Apply restrictive ownership and filesystem permissions to the artifact directory. 6. If backward compatibility requires pickle, clearly document that only trusted, locally generated pickle files may be loaded and isolate loading in a sandboxed process with minimal filesystem and network privileges.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:232
Finding
Unpinned Third-Party Dependency Installation Instructions## Vulnerability Details **File Location**: `SKILL.md:232-237`; `README_LSTM.md:134-139` **Vulnerability Type**: Unpinned and unhashed dependencies **Risk Level**: Medium ### Vulnerable Code `SKILL.md:232-237`: ```bash pip install akshare pandas numpy ``` `README_LSTM.md:134-139`: ```bash pip install tensorflow scikit-learn pandas numpy akshare ``` ```bash pip install ta-lib ``` ### Technical Analysis The documented installation commands resolve mutable package versions from the package index without exact version constraints or package hashes. Python package installation can execute build backends and installation-related code, while imported dependencies execute with the same privileges as the application. As a result, installation behavior is not reproducible and can change after the project has been reviewed. A future compromised release, dependency takeover, malicious transitive dependency, or incompatible update could introduce executable code that was not included in this audit. The project also lacks a reviewed lock file in the supplied directory. The metadata in `skill.json:19` declares `talib`, while the documentation installs `ta-lib`. This naming inconsistency increases dependency-selection ambiguity and should be resolved against the intended canonical distribution. ### Attack Path 1. A user follows one of the documented `pip install` commands. 2. Pip queries the configured package index and resolves the latest versions and their transitive dependencies at installation time. 3. A compromised, replaced, or otherwise unsafe resolved package is downloaded. 4. Package build or installation logic executes, or malicious code executes when the project imports the package. 5. The dependency code runs with the privileges and data access of the installing user or Agent process. Exploitation depends on compromise or unsafe modification of a resolved dependency or package source; the audit did not ...[truncated 498 chars]
Remediation
## Remediation Suggestions 1. Create a reviewed dependency lock file containing exact versions for direct and transitive dependencies. 2. Generate and record cryptographic hashes, for example with `pip-compile --generate-hashes`. 3. Require hash verification during installation: ```bash pip install --require-hashes -r requirements.txt ``` 4. Update all documentation to reference the lock file instead of installing unconstrained latest versions. 5. Confirm the canonical TA-Lib distribution and make `skill.json`, documentation, and the lock file use a consistent package identifier. 6. Use a trusted package index over TLS and prevent unreviewed extra indexes from participating in resolution. 7. Run dependency vulnerability and provenance checks in continuous integration, and update pinned versions through a controlled review process. 8. Install dependencies in an isolated virtual environment under a non-privileged account.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (52)

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This markdown file is almost entirely presented in Chinese, including headings, instructions, usage guidance, and warnings, but it does not state that the user can choose another language or that the skill is intended only for a Chinese-speaking context. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
A natural-language policy issue exists because the skill documentation appears to force a specific language for all users. The file does not indicate that Chinese is optional, user-selected, or required for a region-specific compliance reason.

Missing User Warnings

Medium
Confidence
85% confidence
Finding
This markdown file explicitly proposes pushing alerts through external channels including Feishu messages and email. Because these behaviors can transmit user or system-derived market data to third-party services, the description should include a warning about outbound notifications and any associated privacy or data-handling implications.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
该文档从标题到全部说明均固定为中文,未见任何语言选择、双语支持或对语言限定的合理性说明。根据规则,若技能在自然语言层面强制特定语言且没有用户选择或明确正当理由,可构成语言/locale 政策违规。

Missing User Warnings

Medium
Confidence
81% confidence
Finding
该README在综合示例中直接生成“买入/持有”“卖出/观望”等操作建议,属于可能影响用户资产决策的行为描述。文档虽提到“单一指标可能产生假信号”和“建议多指标结合使用”,但未明确提醒这不构成投资建议,也未提示市场风险或需用户自行判断。

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The entire skill documentation is written in Chinese and presents all labels, examples, and outputs in Chinese, but it does not state that the skill is region-specific or provide an opt-in language choice. Under the policy for natural-language violations, a skill should not implicitly force a specific language unless the locale constraint is documented and justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file presents all functional descriptions, examples, warnings, and API guidance in Chinese, which effectively forces a specific language/locale on users. The policy allows locale constraints only when users are given a choice or when the constraint is clearly documented and justified, neither of which appears here.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The file’s natural-language descriptions and user-facing strings are written exclusively in Chinese, beginning with the module docstring and continuing throughout the skill. There is no indication that the user can choose another language or that the skill is intentionally limited to a Chinese-only regional context, which conflicts with the locale-choice policy.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This Python file contains natural-language docstrings and console output in Chinese throughout the module, including the top-level description and runtime messages. The file does not offer any user opt-in for language selection or explain that the skill is intentionally region- or locale-specific, which conflicts with the language/locale policy criteria.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The example code prints user-facing trading recommendations such as trend assessments and suggested actions without any disclaimer that the output is educational, illustrative, and not financial advice. In a trading-related skill, users may reasonably rely on these recommendations for real decisions, increasing the risk of harmful financial actions based on simplified demo logic.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The combined multi-indicator section escalates risk by synthesizing multiple signals into explicit action-oriented guidance like '买入/持有' and '卖出/观望' without any warning about limitations, uncertainty, or non-advisory status. Because aggregation can make the output appear more authoritative, users may over-trust it as investment advice despite it being a simple example script.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
This code embeds its primary natural-language documentation in Chinese and later emits Chinese user-facing strings such as recommendations and example output. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The function returns recommendation strings of "买入", "卖出", and "观望" with no mechanism for locale selection. This creates a user-visible language constraint in application behavior rather than just internal comments.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This Python file contains user-facing natural-language descriptions in Chinese and the executable example prints Chinese-only output, which imposes a specific language/locale on users. The file does not offer an opt-in, alternative language selection, or explain that the skill is intentionally region-specific.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This Python file contains user-facing documentation and output values entirely in Chinese, including labels such as 情绪等级 and signals like 看涨/看跌. The skill does not provide any user opt-in for language selection or explain that it is intentionally limited to a Chinese-language or China-market context, which fits the language/locale policy violation criteria.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The function advertises forum sentiment analysis but actually reuses industry board price-change data as a proxy. This is a semantic integrity issue: downstream users may trust the result as independent retail/forum sentiment when it is not, leading to double-counting market-price-derived inputs and potentially flawed trading decisions.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The function claims to interpret policy sentiment but always returns a fixed neutral score, regardless of input data. This can mislead users into believing policy risk is being assessed when it is effectively ignored, creating false assurance in an expert-labeled decision-support tool.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The function claims industry news sentiment analysis, but only derives a score from industry board price movement ratios. This conflates price action with news sentiment, reducing model transparency and causing users to overestimate the diversity and independence of the sentiment inputs.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The module docstrings and runtime behavior explicitly require UTF-8 to support Chinese display and present the skill as Chinese-language only. Under the policy, forcing a specific language or locale without user opt-in is a natural-language policy violation unless the locale restriction is documented as justified or optional.

Insecure deserialization: pickle.load()

Medium
Category
Dangerous Code Execution
Content
scaler_path = path.replace('.keras', '_scaler.pkl')
            try:
                with open(scaler_path, 'rb') as f:
                    self.scaler = pickle.load(f)
                print(f"[OK] 模型已加载:{path}")
                print(f"[OK] Scaler 已加载:{scaler_path}")
            except FileNotFoundError:
Confidence
98% confidence
Finding
The code deserializes a scaler object with pickle.load() from a path derived from user-controllable input. Python pickle is not safe for untrusted data: a crafted .pkl file can execute arbitrary code during loading, leading to full code execution in the context of the process. In this skill context, model-loading is a normal feature, which makes the issue more dangerous because loading external model artifacts is a plausible real-world workflow.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This code file contains natural-language descriptions and comments that assume a specific language for users and maintainers, but it does not offer opt-in or explain that the skill is intentionally region- or language-specific. Under the policy, forcing a specific language without user choice is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This Python file embeds user-facing descriptions, signal labels, confidence levels, and recommendations primarily in Chinese, which imposes a specific language/locale on users. The policy for this audit flags language constraints when the skill does not provide a user opt-in or alternative locale selection.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The SignalType and ResonanceType enums define all user-visible labels in Chinese only, and these values are propagated into returned results. Because no language selection or opt-in is offered, this creates a natural-language locale policy issue across all consumers of the skill.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The summary recommendation values such as '强烈买入', '买入', '卖出', and '观望' are directly returned to downstream callers in Chinese only. This is a user-visible locale restriction without any documented opt-in or alternative language path.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
This code directly produces actionable BUY/SELL/HOLD recommendations along with target prices and stop-loss levels, but it provides no user-facing disclaimer, suitability check, or warning that the output is informational only. In a financial-decision context, users may over-trust the generated recommendations and act on them without understanding the model limitations, which can contribute to financial loss.

Static analysis

No suspicious patterns detected.