Back to skill

Security audit

Agent Q Skills

Security checks for vulnerabilities and agentic risk

Overview

This documentation-only trading skill is coherent, but it can guide an agent into live crypto trades, forced position closes, background execution, third-party LLM sharing, and generated-code execution without enough safety gates.

Review this carefully before installing. Use only paper-trading or sandbox exchange accounts until you have verified configuration, risk limits, and kill-switch behavior. Do not run the orchestrator or trade examples with funded accounts unless you intentionally want live orders. Treat RBI-generated code and external PDFs/videos as untrusted, and avoid sending raw account positions or private strategy details to cloud LLM providers.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
ARCHITECTURE.md:426
Finding

Execution of AI-Generated Backtesting Code Without Verifiable Isolation

Content
View full analysis

Vulnerability Details

File Location: ARCHITECTURE.md:426-435
Vulnerability Type: Unsafe execution of generated code
Risk Level: High

Relevant snippet:

text
User Input (YouTube/PDF/Text)
    ↓
DeepSeek-R1 (strategy extraction)
    ↓
Strategy Code Generation (backtesting.py format)
    ↓
Code Runner Agent (sandboxed execution)
    ↓
Backtest Execution (historical data)

Related descriptions also appear in AGENTS.md:72-73, AGENTS.md:242, CLAUDE.md:177-182, and WORKFLOWS.md:181-189.

Technical Analysis

The documented RBI workflow accepts content from YouTube videos, PDF files, or arbitrary text, uses an external LLM to generate Python strategy code, and subsequently executes that generated code.

This creates a code-generation boundary in which untrusted source material can influence executable Python. Although the documentation describes the Code Runner Agent as sandboxed, the audited package contains only documentation. It does not include the Code Runner implementation or verifiable controls for:

  • Filesystem isolation
  • Network access restrictions
  • Environment-variable and credential isolation
  • Process and subprocess restrictions
  • Python import allowlisting
  • CPU, memory, and execution-time limits
  • Static validation of the generated abstract syntax tree
  • User approval before execution

LLM instructions are not a security boundary. A malicious document can contain prompt-injection content directing the model to produce Python with dangerous imports, filesystem operations, subprocess execution, or outbound network requests. Model-generated code may also be unsafe without deliberate malicious input.

Attack Path

  1. An attacker supplies or recommends a crafted YouTube video, PDF, or strategy description.
  2. The RBI agent submits the material to DeepSeek-R1 for strategy extraction.
  3. Embedded adversarial instructions influence the model to generate Py ...[truncated 1270 chars]
Remediation
View remediation

Remediation Suggestions

  • Execute generated code only inside an ephemeral, locked-down container or virtual machine.
  • Do not mount the repository, home directory, SSH configuration, wallet files, or .env into the execution environment.
  • Supply a minimal, purpose-specific environment with no trading or LLM credentials.
  • Disable outbound network access by default and allowlist destinations only when indispensable.
  • Run under an unprivileged UID with a read-only root filesystem and a dedicated writable temporary directory.
  • Apply strict CPU, memory, process-count, file-size, and wall-clock limits.
  • Block subprocess creation and dangerous modules such as subprocess, socket, ctypes, and unrestricted os functionality.
  • Parse generated code into an AST and permit only an explicit subset of imports, calls, and syntax required for backtesting.
  • Pin the backtesting runtime and dependencies to reviewed versions.
  • Display the complete generated code and require explicit user approval before execution.
  • Treat all video transcripts, PDFs, and strategy text as untrusted data rather than instructions.
  • Add adversarial tests proving that generated code cannot access environment variables, local secrets, the network, or host files.
  • Update the documentation to define the actual sandbox guarantees rather than relying on the unverified phrase “sandboxed execution.”

T09 · Insecure Skill Coding Practices

Warning
Location
WORKFLOWS.md:360
Finding

Unminimized Financial Position Data Sent to External LLM Providers

Content
View full analysis

Vulnerability Details

File Location: WORKFLOWS.md:360-373
Vulnerability Type: Sensitive financial data disclosure to a third-party AI service
Risk Level: Medium

Relevant snippet:

python
position = nf.get_position("BTC")

# Prepare prompt
system_prompt = "You are a trading analyst"
user_content = f"Current BTC position: {position}"

