Back to skill

Security audit

Stock Report Generator

Security checks for vulnerabilities and agentic risk

Overview

This A-share report skill is mostly coherent, but it needs review because it can write user-named files outside its intended report folder and its command-line generator produces sample financial reports that users could mistake for real analysis.

Install only if you understand it is a Chinese-language A-share analysis template/tool, not a verified investment adviser. Treat generated reports as informational drafts, verify all market data independently, avoid relying on the included CLI unless it is clearly connected to real data, and do not pass untrusted stock names or dates until path sanitization is fixed.

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)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_report.py:502
Finding

Path Traversal Through Unsanitized Report and Chart Paths

Content
View full analysis
str: """ 保存报告到文件 """ if output_dir is None: output_dir = os.path.expanduser( f"~/.openclaw/workspace/reports/stock/{self.stock_name}" ) os.makedirs(output_dir, exist_ok=True) date_str = self.date.replace("-", "") filename = f"{self.stock_name}_{report_type}_{date_str}.md" filepath = os.path.join(output_dir, filename) with open(filepath, 'w', encoding='utf-8') as f: f.write(report) return filepath ``` ```python # scripts/generate_report.py:729-747 if len(sys.argv) >= 4: stock_name = sys.argv[1] stock_code = sys.argv[2] report_type = sys.argv[3] # 午间复盘 / 全天复盘 date = sys.argv[4] if len(sys.argv) > 4 else None else: stock_name = "示例股票" stock_code = "000001.SZ" report_type = "全天复盘" date = None generator = StockReportGenerator(stock_name, stock_code) if date: generator.date = date ``` ### Technical Analysis The command-line values `stock_name` and `date` are accepted without validation. Both values are subsequently included in filesystem paths. In particular, `stock_name` is used as a directory component and again as part of the report and chart filenames. Python's `os.path.join()` does not enforce containment beneath the intended report directory. Inputs containing path separators or parent-directory components such as `../` can therefore cause the resulting path to resolve outside ` ...[truncated 2048 chars]
Remediation
View remediation
str: if not re.fullmatch(r"[\w -]{1,80}", value, flags=re.UNICODE): raise ValueError("Invalid stock name") if value in {".", ".."}: raise ValueError("Invalid stock name") return value safe_name = safe_stock_component(self.stock_name) safe_date = datetime.strptime(self.date, "%Y-%m-%d").strftime("%Y%m%d") destination_dir = (REPORT_ROOT / safe_name).resolve() if REPORT_ROOT not in destination_dir.parents: raise ValueError("Output path escapes the report root") destination_dir.mkdir(parents=True, exist_ok=True) filepath = (destination_dir / f"{safe_name}_{report_type}_{safe_date}.md").resolve() if destination_dir not in filepath.parents: raise ValueError("Output file escapes the report directory") ``` 6. Use exclusive creation mode (`x`) where overwriting is unnecessary, or require explicit authorization before replacing an existing report. 7. Apply the same validation and containment checks to the radar-chart path and to any caller-provided `output_dir`. ]]>

T08 · Insecure Dependencies

Note
Location
README.md:123
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README presents all user-facing instructions and descriptions exclusively in Chinese, which effectively forces a specific language for users without any opt-in or alternative. The policy allows locale constraints only when users are given a choice or when the restriction is clearly documented and justified, neither of which appears here.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill instructs the agent to save generated reports under ~/workspace/reports/stock/{股票名}/ and also generate a radar-chart image, which implies file-write capability, but the manifest does not declare any permissions or allowed-tools scope. Undeclared write behavior weakens least-privilege controls and can cause the runtime or reviewer to underestimate what the skill can modify, especially if user-controlled stock names are used in output paths.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This section provides concrete trading actions such as stop-profit/stop-loss levels, position sizing, entry timing, and hold/reduce/liquidate recommendations, but the skill does not present a prominent upfront financial-risk warning before these actionable instructions. That increases the chance users treat the output as authoritative investment advice and take risky actions without sufficient context, which is especially concerning because the skill is framed as a professional report generator with scoring and strategy modules.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire scoring guide is written only in Chinese and explicitly scoped to A-share stocks, with no indication that users may choose another language or locale. Under the stated policy, forcing a specific language or locale without opt-in is a natural-language policy violation unless clearly documented as a justified region-specific tool.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring claims support for arbitrary A-share stock review generation, but the implemented CLI flow only emits example reports populated with placeholders rather than stock-specific analysis. In a financial-analysis skill, this misleading representation increases the chance that users mistake demo output for genuine research, which can lead to harmful investment decisions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The executable path presents itself as an automatic stock report generator but actually produces polished reports from hard-coded sample/template data. In this skill context, that is dangerous because users may rely on fabricated or placeholder market analysis for financial decisions, creating a deception/integrity risk even without code execution or data exfiltration.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The file states the changelog format and versioning references entirely in Chinese, including links to Chinese-localized documentation, with no indication that language selection is optional. Under the policy, forcing a specific language without user opt-in can be a natural-language locale violation unless the regional constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.