Back to skill

Security audit

Tearsheet Generator

Security checks for vulnerabilities and agentic risk

Overview

This skill is review-worthy because it generates trading leverage/configuration guidance while relying on unaudited Python code from a hard-coded local path outside the reviewed package.

Install only if you trust and control the external Backtests directory referenced by the skill, or replace it with a bundled/pinned implementation before use. Treat leverage, liquidation, and optimized-config outputs as analytical backtest material, not financial advice or live-trading instructions, and review output paths before allowing file writes or backtest runs.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T08 · Insecure Dependencies

Warning
Location
commands/generate-tearsheet.md:54
Finding
Untrusted External Module Import Through Hardcoded Search Path## Vulnerability Details **File Location**: `commands/generate-tearsheet.md`, lines 54-58 **Vulnerability Type**: Insecure dependency resolution and arbitrary local code execution **Risk Level**: Medium **Complete Code Snippet**: ```python import sys import pandas as pd sys.path.insert(0, '/Users/DanBot/Desktop/dev/Backtests') from backtesting.tearsheets.strategy_comparison_tearsheet import StrategyComparisonTearsheet ``` The dependency is also explicitly documented in `SKILL.md`, lines 101-110: ```text ## Dependencies - Python 3.10+ - pandas, numpy, matplotlib - StrategyComparisonTearsheet from backtesting.tearsheets ## Installation The skill uses the tearsheet generator at: `/Users/DanBot/Desktop/dev/Backtests/backtesting/tearsheets/strategy_comparison_tearsheet.py` Ensure this path is accessible or update the script paths accordingly. ``` ### Technical Analysis The implementation prepends a user-specific external directory to `sys.path` and then imports executable Python code from that directory. Because the inserted path has the highest module-resolution priority, Python will load `backtesting.tearsheets.strategy_comparison_tearsheet` from that location before normally installed packages. Python executes module-level statements during import. Therefore, the imported module does not need to wait for `StrategyComparisonTearsheet` to be instantiated: arbitrary statements placed at module scope execute immediately. The external component is not bundled with this project, version-pinned, integrity-checked, or otherwise authenticated, so its effective behavior cannot be established through an audit of this repository alone. This is an unsafe local dependency and supply-chain trust boundary. Exploitation requires an attacker to control or modify the referenced directory, or to induce the user to place an untrusted project there. ### Attack Path 1. An attacker obtains write access to `/Users/DanBot/ ...[truncated 1350 chars]
Remediation
## Remediation Suggestions 1. Bundle the required tearsheet generator in the Skill package so that the reviewed code is the code executed at runtime. 2. Alternatively, publish it as a trusted package and pin an exact version and cryptographic hashes in a lock file or requirements file. 3. Remove the `sys.path.insert(0, ...)` modification and use standard package imports from an isolated virtual environment. 4. Do not rely on a user-specific absolute path. Resolve packaged resources relative to the installed Skill only. 5. If loading a configurable local component is unavoidable: - Require an explicit trusted path rather than silently assigning highest import priority. - Resolve and validate the canonical path. - Reject directories writable by untrusted users. - Verify file ownership and permissions. - Verify the component against a pinned cryptographic digest or trusted signature before importing it. - Load it in a restricted subprocess with minimal filesystem, network, environment, and credential access. 6. Document the exact dependency source, supported version, expected digest, and update procedure. 7. Add automated tests that fail if module resolution escapes the packaged or locked dependency environment.
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The skill metadata and documentation promise a constrained reporting capability, but the described/observed behavior includes undeclared leverage simulation and optimization logic while lacking the advertised report-generation components. In an agent setting, this mismatch is dangerous because users or orchestrators may invoke the skill expecting passive analytics, while it instead influences trading-risk decisions or executes broader analysis than disclosed, undermining trust boundaries and safety review.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The invocation guidance says to use the skill broadly for strategy analysis or visual report generation without clear guardrails, preconditions, or limits. In an agent ecosystem, vague activation criteria can cause the skill to be selected in contexts involving sensitive trading data or decision support, increasing the chance that misleading outputs or undeclared behavior are trusted and acted upon.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest for the skill says it generates professional tearsheets and visual performance reports. This command's documented behavior includes executing an equivalent backtest in Nautilus Trader for accuracy validation and updating verification status in tearsheet outputs, which is a distinct verification/backtesting capability rather than report generation itself.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The command goes beyond the stated skill purpose of generating tearsheets/reports by instructing the agent to run a new backtest, apply leverage and stop-loss settings, and emit new configuration artifacts. This scope expansion is dangerous because users may invoke what appears to be a reporting skill but instead trigger strategy-modifying or execution-adjacent behavior based on parsed data, increasing the chance of unintended system actions.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The documentation states that the command generates optimized config, tearsheet, and report files but does not specify safe output paths, non-overwrite behavior, or user confirmation before writing artifacts. In an agent setting, this can lead to accidental clobbering of existing strategy files or reports, causing integrity loss and confusion about which results are authoritative.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The document provides actionable leverage, liquidation, and optimization guidance without explicit warnings about loss of capital, model limitations, or that formulas are approximations. In the context of a professional-looking performance-report skill, omission of risk disclosures increases the likelihood that users treat the content as endorsed operational advice rather than educational reference material.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The file contains position-sizing, drawdown-based leverage adjustment, and Kelly-based leverage recommendation logic that materially exceeds the manifest’s described tearsheet/reporting scope. Scope drift is dangerous here because an analysis/reporting skill may be reused by agents as if its embedded leverage logic were validated trading advice, leading to risky or automated capital-allocation decisions.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The fixed_position_size function claims to calculate size using risk_per_trade, but it ignores that parameter and simply returns equity multiplied by leverage. This can produce materially oversized positions while giving users false confidence that per-trade risk limits are being enforced, creating a direct path to severe financial loss if the formula is relied upon.