# Get AI analysis
response = model.generate_response(
    system_prompt,
    user_content,
    temperature=0.3,
    max_tokens=1000
)

Technical Analysis

The example retrieves the complete BTC position object and interpolates its unrestricted string representation into an LLM prompt. The configured model may be Anthropic, OpenAI, DeepSeek, Groq, Gemini, or another provider.

A complete exchange position object may include sensitive financial information such as position size, direction, entry price, leverage, unrealized profit or loss, account-related identifiers, or other provider-specific fields. The workflow does not apply an allowlist, redact identifiers, request user consent, or warn about provider retention and training policies.

External LLM use is consistent with the Skill's declared analytical functionality, but transmitting the entire object exceeds the minimum data required for many market-analysis tasks. An analysis may only require selected values, aggregated exposure, or public market data.

This finding does not establish that API keys or private keys are transmitted. The concern is the unnecessary disclosure of the full financial position object.

Attack Path

  1. The custom agent authenticates to the exchange through nice_funcs_hl.
  2. get_position("BTC") returns an account-specific position object.
  3. The complete object is converted to text through an f-string.
  4. ModelFactory.generate_response() submits that prompt to the configured model.
  5. For a cloud model, the position data leaves the local system and is processe ...[truncated 972 chars]
Remediation
View remediation

Remediation Suggestions

  • Replace serialization of the full object with an explicit field allowlist.
  • Send only values essential to the requested analysis, such as direction and a coarse PnL percentage.
  • Remove wallet addresses, account IDs, order IDs, exact balances, exact position sizes, and raw exchange responses.
  • Prefer public market data when account-specific information is not required.
  • Require explicit user consent before transmitting portfolio or position information to a cloud LLM.
  • Clearly identify which provider will receive the data and link to its retention and training policies.
  • Add a local-model-only mode for account-sensitive analysis.
  • Implement a centralized prompt-redaction layer in ModelFactory or immediately before provider calls.
  • Log only metadata about the request, not the sensitive prompt body.
  • Add tests ensuring private keys, API keys, wallet identifiers, and disallowed position fields cannot enter outbound prompts.
  • Revise the example to construct a minimized object rather than interpolating the raw response:
    python
    safe_position = {
        "symbol": position.get("symbol"),
        "direction": position.get("direction"),
        "pnl_band": classify_pnl(position.get("pnl_percentage")),
    }
    user_content = f"Analyze this minimized position summary: {safe_position}"
    
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (23)

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · README-claude.md (reported line 107)May include surrounding context.

md
## Maintenance

Update skill files as the system evolves:
- Add new agents to AGENTS.md
- Add new workflows to WORKFLOWS.md
- Update architecture in ARCHITECTURE.md

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · ARCHITECTURE.md (reported line 289)May include surrounding context.

pip install -r requirements.txt

Configure environment variables

cp .env_example .env

Edit .env with your API keys

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · WORKFLOWS.md (reported line 19)May include surrounding context.

pip install -r requirements.txt

Configure environment variables

cp .env_example .env

Edit .env with your API keys

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · WORKFLOWS.md (reported line 20)May include surrounding context.

pip install -r requirements.txt

Configure environment variables

cp .env_example .env

Edit .env with your API keys

