Back to skill

Security audit

Akshare Backtest

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed A-share backtesting tool, with some overstated documentation but no evidence of hidden, destructive, or credential-seeking behavior.

Install and run this in an isolated Python environment, and treat the backtest as experimental. The skill does not actually expose custom stop-profit or stop-loss controls despite claiming that it does, and its strategy/results may not match the README exactly.

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

T08 · Insecure Dependencies

Warning
Location
SKILL.md:10
Finding
Unpinned Third-Party Dependencies## Vulnerability Details **File Location**: `SKILL.md`, lines 10–27 **Vulnerability Type**: Unpinned third-party packages **Risk Level**: Medium ### Complete Code Snippet ```json "install": [ { "id": "pip-deps", "kind": "python", "package": "akshare", "label": "Install AkShare" }, { "id": "pip-deps", "kind": "python", "package": "pandas", "label": "Install Pandas" }, { "id": "pip-deps", "kind": "python", "package": "numpy", "label": "Install NumPy" } ] ``` The same unsafe installation pattern is also documented at line 64: ```bash pip install akshare pandas numpy ``` ### Technical Analysis The Skill declares and recommends installing `akshare`, `pandas`, and `numpy` without exact versions, package hashes, a lockfile, or an explicitly trusted package index. Dependency resolution therefore selects whichever compatible releases are available at installation time. This makes installations non-reproducible and creates supply-chain exposure. If an upstream package, maintainer account, distribution channel, or newly resolved transitive dependency is compromised, attacker-controlled code could execute during package installation or when the script imports the affected package. The project itself does not contain evidence that these package names are currently malicious; the risk arises from accepting mutable, unverified future releases. ### Attack Path 1. An attacker compromises an upstream dependency release, maintainer account, package distribution channel, or transitive dependency. 2. A user installs the dependencies through the Skill installer or runs the documented `pip install akshare pandas numpy` command. 3. Pip resolves an unpinned, attacker-controlled release because no approved version or hash is enforced. 4. Malicious installation hooks or imported package code execute under the account running the Skill. 5. The payload obtains access to resources available to that account, potentially inc ...[truncated 509 chars]
Remediation
## Remediation Suggestions 1. Pin every direct dependency to a reviewed exact version, for example with `package==version`. 2. Generate and commit a lockfile that also fixes all transitive dependency versions. 3. Use a hash-checked requirements file and install it with `pip install --require-hashes -r requirements.txt`. 4. Obtain hashes from reviewed artifacts and update them only through a controlled dependency-review process. 5. Configure an explicitly approved package index or internal package mirror rather than relying on ambient pip configuration. 6. Add automated dependency vulnerability and integrity checks to the release workflow. 7. Test dependency updates in an isolated environment before approving and publishing them. 8. Update both the Skill installation metadata and the documented installation command so they enforce the same reviewed versions.
Vulnerability Patterns
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding
该代码与声明有较强相关性,整体仍属于A股量化回测工具,也确实使用 AkShare、支持资金和回测周期设置,并输出交易记录与月度收益统计,因此不是完全偏离用途。但存在若干重要描述不实或夸大之处:一是“支持自定义止盈止损参数”未实现,止盈止损和持仓参数全是类内硬编码;二是“强势股轮动策略”表述过于宽泛,实际是特定的龙头低吸短线模型,并叠加沪深300 20日均线择时;三是“输出收益曲线”通常意味着图表或明确曲线产物,而代码只导出CSV和控制台摘要。综合看,描述覆盖了大方向,但对能力范围和可配置性存在实质性高估,应判定为不匹配。

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The top-level docstring states '最多3天' and specifically says '+5%卖1/3,+8%卖1/3,破10日均线或+10%以上清仓', while the code sets max_positions to 2 and in check_positions sells 2/3 once profit reaches +8%. These are active contradictions between the documented strategy behavior and the executed trading logic.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The manifest describes a backtesting tool for validating short-term strategies with user-configurable stop-profit/stop-loss settings and a '强势股轮动' style workflow. In code, the engine is explicitly labeled and implemented as '龙头低吸' with fixed thresholds for positions, holding days, stop loss, and take-profit levels, and no CLI arguments or other interfaces to customize them.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
The natural-language content of the skill, including its description, usage, parameters, and risk notes, is presented exclusively in Chinese. Under the policy, forcing a specific language without user opt-in can be a locale/language policy violation unless the regional constraint is clearly documented and justified.

Intent-Code Divergence

Low
Confidence
88% confidence
Finding
The inline comment says selection should come from limit-up candidates ('实际应该从涨停板中筛选'), indicating intended behavior tied to the described strategy. However, the implementation actually uses a static list of predefined popular stocks whenever no pool is provided, which contradicts the stated intent of dynamic limit-up-based selection.

Static analysis

No suspicious patterns detected.