Back to skill

Security audit

Akshare Stock.Tmp

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed A-share market-data helper that installs AkShare and reads public market data; the issues found are dependency, reliability, and scope-accuracy concerns rather than malicious behavior.

Install this in a virtual environment, consider pinning and reviewing the AkShare version before use, and expect Chinese-language output. Treat the results as informational market data only, not investment advice, and be aware that the bundled fund-flow command may fail until the implementation bug is fixed.

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:8
Finding
Unpinned Third-Party Dependency Installation## Vulnerability Details **File Location**: `SKILL.md:8-11` **Vulnerability Type**: Unpinned third-party dependency **Risk Level**: Medium ### Vulnerable Code ```markdown Install dependencies: ```bash pip install akshare ``` ``` ### Technical Analysis The documented installation command retrieves and installs the current `akshare` release without an exact version constraint or package-integrity hash. Consequently, the installed code can differ over time from the version reviewed during this audit. Python packages can execute code during installation and whenever their modules are imported. If the upstream package, maintainer account, release process, or package repository is compromised, following this instruction could introduce attacker-controlled code into the user's environment. Unexpected upstream changes could also cause compatibility or integrity failures even without malicious activity. The audit found no evidence that AkShare itself is malicious. The risk arises from trusting mutable third-party package content without version or integrity verification. ### Attack Path 1. An attacker compromises the upstream AkShare release process, a maintainer account, or the package-distribution channel. 2. The attacker publishes a malicious release under the legitimate package name. 3. A user follows the skill documentation and runs `pip install akshare`. 4. Because no version or hash is specified, pip resolves and installs the attacker-controlled release. 5. Malicious package code executes during installation or when `scripts/stock_cli.py` imports `akshare`. 6. The payload operates with the permissions of the user or service account that installed or invoked the skill. ### Impact Assessment Successful exploitation could permit arbitrary Python code execution with the privileges of the installing or executing account. Depending on those privileges, the attacker could access files and environment variables available to that account, alter application dat ...[truncated 272 chars]
Remediation
## Remediation Suggestions 1. Pin AkShare to an exact, reviewed version, for example through a dedicated requirements file: ```text akshare==<reviewed-version> ``` 2. Generate and verify cryptographic hashes for all direct and transitive dependencies, then install with hash enforcement: ```bash python -m pip install --require-hashes -r requirements.txt ``` 3. Maintain a lock file generated from a trusted environment so dependency resolution is reproducible. 4. Install packages only from an explicitly configured, trusted package index. 5. Review dependency updates before changing the pinned version, including release provenance and vulnerability advisories. 6. Perform installation and execution inside an isolated virtual environment or container under a non-privileged account.
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 (4)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
整体上,这段代码确实属于A股数据查询工具,且使用AkShare获取行情与板块信息,与声明的大方向一致。但声明描述的能力范围明显大于实际实现:代码没有财务报表、估值、利润、资产负债等财务数据获取,也没有任何量化分析或选股筛选逻辑,因此“财务分析、选股”等表述会让人误以为工具具备更完整的分析能力。另一方面,代码实际还包含资金流向查询能力,虽可视作行情相关扩展,但声明未明确说明。另有一个实现细节问题:get_fund_flow 中调用的是 stock_individual_fund_flow 而非 ak.stock_individual_fund_flow,按当前代码可能报错。不过就描述与行为匹配性而言,主要问题是声明夸大了财务分析和选股能力,因此应判定为存在不匹配。

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
This code file contains user-facing natural-language text that assumes Chinese-only interaction, beginning with the top-level description. The policy requires flagging language or locale constraints when a specific language is forced without user opt-in or justification.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The installation guidance shown to users is hard-coded in Chinese, and the CLI consistently uses Chinese-only error/help text elsewhere in the file. Because no language choice or justification is provided, this is a natural-language policy violation under the locale/language rule.

Intent-Code Divergence

Medium
Confidence
88% confidence
Finding
`get_fund_flow` 的文档字符串表明该函数用于获取股票资金流向,但实现中调用的是未限定模块名的 `stock_individual_fund_flow`,而不是前文一致使用的 `ak.*` 接口。这使得代码实际行为与文档宣称的基于 AkShare 获取该数据的意图发生偏离,并可能在运行时直接失败而不是完成所述功能。

Static analysis

No suspicious patterns detected.