Back to skill

Security audit

akshare-stock

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward A-share market-data helper that fetches public stock information through AkShare, with no hidden persistence, credential theft, or unrelated system access found.

Install in a dedicated Python virtual environment and consider pinning reviewed versions of AkShare and its dependencies. Expect stock symbols, keywords, and date ranges to be used in requests to external market-data services. Do not treat returned data as investment advice.

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 Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 10; repeated in scripts/stock_cli.py, line 12
Vulnerability Type: Unpinned and unverifiable third-party dependency installation
Risk Level: Medium

Vulnerable code snippets:

SKILL.md, line 10:

bash
pip install akshare

scripts/stock_cli.py, lines 9–13:

python
try:
    import akshare as ak
except ImportError:
    print("请先安装: pip install akshare")
    sys.exit(1)

Technical Analysis

The project directs users to install akshare from the currently configured Python package index without specifying a reviewed version, cryptographic hashes, or a trusted index URL. The project also provides no dependency lock file.

As a result, the installed package and its transitive dependencies can change after the Skill has been audited. If a future package release, transitive dependency, or configured package index is compromised, attacker-controlled installation or import-time code could execute under the account running the installation. The documentation similarly describes Baostock as a fallback without defining a verified version.

This finding does not establish that AkShare or Baostock is currently malicious. The vulnerability is the project's reliance on mutable, unverified dependency resolution.

Attack Path

  1. A user follows the documented pip install akshare instruction.
  2. pip queries the user's configured package index and resolves the latest compatible AkShare release and transitive dependencies.
  3. An attacker compromises a future dependency release or controls an index configured with sufficient priority.
  4. pip downloads and installs the attacker-controlled distribution without project-provided hash verification.
  5. Malicious build hooks, installation behavior, or module initialization executes under the user's privileges during installation or when stock_cli.py imports AkShare.

Impact Assessme

...[truncated 436 chars]

Remediation
View remediation

Remediation Suggestions

  1. Create a dependency lock file containing reviewed, exact versions for AkShare and all transitive dependencies.
  2. Record cryptographic hashes for every permitted distribution and install with:
    bash
    python -m pip install --require-hashes -r requirements.txt
    
  3. Configure an explicit trusted package index rather than relying on an arbitrary user or environment configuration.
  4. Review dependency updates before changing the lock file, including package ownership, release provenance, build configuration, and newly introduced transitive dependencies.
  5. Prefer prebuilt, verified wheels and prohibit unexpected source builds in production environments.
  6. Run the CLI in a least-privileged virtual environment or isolated container without unnecessary credentials or filesystem access.
  7. Update both SKILL.md and the import-error message in scripts/stock_cli.py to reference the locked installation procedure.
  8. Apply the same pinning and hash-verification controls if Baostock remains a supported fallback.
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 (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code generally aligns with the broad domain of an A-share data query tool based on AkShare: it fetches quotes, historical prices, sector information, fund flow, and supports stock search. However, the declared description claims broader capabilities including financial data retrieval, financial analysis, and stock screening, none of which appear in this code chunk. The code is narrower and focused on market/board/search data via a CLI. Additionally, the skill declaration lists no triggers, but the code is clearly a command-line tool with explicit actions (quote, kline, industry, concept, flow, search), which is an interface/trigger mismatch. There is no evidence of harmful undeclared behavior such as exfiltration or unrelated resource access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This Python code calls AkShare to retrieve realtime stock data, which implies an outbound network request to external data providers. While the script prints results, it does not disclose before execution that invoking these actions will contact remote services and transmit query parameters such as stock symbols.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The historical K-line function uses AkShare to fetch remote market data, which is a network operation covered by the warning requirement for code files. There is no confirmation, log/disclosure, or nearby documentation telling users that the command sends requests to an external service.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

This function obtains industry board data through AkShare, which is a remote data fetch. The file lacks any warning in comments, docstrings, help text, or runtime messaging that the command will access third-party market-data endpoints.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The AkShare API invocation is a network-backed operation, but the script provides no user disclosure that this action reaches out to external services. Under the code-file warning criteria, such remote requests should be surfaced to the user in some visible form.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The search path downloads spot market data via AkShare and filters it locally, which is an outbound network operation. The script does not warn users that a search request will contact external services and send the provided keyword context indirectly through the query flow.

Content

No source excerpt is available for this finding.