Back to skill

Security audit

Behavioral Finance

Security checks for vulnerabilities and agentic risk

Overview

The skill does not show malware-like behavior, but it presents simulated and random trading analysis as actionable financial guidance.

Review this carefully before installing. It should be treated as demonstration-only financial logic unless the publisher adds real data-provider integration, provenance, deterministic calculations, reproducible backtests, and clear synthetic-data warnings. Do not connect it to automated trading or rely on its recommendations for real investment decisions in its current form.

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
behavioral_finance_skill.py:392
Finding
Fabricated Analysis Presented as Actionable Financial Guidance<![CDATA[ ## Vulnerability Details **File Location**: `behavioral_finance_skill.py:392-430`, `behavioral_finance_skill.py:440-441`, `behavioral_finance_skill.py:684-691`, `behavioral_finance_skill.py:721-723`, `behavioral_finance_skill.py:997-1015`, `behavioral_finance_skill.py:1088`, and `behavioral_finance_skill.py:1097` **Vulnerability Type**: Unvalidated synthetic data used for security-sensitive financial recommendations **Risk Level**: High ### Vulnerable Code The backtest operation returns fixed performance statistics rather than results calculated from market data: ```python backtest_results = { "strategy_type": strategy_type, "lookback_period": f"{lookback_days}天", "performance_metrics": { "total_trades": 42, "win_rate": 0.65, "avg_win": 0.048, "avg_loss": -0.022, "profit_factor": 2.83, "sharpe_ratio": 1.92, "max_drawdown": 0.098, "annualized_return": 0.36 }, ``` Pattern confidence is randomly generated and subsequently used to determine whether actionable signals should be returned: ```python confidence = np.random.uniform(0.4, 0.9) ``` Market-sentiment factors are also randomly generated: ```python sentiment_values = { "price_momentum": np.random.uniform(0.3, 0.8), "volume_anomaly": np.random.uniform(0.2, 0.7), "retail_sentiment": np.random.uniform(0.2, 0.9), "institutional_flow": np.random.uniform(0.3, 0.8), "news_sentiment": np.random.uniform(0.4, 0.9), "social_media_buzz": np.random.uniform(0.2, 0.8) } ``` Sentiment trends are selected randomly: ```python trends = ["上升", "下降", "震荡", "转折"] return np.random.choice(trends, p=[0.3, 0.3, 0.3, 0.1]) ``` Herding metrics, participant ratios, risk metrics, and reversal timing are generated without market observations: ```python return { "stock": stock_code, "sector": self.stock_sector_map.get(stock_code, "未知"), "herding_score": np.random.uniform(0.3, 0.9), "herding_type": np.ra ...[truncated 4218 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Integrate validated data sources** - Retrieve price, volume, fundamental, institutional-flow, news, and sentiment data from explicitly configured providers. - Validate instrument identifiers, timestamps, market sessions, data freshness, and observation coverage before analysis. - Reject requests when required source data is unavailable or stale. 2. **Remove random production decisions** - Eliminate `np.random` from production analysis and signal-generation paths. - If synthetic data is needed for demonstrations, require an explicit `demo_mode` flag and mark every result as synthetic. - Use a fixed random seed in tests so that test results are deterministic. 3. **Implement genuine backtesting** - Load historical observations for the requested lookback period. - Define entry, exit, slippage, transaction-cost, survivorship-bias, and corporate-action assumptions. - Calculate all performance metrics from executed simulated trades. - Return sample dates, trade records, data-source identifiers, and calculation assumptions. - Refuse to report performance when the sample size or data quality is insufficient. 4. **Add provenance to every result** - Include data-source names, retrieval timestamps, observation ranges, model versions, and calculation methods. - Clearly distinguish observed values, modeled estimates, and synthetic examples. - Prevent actionable output when provenance cannot be established. 5. **Validate recommendations** - Require minimum sample sizes and deterministic confidence calculations. - Apply schema validation and bounded numeric ranges to all user-controlled parameters. - Add explicit checks before generating position sizes or execution plans. - Keep execution disabled unless a separate, reviewed trading integration confirms the signal and risk constraints. 6. **Correct the documentation** - Remove claims of real-time data access and historical perfo ...[truncated 543 chars]
Vulnerability Patterns
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file consistently uses Chinese for the description, instructions, examples, and warnings, but does not indicate that the skill is region-specific or that users may opt into another language. This can violate a language/locale policy where skills must not force a specific language without user choice or documented justification.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This Python skill is entirely described in Chinese, and its user-facing outputs and labels throughout the file are also hard-coded in Chinese. The policy requires flagging language or locale constraints when a skill forces a specific language without offering the user a choice or documenting a justified region-specific limitation.

Static analysis

No suspicious patterns detected.