Back to skill

Security audit

A股短线交易决策 A Share Short Term Decision

Security checks for vulnerabilities and agentic risk

Overview

This A-share trading assistant mostly matches its stated purpose, but it needs review because an optional optimization command can read and overwrite caller-selected JSON files outside the skill directory.

Review this skill before installing. Use a virtual environment, pin dependencies if possible, avoid passing absolute or `..` paths to config options, and do not use `--apply-to-config` unless you have backed up the target config and intend to overwrite it. Treat generated stock recommendations as research signals, not instructions to trade.

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
README.md:31
Finding

Unpinned Third-Party Dependencies Create a Supply-Chain Risk

Content
View full analysis

Vulnerability Details

File Location: README.md, lines 31-35
Vulnerability Type: Unpinned and unverifiable third-party dependencies
Risk Level: Medium

Vulnerable Code

markdown
## Installation

```bash
pip install akshare pandas
text

### Technical Analysis

The documented installation command retrieves the latest available releases of `akshare` and `pandas` without version constraints, integrity hashes, or a lock file. Consequently, the code installed and imported at runtime can change after the Skill has been reviewed.

Python package installation may execute package-controlled build or installation logic. Runtime imports also execute package initialization code. Although no malicious dependency is embedded in the audited project, the absence of dependency pinning and integrity verification creates an avoidable supply-chain exposure.

### Attack Path

1. An attacker compromises a dependency release, its maintainer account, or the package distribution channel.
2. The attacker publishes a malicious or otherwise unsafe release under one of the expected package names.
3. A user follows the documented `pip install akshare pandas` command.
4. `pip` resolves the mutable latest release because no approved version or hash is specified.
5. Malicious code executes during package installation, package build, or subsequent import by the Skill.

### Impact Assessment

Dependency-controlled code executes with the privileges of the user installing or running the Skill. A compromised package could therefore access files and environment variables available to that user, make network requests, modify project artifacts, or manipulate the financial-analysis results produced by the application.

The scope is limited by the privileges and isolation of the Python environment. The project does not instruct users to install these packages with administrative privileges.
Remediation
View remediation

Remediation Suggestions

  1. Define exact, reviewed dependency versions in a requirements or lock file.
  2. Use hash verification, such as pip install --require-hashes -r requirements.txt.
  3. Generate reproducible lock data with an established dependency-management tool.
  4. Document the approved package index and disable unintended extra indexes to reduce dependency-confusion exposure.
  5. Regularly scan locked dependencies for known vulnerabilities and review updates before changing versions.
  6. Install and run the project in an isolated virtual environment or container with least-privilege filesystem and network access.

T09 · Insecure Skill Coding Practices

Warning
Location
subskills/config-optimization/optimize_from_aggressive.py:95
Finding

Unrestricted Configuration Paths Permit Arbitrary JSON File Reads and Overwrites

Content
View full analysis

Vulnerability Details

File Location: subskills/config-optimization/optimize_from_aggressive.py, lines 95-111 and 135-136
Vulnerability Type: Path traversal and unrestricted filesystem access
Risk Level: Medium

Vulnerable Code

python
parser.add_argument("--base-config", default="config.json", help="Base full config path")
parser.add_argument(
    "--aggressive-config",
    default="config_aggressive_optimized_full.json",
    help="Input aggressive full config path (or pure screener json)",
)
parser.add_argument("--analysis-period", default="2026-02-01 to 2026-02-12")
parser.add_argument("--apply-to-config", action="store_true", help="Overwrite base config with optimized full config")
args = parser.parse_args()

DATA_DIR.mkdir(parents=True, exist_ok=True)

base_path = (ROOT / args.base_config).resolve()
input_path = (ROOT / args.aggressive_config).resolve()

base_cfg = load_json(base_path)
input_cfg = load_json(input_path)

The resulting path is later used as an overwrite target:

python
if args.apply_to_config:
    save_json(base_path, optimized_full)

Technical Analysis

Both --base-config and --aggressive-config are attacker-influenced command-line arguments. Joining them with ROOT and invoking resolve() normalizes traversal but does not enforce that the resolved paths remain within the project directory. Python also discards the preceding path when the supplied component is absolute.

Therefore, inputs such as ../../outside.json or an absolute filesystem path are accepted. The script reads both resolved paths as JSON. When --apply-to-config is supplied, it replaces the file selected through --base-config with the generated configuration.

The read primitive is limited to files containing JSON objects because load_json() parses the file and later code expects dictionary behavior. Nevertheless, a selected JSON document can be incorporated into gener ...[truncated 1968 chars]

Remediation
View remediation

Remediation Suggestions

  1. Reject absolute paths for configuration arguments unless external files are an explicitly required and authorized feature.

  2. Resolve each candidate path and verify that it remains beneath an approved directory:

    python
    def resolve_project_path(raw_path: str) -> Path:
        if Path(raw_path).is_absolute():
            raise ValueError("Absolute paths are not permitted")
    
        candidate = (ROOT / raw_path).resolve()
        if not candidate.is_relative_to(ROOT):
            raise ValueError("Configuration path escapes the project directory")
        return candidate
    
  3. Prefer an allowlist of approved configuration filenames or restrict input files to a dedicated configuration directory.

  4. Validate the complete JSON schema before processing it, including expected object types and permitted keys.

  5. Do not copy unrelated top-level input data into generated reports or optimized configuration artifacts.

  6. Restrict --apply-to-config to the canonical project config.json path rather than allowing a caller-selected overwrite target.

  7. Use an atomic write through a securely created temporary file followed by replacement.

  8. Require explicit operator confirmation or a separate privileged workflow before modifying the active runtime configuration.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (21)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the actual behavior is risk-control or plan validation while the skill is marketed as generating real-data trading decisions, users may rely on outputs inappropriately and grant access under false expectations. In financial tooling, misleading functional claims are more dangerous because they can influence decisions and mask ancillary local file activity.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the actual behavior is risk-control or plan validation while the skill is marketed as generating real-data trading decisions, users may rely on outputs inappropriately and grant access under false expectations. In financial tooling, misleading functional claims are more dangerous because they can influence decisions and mask ancillary local file activity.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the actual behavior is risk-control or plan validation while the skill is marketed as generating real-data trading decisions, users may rely on outputs inappropriately and grant access under false expectations. In financial tooling, misleading functional claims are more dangerous because they can influence decisions and mask ancillary local file activity.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

If the actual behavior is risk-control or plan validation while the skill is marketed as generating real-data trading decisions, users may rely on outputs inappropriately and grant access under false expectations. In financial tooling, misleading functional claims are more dangerous because they can influence decisions and mask ancillary local file activity.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

If the actual behavior is risk-control or plan validation while the skill is marketed as generating real-data trading decisions, users may rely on outputs inappropriately and grant access under false expectations. In financial tooling, misleading functional claims are more dangerous because they can influence decisions and mask ancillary local file activity.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises commands that write logs and artifacts under data/ and may access environment/config state, but it does not declare any explicit tool scope such as allowed tools or permissions. This creates an avoidable capability gap where a reviewer or runtime may not clearly understand that file read/write and env access are required, increasing the risk of over-broad execution or misuse.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Line L32 explicitly requires '使用简洁中文', which is a natural-language locale constraint. The file does not indicate that this is an opt-in preference or a justified region-specific requirement, so it conflicts with the policy against forcing a specific language without user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file begins with a Chinese-only skill description and all subsequent operational instructions are written in Chinese, including the system prompt and output format. Because the skill does not offer an opt-in language choice or explain that it is restricted to a China-specific audience for policy reasons, this appears to impose a specific language/locale by default.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The configuration fixes execution to the Asia/Shanghai timezone, which is a locale-specific policy choice. For a general-purpose skill or scheduler, this can violate language/locale policy expectations unless the regional constraint is explicitly justified or made configurable.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The docstring states the script will store artifacts under data/, suggesting output is confined there. However, when --apply-to-config is used, the script writes optimized_full back to base_path, which is derived from a caller-supplied config path and is not limited to data/, creating a direct contradiction in documented intent versus actual behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest describes a short-term A-share trading decision skill focused on market sentiment, sector rotation, signal scoring, prediction logging, and next-day comparison. This file instead performs offline configuration tuning and persists multiple artifacts under data/, with an optional in-place overwrite of the base config, which is a materially different operational purpose from making trading decisions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file returns natural-language messages in Chinese, which imposes a specific language on users without offering opt-in or indicating that the skill is intentionally region-specific. That creates a language/locale policy concern under the rule for natural-language policy violations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file includes multiple user-visible messages in Chinese only, including no-recommendation and dependency-error responses. Because no language selection or explicit region-specific justification is present in this file, the skill appears to force a single locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The user-facing recommendation messages returned by the skill are fixed Chinese strings, and the file does not indicate that Chinese is optional, user-selected, or required for a specific regional deployment. This creates a language/locale policy concern because the skill effectively forces one language for end-user output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The generated report strings are written entirely in Chinese, including headings, labels, and recommendations. This imposes a specific language/locale on users without any opt-in or documented justification, which matches the language/locale policy violation criterion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill instructs the user to run a script that writes JSON artifacts into the repository's data/ directory, but the description does not warn about this side effect. While the behavior appears intended for the trading workflow, omission of write-side effects can mislead users and automation into modifying local state unexpectedly, which is a genuine safety and transparency issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The function appends prediction entries, including timestamps and full signal content, to decision_log.jsonl. This is a file write affecting persistent user/project data, but the code provides no confirmation prompt, print/log message, or explanatory comment/docstring warning that predictions will be stored on disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The call to ak.stock_zh_a_hist reaches an external data source to retrieve market history, which is a network operation. In this file there is no user-facing notice, prompt, or comment/docstring explaining that invoking comparison will contact an external service.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

This code makes multiple live AkShare network requests to fetch market and sector data, but the file provides no user-facing print/log message, confirmation, or explanatory comment/docstring near those operations indicating that external data access will occur. Because the file is a code file, external network calls that may transmit system or request metadata should include some visible disclosure unless already clearly documented elsewhere.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The scanning workflow invokes external AkShare endpoints repeatedly, including per-symbol historical lookups, but there is no confirmation prompt, user-facing log, or nearby explanatory comment warning that live external requests will be made. For code files, network operations lacking any visible disclosure are in scope when the behavior is not explicitly disclosed in the file.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.