Back to skill

Security audit

A Share Sector

Security checks for vulnerabilities and agentic risk

Overview

This looks like a real A-share market data skill, but it can automatically install unpinned packages and silently remove proxy settings, so it needs user review before installation.

Install only if you are comfortable with the skill modifying the active Python environment and making direct outbound market-data requests. Prefer installing pinned dependencies in an isolated virtual environment first, and review or remove the proxy-clearing behavior if you rely on enterprise proxy, monitoring, or package-mirror controls.

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)

T08 · Insecure Dependencies

Warning
Location
scripts/query.py:13
Finding

Automatic Installation of Unpinned Third-Party Packages

Content
View full analysis

Vulnerability Details

File Location: scripts/query.py, lines 13–20
Vulnerability Type: Supply-chain exposure through automatic, unpinned dependency installation
Risk Level: Medium

Complete Code Snippet:

python
def ensure_akshare() -> None:
    clear_proxy_env()
    try:
        import akshare  # noqa: F401
    except ImportError:
        print("正在安装依赖 akshare pandas ...", file=sys.stderr)
        subprocess.check_call(
            [sys.executable, "-m", "pip", "install", "akshare", "pandas", "-q"]
        )

Related dependency declarations in requirements.txt, lines 1–2:

text
akshare>=1.14.0
pandas>=2.0.0

Technical Analysis

When akshare cannot be imported, the script automatically invokes pip to download and install akshare and pandas. This installation does not use the reviewed requirements.txt, exact version pins, package hashes, a lockfile, or an explicitly trusted package index.

The requirements file independently uses open-ended lower bounds, allowing any future compatible version to be selected. Consequently, the code actually executed by the Skill can change after review without changes to this repository.

There is no evidence that the current dependencies are malicious. The issue is the unsafe supply-chain mechanism: a compromised package release, compromised configured package index, dependency confusion condition, or malicious transitive dependency could introduce arbitrary code.