Description-Behavior Mismatch

Medium
Confidence
93% confidence
Finding
This section adds Hyperliquid-specific leverage tiers, liquidation calculations, and funding-rate guidance that go beyond a tearsheet generator’s stated purpose of producing performance reports and visualizations. In a reporting skill, embedding operational trading guidance can mislead downstream agents or users into using the skill for live leverage decisions without appropriate safeguards, increasing the chance of unsafe financial actions.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The document gives concrete leverage formulas, examples, and a 'safe leverage' function that can be interpreted as actionable trading guidance, but it does not clearly warn that real-world leverage can cause rapid liquidation, slippage-driven losses, or failure under changing market regimes. In the context of a tearsheet/reporting skill used for strategy analysis, this is more dangerous because users may treat the output as decision support and over-trust the computed leverage recommendation.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest describes generating professional tearsheets and visual performance reports, with MAE analysis and leverage recommendations as report content. However, this code also performs full leverage simulation and optimization across a grid of leverage values, including equity-curve simulation and Sharpe/Sortino/Calmar scoring, which is strategy-optimization functionality rather than mere report generation.

Missing User Warnings

Low
Confidence
88% confidence
Finding
The markdown instructs the agent to create a verification JSON and update the tearsheet without warning the user that local artifacts may be modified. In an agent setting, undocumented file writes can surprise users, overwrite prior results, or taint analysis outputs, especially when filenames are derived from strategy names and the workflow is presented as a verification step.

Missing User Warnings

Low
Confidence
91% confidence
Finding
The template includes click-to-copy clipboard behavior, but the warning is minimal and may not clearly communicate that data will be written to the user's system clipboard. While the action is user-initiated and low risk in this tearsheet/reporting context, unclear clipboard interaction can surprise users and may lead to accidental copying of sensitive strategy configuration data.

Context-Inappropriate Capability

Low
Confidence
80% confidence
Finding
This reference file is primarily presented as HTML/CSS templates for tearsheet generation, but it also embeds executable JavaScript that writes content to the user's clipboard via navigator.clipboard.writeText. Clipboard interaction is not an obvious requirement of generating performance-report templates and introduces an extra browser-side capability beyond passive report rendering.

Static analysis

No suspicious patterns detected.