Back to skill

Security audit

Multi-Agent Trading Debate

Security checks for vulnerabilities and agentic risk

Overview

This skill is a trading-decision workflow that may lead to real trade execution, but its safeguards and data-quality boundaries are too weak for that impact.

Review carefully before installing. Use this only as analysis support unless you add explicit human approval before any order, make simulation output non-actionable, require validated live market data, and document what prediction and TCA logs contain and how long they are retained.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/regime_detector.py:47
Finding
Fail-Open Regime Detector Produces Fabricated Actionable Trading Signals## Vulnerability Details **File Location**: `scripts/regime_detector.py:47-50, 83-99` **Vulnerability Type**: Unsafe fail-open behavior and fabricated fallback data **Risk Level**: High ### Vulnerable Code ```python if len(prices) < 20: return _simulation_mode(symbol) if not HAS_NUMPY: return _simulation_mode(symbol) ``` ```python def _simulation_mode(symbol): """Fallback when numpy not available.""" return { "regime": "TRENDING", "adx": 28.5, "trend_strength": "moderate", "signal": "follow", "symbol": symbol, "timestamp": datetime.utcnow().isoformat() + "Z", "candles_analyzed": 0, "mode": "simulation" } if __name__ == "__main__": symbol = sys.argv[1] if len(sys.argv) > 1 else "BTCUSDT" result = detect_regime([], symbol) print(json.dumps(result, indent=2)) ``` ### Technical Analysis The detector converts two failure conditions—fewer than 20 market candles and an unavailable NumPy dependency—into a plausible, actionable result of `TRENDING` with a `follow` signal and a fabricated ADX value of `28.5`. It does not return an error, an `UNKNOWN` regime, or a non-actionable `hold` signal. The command-line entry point always calls `detect_regime([], symbol)` with an empty dataset. Consequently, every ordinary CLI invocation deterministically enters simulation mode rather than analyzing market data. Although the output includes `"mode": "simulation"`, its primary fields have the same structure and actionable semantics as a genuine result. This is especially dangerous because `SKILL.md` describes regime detection as ADX and trend analysis and places its output before analyst review, judgment, position sizing, and possible trade execution. No documented control requires downstream components to reject simulation-mode results. ### Attack Path 1. An operator or automation invokes: ```bash python scripts/regime_detector.py BTCUSDT ``` 2. The CLI passes an em ...[truncated 1396 chars]
Remediation
## Remediation Suggestions 1. **Fail closed on missing inputs or dependencies.** Return a non-actionable result such as: ```python { "regime": "UNKNOWN", "signal": "hold", "error": "Insufficient validated market data" } ``` 2. **Exit with a nonzero status from the CLI** when valid OHLC data is unavailable. Do not silently replace production analysis with simulated values. 3. **Require actual market data as CLI input**, such as a validated JSON file or standard input containing at least the required number of candles. 4. **Place simulation behind an explicit flag**, such as `--simulate`, and ensure simulation output cannot be consumed by production execution components. 5. **Enforce downstream safeguards.** Trading judgment and execution components must reject results when: - `mode` is not `live`; - `candles_analyzed` is below the required threshold; - data provenance is absent; - data is stale or malformed; - the regime is `UNKNOWN`; or - an analysis dependency failed. 6. **Separate result schemas for production and simulation** or add an explicit `actionable: false` field that downstream code must validate. 7. **Add automated tests** confirming that empty, insufficient, malformed, stale, or nonnumeric candle data and unavailable dependencies can never produce actionable signals. 8. **Record data provenance and freshness**, including candle source, latest candle timestamp, timeframe, validation status, and analysis mode.
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared description presents a coordinated multi-agent trading decision system with specific operational triggers and a structured debate workflow. The provided code does not implement any of that behavior. Instead, it is a simple position sizing calculator that computes trade size and risk metrics from confidence, balance, and stop-loss values using a Kelly-based formula and fixed BTC price assumption. This is a materially different primary purpose, not merely a supporting detail of the described framework.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description presents a broad multi-agent trading decision framework with structured debate stages and multiple operational triggers. The supplied code only implements one narrow component: regime detection using ADX/trend heuristics, with a simulation fallback when data or numpy is unavailable. There is no evidence of cron handling, price-move trigger evaluation, manual request processing, analyst role separation, debate sequencing, judge verdict generation, or trade execution/hold control. While regime detection is mentioned as one stage of the declared flow, the actual code chunk is materially narrower than the declared primary purpose, so the description does not accurately represent what this code chunk actually does.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The skill explicitly directs users to execute trades and log prediction data, but it does not present a clear warning that using the skill can affect live positions or create persistent trading records. In a trading context, lack of explicit risk and data-retention disclosure can lead to unintended financial actions, unsafe automation assumptions, and silent storage of sensitive strategy or PnL information.

Intent-Code Divergence

Medium
Confidence
97% confidence
Finding
The script claims to classify market regime using ADX and trend analysis, but its executable path always calls detect_regime([], symbol), which guarantees simulation-mode output rather than real analysis. In a trading-decision skill, this can silently drive decisions with fabricated market state, creating a dangerous integrity failure even without code execution or direct data exfiltration.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The debate and verdict templates are written in Chinese, but the skill description does not say that the skill is specifically intended only for Chinese-speaking teams or offer an alternative language. That creates a locale/language policy concern because the skill appears to impose one language by default without user opt-in.

Natural-Language Policy Violations

Low
Confidence
85% confidence
Finding
This markdown file contains core role descriptions, message templates, and scheduling instructions primarily in Chinese, with no indication that users may choose another language or locale. Under the policy rule for natural-language violations, forcing a specific language without user opt-in is a reportable issue.

Intent-Code Divergence

Low
Confidence
90% confidence
Finding
The fallback docstring says simulation occurs when numpy is unavailable, but the code also simulates whenever fewer than 20 candles are provided. This mismatch can mislead operators into trusting outputs as real analysis when incomplete input silently triggers fabricated regime data, which is especially risky in an automated trading workflow.

Static analysis

No suspicious patterns detected.