Attack Path

  1. An attacker compromises a permitted package release, a transitive dependency, or the package index configured for pip.
  2. The user invokes scripts/query.py in an environment where akshare is absent.
  3. ensure_akshare() automatically executes python -m pip install akshare pandas -q.
  4. Pip resolves packages without exact version or hash verification.
  5. Malicious installation hooks or imported package code execute under the invoking us ...[truncated 709 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove automatic package installation from runtime code. If dependencies are unavailable, exit with a clear setup instruction.
  2. Install dependencies through a separate, deliberate provisioning step.
  3. Pin every direct and transitive dependency to a reviewed exact version.
  4. Use a lockfile or a hash-verified requirements file and install with pip install --require-hashes.
  5. Configure an explicitly trusted package index or internally controlled package mirror.
  6. Perform dependency vulnerability and integrity scanning during release and deployment.
  7. Run the Skill in an isolated virtual environment with least-privilege filesystem and network access.
  8. Ensure runtime behavior uses the same reviewed dependency manifest rather than independently naming packages.

T09 · Insecure Skill Coding Practices

Note
Location
scripts/query.py:23
Finding

Unconditional Removal of Proxy-Related Environment Variables

Content
View full analysis

Vulnerability Details

File Location: scripts/query.py, lines 23–29
Vulnerability Type: Unsafe modification of network security configuration
Risk Level: Low

Complete Code Snippet:

python
def clear_proxy_env() -> None:
    """避免本地代理导致东方财富接口 403。"""
    import os

    for key in list(os.environ.keys()):
        if "proxy" in key.lower():
            del os.environ[key]

This function is invoked before dependency import or installation:

python
def ensure_akshare() -> None:
    clear_proxy_env()
    try:
        import akshare  # noqa: F401

Technical Analysis

The script deletes every environment variable whose name contains the substring proxy, regardless of whether it is a standard proxy setting or an unrelated application variable. This occurs unconditionally whenever the program starts.

Standard variables such as HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and NO_PROXY may enforce organizational routing, authentication, monitoring, filtering, or egress restrictions. Removing them can cause subsequent pip and AkShare requests to attempt direct network connections outside the operator's intended path. Substring matching also makes the operation broader than necessary.

This is a process-local environment mutation and does not modify the parent shell or establish persistence. Whether traffic can actually bypass a mandatory network control depends on controls outside the process, such as host firewalls and network-level egress policy.

Attack Path

  1. An operator configures proxy environment variables to route outbound traffic through an approved monitoring or filtering service.
  2. The user invokes scripts/query.py.
  3. ensure_akshare() calls clear_proxy_env() before package installation or market-data access.
  4. All environment variables containing proxy are removed from the process.
  5. Pip or AkShare attempts outbound communication without the configu ...[truncated 655 chars]
Remediation
View remediation

Remediation Suggestions

  1. Respect existing proxy environment settings by default.
  2. Remove the unconditional call to clear_proxy_env().
  3. If proxy disabling is operationally necessary, expose it as an explicit opt-in command-line option and document its security consequences.
  4. Restrict any opt-in behavior to specifically named standard variables rather than deleting names by substring.
  5. Prefer endpoint-specific client configuration over global process-environment mutation.
  6. Emit a warning and require confirmation before bypassing configured proxy routing.
  7. Preserve mandatory proxy use for dependency installation, especially when using an approved internal package mirror.
  8. Enforce network egress restrictions outside the process so application code cannot bypass them merely by changing environment variables.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (10)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/query.py (reported line 29)May include surrounding context.

python
"""避免本地代理导致东方财富接口 403。"""
    import os

    for key in list(os.environ.keys()):
        if "proxy" in key.lower():
            del os.environ[key]

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill instructs the agent to run local Python scripts, install dependencies, and access networked market data, but it declares no explicit tool/permission scope. Without an allowlist for shell, network, and environment access, the runtime may grant broader capabilities than users or reviewers expect, increasing the chance of unintended command execution, package installation, or data exfiltration if the skill or its dependencies are modified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

A read-only data query tool should not need to install software dynamically during execution. Runtime package installation expands the attack surface through dependency confusion, tampered mirrors, or unintended environment mutation, and it can surprise the operator by persisting changes outside the skill's stated purpose.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
96% confidence
Finding

The script invokes pip at runtime via subprocess to modify the Python environment. Even though the command arguments are static and not shell-injected, this still creates an unnecessary code-execution and supply-chain surface for a read-only market query skill, because package installation executes untrusted package artifacts and changes the host environment.

Content

Scanner excerpt · scripts/query.py (reported line 20)May include surrounding context.

python
import akshare  # noqa: F401
    except ImportError:
        print("正在安装依赖 akshare pandas ...", file=sys.stderr)
        subprocess.check_call(
            [sys.executable, "-m", "pip", "install", "akshare", "pandas", "-q"]
        )

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill performs subprocess-based package installation without a strong warning or explicit user approval, causing hidden environment changes and network activity. For an agent skill, this is risky because operators may expect a passive query tool, not one that executes package-management operations on the host.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script silently strips proxy-related environment variables, which changes network behavior without adequately informing the user. While likely meant to improve connectivity to the upstream market-data service, it can disable enterprise proxy enforcement and reduce visibility into outbound traffic.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency specification uses a lower-bound only constraint for akshare, which makes builds non-reproducible and allows future package releases to be installed without review. If a compromised or breaking upstream release is published, environments resolving this manifest could silently pick it up and introduce security or integrity risk.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
akshare>=1.14.0
pandas>=2.0.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The pandas requirement is also unpinned, so dependency resolution may install different versions over time depending on when and where the skill is deployed. This weakens supply-chain control and makes it harder to ensure vulnerable or incompatible releases are excluded.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
akshare>=1.14.0
pandas>=2.0.0

Unverifiable Dependency: pandas has 1 known advisory(ies) (CVE-2020-13091 (** DISPUTED ** pandas through 1.0.3 can unserialize and execute commands from an)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
83% confidence
Finding

The manifest does not pin pandas, and pandas has at least one historical advisory associated with some versions, so the actual installed version cannot be verified as safe from the manifest alone. In this skill's context, pandas is used for market-data handling rather than explicitly deserializing untrusted pickle content, which reduces immediate exploitability, but the lack of version control still leaves uncertainty and avoidable risk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script removes all proxy-related environment variables before making network requests, altering the host's network configuration for the current process without explicit consent. In context this appears intended to bypass 403 issues, but it still overrides operator security controls such as outbound routing, monitoring, or egress restrictions.

Content

No source excerpt is available for this finding.