text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documentation normalizes autonomous trading, forced position closure, and persistent output storage without prominent warnings that these actions can affect real funds and modify local state. In an agent skill context, users may execute components directly from the documented commands, so missing safety disclosures increases the chance of unintended live trading or destructive portfolio actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The RBI/backtesting descriptions state that strategies are extracted, code is generated, and execution occurs, but they do not warn that generated code execution can be unsafe even when described as part of research tooling. Because LLM- or document-derived code may be attacker-influenced, this creates risk of arbitrary code execution, data exfiltration, or environment compromise if users trust the docs and run it.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The run instructions say any agent can be executed directly or via the orchestrator, but they do not disclose that some agents may trade, access external services, open WebSocket/network connections, or write outputs. This is dangerous because a user following copy-paste documentation may trigger live actions or data changes without understanding operational and financial consequences.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The architecture states that agents may execute trades and the system supports autonomous operation, but it does not prominently warn that real orders can be placed against live accounts. In a trading skill connected to exchanges and private keys, lack of explicit disclosure increases the risk of unintended financial loss from misconfiguration, misunderstanding, or unsafe default deployment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The architecture describes sending prompts and market-related content to multiple third-party LLM providers, but does not clearly warn users about external data sharing. In a trading system, prompts may contain proprietary strategies, market views, or account-derived context, so undisclosed transmission to providers creates privacy, compliance, and confidentiality risks.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The risk-management section documents automatic closing of positions and pausing of trading, which are destructive account actions with real financial consequences, yet lacks a prominent warning or operator-consent model. In live trading, automatic liquidation or forced closure logic can trigger losses, tax events, or missed hedging if users do not fully understand the behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The architecture explicitly describes a pipeline where user-supplied content is transformed by an LLM into strategy code and then executed by a code runner. Even if intended for backtesting, this meaningfully expands the skill from trading analysis into arbitrary code-generation/execution, creating a strong code-execution attack surface if the sandbox is weak, misconfigured, or bypassed.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document's assurance that there is 'No eval() of user input' is misleading because it also describes user-driven strategy generation followed by code-runner execution. Direct eval is not required for exploitation; executing LLM-generated code derived from user content can still lead to arbitrary behavior, sandbox escape attempts, data access, or abuse of connected credentials and APIs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The run instructions tell a user to start the main orchestrator directly, but do not clearly disclose that it can trigger autonomous market actions. Because this repository is specifically for AI trading agents with optional trade execution, these commands could cause unintended live trades, financial loss, or API-funded activity if a configured environment is present.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This guidance describes autonomous execution, continued operation, and result writes, but does not prominently warn that running the system may place real trades or affect live accounts and on-disk data. In a trading-agent repository, omission of an operational safety warning materially increases the chance of a user launching live automation without understanding the consequences.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · CLAUDE.md (reported line 119)May include surrounding context.

md
### File Management
- **Keep files under 800 lines** - if longer, split into new files and update README
- **DO NOT move files without asking** - you can create new files but no moving
- **NEVER create new virtual environments** - use existing `conda activate tflow`
- **Update requirements.txt** after adding any new package

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README states that Claude will 'automatically load this skill when working with the trading system' without defining clear trigger boundaries or exclusion cases. In an agentic environment, overly broad activation language can cause the skill to be invoked in unrelated contexts, increasing prompt-scope bleed and the chance that trading-specific instructions influence tasks where they are unsafe or inappropriate.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The usage section tells users to 'just start working with the repository' and implies the skill will auto-detect when to apply, but it does not constrain activation with negative examples or safety guardrails. This can broaden the skill's effective scope, making unintended invocation more likely and potentially causing an assistant to over-apply privileged repo-specific guidance.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill explicitly documents live trading functions such as market_buy() for leveraged crypto exchanges without pairing them with prominent warnings, simulation-only defaults, or operator confirmation requirements. In a skill meant to guide an autonomous agent, this increases the chance that a user or downstream agent invokes real-money trades unintentionally, especially given the broader context of orchestration and optional trade execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The workflow includes concrete code for executing real leveraged trades against live exchange helpers without an explicit warning that these commands can place actual orders with real funds. In a trading-agent skill, this is especially risky because users may copy/paste examples directly, mistaking them for safe demos or paper-trading snippets, leading to unintended financial loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The emergency close-all example iterates through positions and closes them immediately, but the documentation does not warn that this can irreversibly liquidate live positions and realize losses instantly. Because this repository is explicitly for autonomous crypto trading, omission of that warning materially increases the chance of accidental execution during troubleshooting or experimentation.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% 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 · WORKFLOWS.md (reported line 558)May include surrounding context.

bash
# Activate your environment (e.g., conda activate your_env_name)

# Run with nohup
nohup python src/main.py > trading.log 2>&1 &

# View logs

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% 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 · WORKFLOWS.md (reported line 559)May include surrounding context.

bash
# Activate your environment (e.g., conda activate your_env_name)

# Run with nohup
nohup python src/main.py > trading.log 2>&1 &

# View logs

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The file states that agent results are stored and later details persistent files such as analysis JSON, decisions CSV, and historical trades CSV. Because this markdown file documents behavior that can affect user data and privacy through persistent local storage, it should disclose that outputs and trading history are written to disk.

Content

No source excerpt is available for this finding.