Back to skill

Security audit

Stock Analyzer

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a normal stock-analysis tool, but it needs review because user-supplied stock symbols can affect where report and chart files are written.

Review before installing. Use a virtual environment, pin dependencies yourself, and avoid running this with elevated privileges. Only pass ordinary ticker symbols until the package validates symbols and guarantees report/chart paths stay inside the configured output directory.

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
install.sh:21
Finding

Unpinned Third-Party Dependencies Create a Supply-Chain Risk

Content
View full analysis
/dev/null if [ $? -ne 0 ]; then echo "⚠️ 需要安装依赖库" echo "运行: pip install yfinance pandas numpy matplotlib scikit-learn" fi ``` The documentation similarly instructs users to install unpinned packages: ```bash pip install yfinance pandas numpy matplotlib ``` ### Technical Analysis The project recommends installing `yfinance`, `pandas`, `numpy`, `matplotlib`, and `scikit-learn` without version constraints, integrity hashes, or a reviewed lock file. Consequently, the code installed by a user can differ from the code that existed when this skill was audited. Python packages and their transitive dependencies may execute code during installation or when imported. If a future package release or transitive dependency is compromised, removed and replaced, or introduces malicious behavior, users following these instructions could install attacker-controlled code. The installer does not automatically execute `pip`, which limits direct exposure, but it explicitly directs users to run the unsafe command. No evidence was found that the named packages are currently malicious. The vulnerability is the absence of dependency pinning and integrity verification. ### Attack Path 1. An attacker compromises a listed package, one of its transitive dependencies, or the associated package-publishing account. 2. The attacker publishes a malicious release under the legitimate package name. 3. A user installs the skill and sees the command printed by `install.sh`, or follows the installation command in `SKILL.md`. 4. The user runs the unpinned `pip install` command. 5. Package ...[truncated 725 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
source/stock_analyzer.py:274
Finding

User-Controlled Stock Symbol Is Used in Report and Chart Paths Without Sanitization

Content
View full analysis
Remediation
View remediation
str: if not SYMBOL_PATTERN.fullmatch(symbol): raise ValueError("Invalid stock symbol") return symbol ``` 2. Convert the validated symbol into a dedicated safe filename component rather than reusing raw command-line input. 3. Resolve the base directory and candidate destination, then verify that the candidate remains beneath the base directory: ```python base_dir = Path(config["output_dir"]).expanduser().resolve() base_dir.mkdir(parents=True, exist_ok=True) candidate = ( base_dir / f"{safe_symbol}_report_{datetime.now():%Y%m%d}.md" ).resolve() if candidate.parent != base_dir: raise ValueError("Output path escapes the configured report directory") ``` 4. Apply the same centralized path-construction function to both Markdown reports and PNG charts. 5. Consider refusing to overwrite existing files or using safely generated unique filenames if preserving prior reports is required. 6. Add tests covering `../`, absolute paths, nested separators, Windows path syntax, excessively long symbols, and valid international ticker suffixes. ]]>
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · install.sh (reported line 10)May include surrounding context.

sh
echo "📈 正在安装 stock-analyzer..."

# 复制文件到 OpenClaw 技能目录
mkdir -p ~/.openclaw/skills/stock-analyzer
cp -r "$SKILL_DIR/source/"* ~/.openclaw/skills/stock-analyzer/
cp "$SKILL_DIR/SKILL.md" ~/.openclaw/skills/stock-analyzer/
cp "$SKILL_DIR/skill.json" ~/.openclaw/skills/stock-analyzer/

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Natural-language strings in the module docstring and user-facing output are presented in Chinese, while the tool does not clearly offer a general language opt-in for its interface. Under the language/locale policy, forcing a single language without user choice can be a policy violation unless the locale restriction is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The CLI help and argument choices advertise two forecasting methods, 'linear' and 'prophet', implying behavior selection by user input. However, cmd_predict unconditionally calls predict_price, and predict_price hard-codes sklearn LinearRegression with no branch for a Prophet-based model, so the documented interface contradicts actual behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The natural-language content of the skill description, usage guidance, and safety notes is almost entirely presented in Chinese, which can functionally force a specific language on users. The file does not offer an English alternative, opt-in language selection, or explain that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

This shell script contains user-facing comments and terminal output exclusively in Chinese, including installation status and usage guidance. That can violate a language/locale policy when the skill does not provide user opt-in or document that it is intended only for Chinese-speaking users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The code writes a markdown report into the configured output directory, which affects the user's filesystem. Although the save path is printed after the write succeeds, there is no prior disclosure in the CLI help, comments, or docstrings warning that running the analyze command will create report files by default.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The exception handler behaves as if a verbose mode exists by checking args.verbose before printing a traceback. But no --verbose argument is defined in the parser, so the code's implied documented behavior for detailed error output is inconsistent with the actual CLI definition and can itself raise an AttributeError during error handling.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.