Back to skill

Security audit

vbt-report

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a legitimate A-share backtesting report skill, but it has unsafe HTML and filename handling that could let crafted stock data execute browser code or write reports outside the intended output folder.

Install only in an isolated environment and run it on stock lists you trust. Keep outputs in a dedicated folder, avoid serving generated reports from an authenticated or privileged web origin, and consider fixing filename sanitization, HTML escaping, pinned dependencies, and offline Plotly bundling before production use.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/batch_report.py:318
Finding

Stored HTML and JavaScript Injection in Generated Reports

Content
View full analysis
// Data is inserted directly into an executable script context. var ROWS = {rows_json}; ``` ```javascript var sigText = r.signal || ''; var sigDisplay = sigText ? ('' + sigText + '') : '-'; html += '' + '' + r.code + '' + '' + r.name + '' + sigDisplay + '' + vbtV + '' + '' + r.best_name + '' + '' + statusCell + '' + ''; document.getElementById('table-body').innerHTML = html; ``` The individual report generator contains a second unsafe HTML interpolation path: ```python # scripts/report.py label = f"{ticker} {stock_name}" if stock_name else ticker html = f""" {label} - VectorBT 向量化回测分析报告 ...

{label} - VectorBT 向量化回测分析报告

... """ with open(out_path, 'w', encoding='utf-8') as f: f.write(html) ``` ### Technical Analysis Stock names, signal text, report filenames, strategy names, and other values originating from CSV/XLS input or external market-data services are embedded into generated HTML without context-sensitive escaping. `json.dumps()` produces valid JSON, but it does not make arbitrary strings safe inside an HTML `
Remediation
View remediation
`, `&`, U+2028, and U+2029. Prefer placing JSON in a non-executable element and parsing its `textContent`. 5. Validate tickers against the documented six-digit A-share format. 6. Treat names and signals from CSV files and external APIs as untrusted data. 7. Add a restrictive Content Security Policy that disallows inline scripts and event handlers. Use a nonce or external local script where scripting is required. 8. Add regression tests using payloads containing HTML tags, quotes, event handlers, ``, and encoded variants. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/batch_report.py:153
Finding

Output Directory Traversal Through Unsanitized Stock Names

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:37
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis
Remediation
View remediation

T03 · Remote Payload Retrieval and Execution

Warning
Location
scripts/report.py:513
Finding

Generated Reports Retrieve Executable JavaScript From an External CDN

Content
View full analysis
Remediation
View remediation
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)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill advertises and instructs use of capabilities that read local files, write HTML output, and make outbound network requests, but it does not declare any explicit tool scope or permission boundaries. In an agent setting, this can lead to overbroad execution where a caller is not clearly informed that running the skill may access local market data directories and contact external hosts automatically.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The markdown explicitly states that the report generator will automatically read local .day files and connect to external services, including a hard-coded TDX server and public APIs, without an explicit warning about those side effects. This is risky because users may trigger unintended data access or outbound connections simply by following normal usage instructions, which can leak metadata, violate policy, or surprise sandboxed environments.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The natural-language content of the skill is overwhelmingly Chinese, including the description, usage guidance, and parameter explanations, with no indication that users can choose another language. Under the language/locale policy rule, forcing a single language without opt-in can be a policy issue unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code generates per-stock HTML reports at report_path, and later the script writes index.html to the output directory. Although file generation is part of the script's purpose, there is no visible disclosure that existing files in the output location may be replaced or modified, and no confirmation or warning is shown before these writes occur.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The generated document sets lang="zh-CN" and all user-facing text in the script is Chinese, with no opt-in or alternate locale path. Under the policy, forcing a specific language without user choice is a natural-language locale violation unless clearly documented as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The script unconditionally creates the output directory with os.makedirs and later writes an index HTML file there. There is no explicit user warning in the code or docstring that running the script will modify the filesystem beyond the implied reporting behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains a natural-language locale setting in the generated HTML (lang="zh-CN") and the surrounding report content is written in Chinese. Under the policy rule, forcing a specific language/locale without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.