Back to skill

Security audit

Stock Research

Security checks for vulnerabilities and agentic risk

Overview

This stock-analysis skill is mostly purpose-aligned, but it automatically uses external market-data services and writes reports or logs to fixed local paths without enough user control.

Review before installing. Use it only if you are comfortable with third-party market-data requests, unpinned Python dependencies, and automatic report/log files. Prefer running it in a virtual environment and adjust output paths to a workspace you control before executing the quick-analysis scripts.

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
SKILL.md:108
Finding

Unpinned Third-Party Dependencies Permit Supply-Chain Code Execution

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:108-112
Vulnerability Type: Unpinned third-party dependency installation
Risk Level: Medium

Vulnerable Code

markdown
## Dependencies

```bash
pip install akshare pywencai pandas numpy scipy
text

### Technical Analysis

The installation instructions retrieve mutable, unpinned versions of five third-party packages. No lock file, exact version constraints, package hashes, or trusted package-index configuration is provided.

Python packages can execute code during installation and whenever imported. Consequently, a compromised future release, compromised package-maintainer account, dependency-confusion package, or malicious package-index response could introduce arbitrary code after the Skill has already been audited. The effective code executed by users is therefore not limited to the reviewed project files.

The named packages appear consistent with the Skill's stated purpose, and the audit found no evidence that they are currently malicious. The risk arises from the absence of reproducible and integrity-verified dependency resolution.

### Attack Path

1. An attacker compromises a listed package, one of its transitive dependencies, a maintainer account, or the package distribution channel.
2. The attacker publishes a malicious package version that remains compatible with the unconstrained installation command.
3. A user follows the documented `pip install` instruction.
4. `pip` resolves and installs the attacker-controlled release because no reviewed version or hash is required.
5. Malicious code executes during package installation or when the scripts import the package.
6. The payload operates with the same OS permissions and data access as the user running the installation or analysis.

### Impact Assessment

Successful exploitation could provide arbitrary Python code execution under the invoking user's account. The resulting access could i
...[truncated 412 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin every direct dependency to a reviewed exact version.

  2. Generate a lock file that also fixes all transitive dependency versions.

  3. Record and enforce package hashes, for example through a requirements file used with pip install --require-hashes.

  4. Install dependencies inside a dedicated virtual environment rather than the system Python environment.

  5. Explicitly configure an approved HTTPS package index and disable unintended extra indexes.

  6. Use automated dependency scanning and review updates before changing the lock file.

  7. Replace the current instruction with a reproducible command such as:

    bash
    python -m venv .venv
    .venv/bin/python -m pip install --require-hashes -r requirements.lock
    

    Provide the corresponding Windows activation or interpreter path where necessary.

T09 · Insecure Skill Coding Practices

Note
Location
quick_analysis.py:491
Finding

Hard-Coded Cross-Workspace Paths Can Overwrite Files Outside the Project

Content
View full analysis

Vulnerability Details

File Locations: quick_analysis.py:491-492, 557-558; quick_analysis_v2.py:655-656, 725-726
Vulnerability Type: Unsafe hard-coded output paths and unintended file overwrite
Risk Level: Low

Vulnerable Code

quick_analysis.py:491-492:

python
with open("D:/Users/yindb2/AppData/Roaming/mx/openclaw-home/yindb2/.openclaw/workspace/skills/stock-research/analysis_result.json", "w", encoding="utf-8") as f:
    json.dump(result, f, ensure_ascii=False, indent=2)

quick_analysis.py:557-558:

python
with open("D:/Users/yindb2/AppData/Roaming/mx/openclaw-home/yindb2/.openclaw/workspace/skills/stock-research/weekly_report.txt", "w", encoding="utf-8") as f:
    f.write(report_text)

quick_analysis_v2.py:655-656:

python
with open("D:/Users/yindb2/AppData/Roaming/mx/openclaw-home/yindb2/.openclaw/workspace/skills/stock-research/analysis_result.json", "w", encoding="utf-8") as f:
    json.dump(result, f, ensure_ascii=False, indent=2)

quick_analysis_v2.py:725-726:

python
with open("D:/Users/yindb2/AppData/Roaming/mx/openclaw-home/yindb2/.openclaw/workspace/skills/stock-research/weekly_report.txt", "w", encoding="utf-8") as f:
    f.write(report_text)

Technical Analysis

Both quick-analysis scripts write to absolute paths belonging to a specific user and workspace rather than to the directory containing the executing Skill. Opening these paths with mode "w" truncates an existing target before new content is written.

If the fixed directories exist and are writable, running either script can modify files outside the current project installation. The behavior violates workspace isolation, makes execution non-portable, and may overwrite reports owned by another installation. It also creates a link-following risk: if a local attacker can replace one of the target files with a symbolic link or similar filesystem redirection, the script may overw ...[truncated 1742 chars]

Remediation
View remediation

Remediation Suggestions

  1. Resolve default outputs relative to the script's own directory:

    python
    from pathlib import Path
    
    output_dir = Path(__file__).resolve().parent
    analysis_path = output_dir / "analysis_result.json"
    report_path = output_dir / "weekly_report.txt"
    
  2. If configurable output locations are required, accept an explicit output directory and validate its resolved path against an approved workspace root.

  3. Refuse to follow symbolic links for security-sensitive output files where supported.

  4. Write to a temporary file in the same directory and atomically replace the destination only after serialization succeeds.

  5. Prompt for confirmation or require an explicit overwrite option when a destination already exists.

  6. Apply the same path-handling implementation consistently to quick_analysis.py, quick_analysis_v2.py, run_analysis.py, and quant_selector.py.

  7. Add tests confirming that scripts do not create or modify files outside the selected project output directory.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (22)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The natural-language instructions and user-facing descriptions are written in Chinese, which effectively imposes a language/locale constraint. The file does not state that the skill is China-market-specific in a way that justifies a Chinese-only interaction policy, nor does it offer the user a language choice.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger conditions are overly broad and can cause the skill to activate for many generic stock-related requests without clear boundaries. Overbroad activation increases the chance that the agent will invoke file-writing behavior, external data workflows, or domain-specific instructions in contexts where they were not intended, which raises the risk of inappropriate actions or prompt-scope capture.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This JSON file contains user-facing natural-language values and narrative fields entirely in Chinese, including market descriptions and the final conclusion. Under the stated policy, forcing a specific language without an explicit user language choice or documented locale justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The package description is written entirely in Chinese and presents the skill as Chinese-language by default, with no indication that users can choose another language or locale. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script makes outbound requests to akshare for each candidate stock without clearly informing the user that third-party network access will occur. In an agent/skill context, silent external requests can expose usage patterns, queried stock identifiers, IP metadata, and create privacy/compliance issues, especially if users expect local-only processing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The pywencai query sends a market-related prompt to an external service without explicit disclosure or approval. In a skill environment, undisclosed third-party queries are risky because they can leak user intent, operational context, and network metadata, and they may violate platform expectations around transparent data handling.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file’s title and all user-facing output are written in Chinese, indicating the skill is designed to operate in a single language. There is no visible option, prompt, or configuration allowing the user to select another language or opt in to this locale constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script prints Chinese-only banners and later generates a fully Chinese report, making the locale behavior mandatory for all users. Because no alternative language path or explicit opt-in is present, this is a natural-language locale policy issue rather than a functional coding issue.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script writes output to hard-coded absolute filesystem paths under a user profile without any user consent, path validation, or configurability. In an agent skill context, unsolicited file writes can overwrite existing files, leak analysis artifacts into sensitive directories, or be abused as an unexpected persistence/modification primitive even if the payload here is only report data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script saves analysis results to a fixed local file without warning or confirmation. In a skill/agent environment, writing local files unexpectedly violates least surprise and can overwrite data, create unauthorized artifacts on disk, or place sensitive business outputs in a location the user did not approve.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script also writes the final report text to another hard-coded local path with no confirmation. Repeated fixed-path writes increase the risk of unintended modification of the local environment and make the skill behavior less transparent and less controllable for the user.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script writes JSON analysis output to a hard-coded user-specific path under the local filesystem without any manifest, runtime consent, or path validation. Even though the content appears to be a stock report, unauthorized local writes are a real security concern because they create persistent side effects, can overwrite existing files in that location, and normalize undeclared file-system access from a skill.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code performs a fixed-path file write without any user-facing disclosure before the side effect occurs. Silent persistence is risky in agent skills because users may assume analysis is ephemeral, while the skill is actually modifying local state and creating files that may contain sensitive operational data.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script writes a human-readable report to a fixed local path without justification or user approval. This is dangerous because a skill with undeclared write behavior can silently leave artifacts on disk, overwrite prior reports, and be repurposed to modify other files if the path or filename logic is later changed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The generated text report is saved to disk without prior notice or confirmation, creating an undisclosed side effect. In skill environments this weakens user trust and can lead to unintended storage of potentially sensitive or misleading output, especially when the location is predetermined and not user-controlled.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and all user-facing console output are written exclusively in Chinese, signaling a fixed language/locale for the skill. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This plain-text skill content forces a specific language/locale for all users, which matches the policy-violation category for language or locale constraints without user opt-in. There is no indication that the skill is region-specific or that users can choose another language.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill instructs the agent to update a persistent local record file after completing tasks, which is unrelated to the core stock-research function and creates unnecessary statefulness. Persistent record-keeping can leak user queries, analysis outputs, or operational history into local files that may later be read, exfiltrated, or inappropriately reused across sessions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module docstring and all user-facing prints are written solely in Chinese, effectively constraining the interaction language without any opt-in or documented locale limitation. This can violate language/locale policy when a skill does not provide user choice or justify the fixed locale.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The section header and comments at L441-L445 frame this step as acquiring technical signal statistics, which suggests direct computation or retrieval of those signals. However, L457-L460 states it is '推算/估算' based on constituent daily rises, so the documented intent of obtaining technical signals diverges from the actual heuristic approximation performed for part of the output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module description and subsequent user-facing strings are written entirely in Chinese, which imposes a specific language/locale on users without any opt-in or alternative. This is a natural-language policy issue because the skill does not provide a language choice or document a justified locale restriction.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The comment at L593 says this is a 'PE历史分位估算' (historical PE percentile estimate), but the implementation at L594-L596 uses percentileofscore(valid_pe, fundamentals['avg_pe']), which compares the current average PE against the current set of constituent PEs. That is not a historical percentile over time, so the documentation materially misstates what is being measured.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.