Back to skill

Security audit

港股美股监控

Security checks for vulnerabilities and agentic risk

Overview

The skill is a plausible market monitor, but its install command can modify system Python and its script writes state to a hard-coded local path.

Install only after reviewing the script and preferably changing the setup to use a virtual environment with pinned dependency versions. Be aware that it contacts Yahoo Finance for the configured tickers and writes a local JSON state file to /Users/apple/.openclaw/workspace/memory/stocks_monitor.json rather than the relative path shown in the docs.

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:14
Finding
Unpinned Dependencies Installed Outside an Isolated Environment<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:14` **Vulnerability Type**: Unsafe dependency installation and supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```bash pip3 install yfinance numpy --break-system-packages ``` ### Technical Analysis The installation instructions retrieve `yfinance` and `numpy` without version constraints or cryptographic hash verification. Consequently, the installed code depends on whichever releases the package index resolves at installation time rather than on versions reviewed with this skill. The `--break-system-packages` option also bypasses Python's externally managed environment protection. This can modify the system Python environment, conflict with operating-system-managed packages, and expand the effect of a compromised dependency beyond an isolated project environment. This does not establish that either named package is malicious. The vulnerability is the unsafe dependency-management process, which exposes installation to future compromised releases, malicious index configuration, or other supply-chain failures. ### Attack Path 1. An attacker compromises a referenced package release, its maintainer account, or a package index configured on the target system. 2. A user follows the documented installation command. 3. `pip3` resolves and downloads the attacker-controlled release because no reviewed version or hash is enforced. 4. Package installation hooks or later imports execute attacker-controlled Python code with the privileges of the user running the command. 5. Because system package protections are bypassed, the malicious or incompatible package can also affect other applications using the same Python environment. ### Impact Assessment Successful exploitation could execute arbitrary code with the installing user's privileges. Depending on that user's access, the attacker could read or modify user files, access available environment variables and credentials, make network ...[truncated 197 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Create and use a dedicated virtual environment instead of modifying system Python. - Remove `--break-system-packages` from the installation instructions. - Declare exact, reviewed dependency versions in a requirements or lock file. - Generate and verify cryptographic hashes, for example with `pip install --require-hashes -r requirements.txt`. - Configure an approved package index explicitly where deployment policy requires it. - Integrate dependency vulnerability and integrity scanning into release maintenance. - Document a controlled dependency-update process so upgrades are reviewed before publication. Example: ```bash python3 -m venv .venv . .venv/bin/activate python3 -m pip install --require-hashes -r requirements.txt ``` ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/monitor.py:159
Finding
Hard-Coded State Path Permits Unintended File Overwrite<![CDATA[ ## Vulnerability Details **File Location**: `scripts/monitor.py:159-169` **Vulnerability Type**: Unsafe fixed-path file write and symlink-following overwrite **Risk Level**: Low ### Vulnerable Code ```python # 保存状态 state = { 'last_update': datetime.now().isoformat(), 'stocks': {symbol: {'price': data['price'], 'change_pct': data['change_pct'], 'rsi': data['rsi']} for symbol, info, data, _ in results} } with open('/Users/apple/.openclaw/workspace/memory/stocks_monitor.json', 'w') as f: json.dump(state, f, indent=2) ``` ### Technical Analysis The script writes state to a developer-specific absolute path rather than the relative `memory/stocks_monitor.json` location documented in `SKILL.md`. The destination is not configurable, its parent directory is not safely created or validated, and the program uses a normal truncating file open without checking whether the destination is a symbolic link. Python's `open(..., 'w')` follows symbolic links and truncates an existing target. If another local user or process can control the destination file or a writable path component, it can redirect the write to another file accessible to the account running the monitor. The JSON content is not attacker-selected arbitrary text, which limits the practical overwrite payload, but truncation and replacement with monitor state can still damage a targeted file. On systems where this exact macOS path does not exist, the unconditional write instead raises `FileNotFoundError` after market data processing, causing a predictable availability failure. ### Attack Path 1. The monitor is run under an account that can write to the hard-coded destination. 2. An attacker with control over the destination directory replaces `stocks_monitor.json` with a symbolic link to another file writable by the monitor account. 3. The monitor reaches the state-saving operation. 4. `open(..., 'w')` follows the symbolic link and truncates the linked file. 5. The scri ...[truncated 819 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Replace the developer-specific absolute path with a configurable, platform-appropriate state directory. - Resolve the destination relative to an explicitly selected workspace rather than the current working directory. - Create the parent directory with restrictive permissions before writing. - Reject an existing destination that is a symbolic link. - Write to a temporary file in the same trusted directory, flush and synchronize it, then atomically replace the destination. - Apply restrictive file permissions, such as owner read/write only, where supported. - Handle persistence errors explicitly so that operators receive a clear failure message. - If the state is not required, allow persistence to be disabled. Example hardening pattern: ```python from pathlib import Path import os import tempfile state_dir = Path.home() / ".local" / "state" / "stock-monitor-hkus" state_dir.mkdir(mode=0o700, parents=True, exist_ok=True) state_path = state_dir / "stocks_monitor.json" if state_path.is_symlink(): raise RuntimeError("Refusing to write state through a symbolic link") fd, temporary_path = tempfile.mkstemp(dir=state_dir, prefix=".stocks-", text=True) try: with os.fdopen(fd, "w", encoding="utf-8") as handle: json.dump(state, handle, indent=2) handle.flush() os.fsync(handle.fileno()) os.chmod(temporary_path, 0o600) os.replace(temporary_path, state_path) finally: if os.path.exists(temporary_path): os.unlink(temporary_path) ``` ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
The documented behavior does not match the detected capabilities: the skill persists monitoring results to local storage without disclosure, while advertised features such as custom watchlists and alerts are not actually implemented. This mismatch is dangerous because users may grant trust based on the description while the skill performs additional local side effects they were not informed about.

Lp3

Medium
Category
MCP Least Privilege
Confidence
80% confidence
Finding
The skill appears to write a state file (`memory/stocks_monitor.json`) but does not declare any tool scope or permissions for file-writing behavior. Undeclared write capability weakens transparency and can surprise operators, making it harder to assess what the skill can modify on the local system.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The natural-language description, headings, and usage instructions are all in Chinese, and the file does not indicate that Chinese is optional or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. The policy for SQP-3 flags language or locale constraints when they are imposed without user opt-in or clear justification.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This file presents its title, comments, and runtime output in Chinese, including the main status lines shown to users. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation unless the tool is explicitly documented as region-specific or offers a language choice.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
This code persists stock monitoring data to a local JSON file, but there is no visible warning, confirmation, or explicit user-facing disclosure that a file will be created or overwritten at that path. For code files, file writes should not be silent unless the behavior is clearly disclosed or obviously integral to the skill's stated purpose.

Missing User Warnings

Low
Confidence
86% confidence
Finding
This markdown file describes installing and running a real-time market monitor using yfinance, which necessarily fetches data over the network, but it does not include any user-facing warning about external network access. Under the markdown variant of SQP-2, skills that may affect privacy or system/network behavior should disclose that behavior clearly.

Description-Behavior Mismatch

Low
Confidence
88% confidence
Finding
The manifest describes a market-monitoring skill focused on fetching prices and technical indicators, but this script additionally writes collected state to a fixed local path. Local persistence is not mentioned in the description and goes beyond pure monitoring/output behavior.

Static analysis

No suspicious patterns detected.