Back to skill

Security audit

XAUUSD

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent automated metals-trading system, but it needs Review because unauthenticated dashboard clients can expose trading state and switch the system into live automated execution while key risk controls appear unreliable.

Install only in a demo or isolated environment until the WebSocket is bound to localhost or authenticated, mode changes require explicit local approval, port 3078 is not exposed, short-order execution is fixed, and risk controls are tested against live or sandbox broker events. Use least-privilege broker/API credentials and avoid enabling Mode 2 or Mode 3 with real funds until those issues are resolved.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (5)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
dashboard/websocket-feed.js:27
Finding

Unauthenticated WebSocket Clients Can Enable Fully Automated Trading

Content
View full analysis
{ this.clients.add(ws); console.log(`[WS-FEED] Client connected. Total: ${this.clients.size}`); // Send current state on connect ws.send(JSON.stringify({ type: 'snapshot', data: this.latestState })); ws.on('close', () => { this.clients.delete(ws); }); ws.on('message', (msg) => { try { const cmd = JSON.parse(msg); if (cmd.action === 'setMode') { bus.setMode(cmd.mode); } } catch (e) { /* ignore */ } }); }); ``` The resulting mode directly controls whether execution events place broker orders: ```js // automation/event-bus.js:169-186 setMode(mode) { const oldMode = this.systemMode; this.systemMode = mode; const modeNames = { 1: 'Advisory', 2: 'Semi-Automated', 3: 'Fully-Automated', 4: 'Risk-Off' }; logger.info(`MODE CHANGE: ${modeNames[oldMode]} → ${modeNames[mode]}`); this.publish(this.EVENTS.SYSTEM_MODE_CHANGE, { oldMode, newMode: mode, modeName: modeNames[mode] }); } isAutoMode() { return this.systemMode === 3; } ``` ```js // broker/order-manager.js:20-23 bus.on(EVENTS.EXECUTION_ENTRY, async (signal) => { if (!bus.isAutoMode()) return; await this.executeSignal(signal); }); ``` ### Technical Analysis The WebSocket service accepts connections and commands without authenticating the client, authorizing control privileges, validating the request origin, or restricting mode transitions. It also passes `cmd.mode` directly to the global event bus without checking that it is an allowed numeric mode. Sett ...[truncated 1722 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
dashboard/websocket-feed.js:29
Finding

Unauthenticated WebSocket Feed Discloses Sensitive Trading and Account State

Content
View full analysis
{ this.clients.add(ws); console.log(`[WS-FEED] Client connected. Total: ${this.clients.size}`); // Send current state on connect ws.send(JSON.stringify({ type: 'snapshot', data: this.latestState })); ``` ```js // Periodic full state broadcast this.broadcastInterval = setInterval(() => { if (systemState) { this.latestState = typeof systemState === 'function' ? systemState() : systemState; this._broadcast({ type: 'state', data: this.latestState }); } }, this.config.broadcastIntervalMs); ``` The supplied state includes positions, risk information, performance, alerts, strategy state, and market intelligence: ```js getFullState() { return { system: { mode: bus.getMode(), modeName: ['', 'Advisory', 'Semi-Auto', 'Full-Auto', 'Risk-Off'][bus.getMode()], uptime: process.uptime(), health: bus.getHealth() }, bias: { XAUUSD: this.biasEngine.getBias('XAUUSD'), XAGUSD: this.biasEngine.getBias('XAGUSD') }, prices: { XAUUSD: this.priceFeed.getPrice('XAUUSD'), XAGUSD: this.priceFeed.getPrice('XAGUSD') }, session: this.sessionEngine.getState(), macro: this.macroEngine.getState(), risk: this.riskEngine.getState(), volatility: { XAUUSD: this.volatilityEngine.getState('XAUUSD'), XAGUSD: this.volatilityEngine.getState('XAGUSD') }, performance: this.performanceEngine.getMetricsSummary(), positions: this.mt5.getOpenOrders(), news: this.newsMonitor.getState(), liquidity: { XAUUSD: this.liquidityEngine.getLiquidityMap('XAUUSD'), XAGUSD: this.liquidityEngine.getLiquidityMap('XAGUSD') }, alerts: this.riskAlert.getRecentAlerts(1 ...[truncated 1653 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
broker/mt5-connector.js:68
Finding

Short Trade Signals Are Incorrectly Submitted as Market Buy Orders

Content
View full analysis
0 ? takeProfits[0].price : undefined; const result = await this.connection.createMarketBuyOrder( symbol, lots, stopLoss, tp1, { comment: comment || 'metals-desk-os', clientId: `MDO_${Date.now()}`, slippage: this.config.slippage } ); ``` ### Technical Analysis The method derives an `actionType` from the requested direction, but never uses it. The connector unconditionally calls `createMarketBuyOrder()`, including when `direction` is `"short"`. For a short signal, the calculated stop loss is normally above the entry and the take-profit targets are below it. Submitting those levels to a buy order can result in broker rejection, invalid protective levels, or a long position that contradicts the trading signal. The local order record still stores the requested `direction`, potentially causing subsequent position-management logic to reason about the wrong side. ### Attack Path 1. The strategy produces a bearish bias and a valid short signal. 2. `OrderManager.executeSignal()` calls `mt5.openPosition()` with `direction: "short"`. 3. `openPosition()` computes a sell action type but does not use it. 4. The connector calls `createMarketBuyOrder()` unconditionally. 5. The broker either rejects the malformed order or opens a buy position instead of the intended sell position. 6. Local tracking records the order as short, potentially compounding the error during stop management and partial-close processing. ### Impact Assessment This flaw can cause direct financial loss in fully automated mode. Its scope includes every ...[truncated 315 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
core/risk-engine.js:32
Finding

Documented Exposure and Loss Limits Are Not Connected to Live Trade Results

Content
View full analysis
= this.config.maxConsecutiveLosses) { this._halt(`${this.state.consecutiveLosses} consecutive losses — trading halted for session`); } } else { this.state.consecutiveLosses = 0; } // Check daily loss limit const dailyLossPercent = Math.abs(this.state.dailyPnL) / this.state.dailyStartBalance; if (this.state.dailyPnL < 0 && dailyLossPercent > this.config.maxDailyLoss) { this._halt(`Daily loss ${(dailyLossPercent * 100).toFixed(1)}% exceeds ${this.config.maxDailyLoss * 100}% limit`); bus.publish(EVENTS.RISK_DAILY_LIMIT, { dailyPnL: this.state.dailyPnL, percent: dailyLossPercent }); } } ``` The pre-trade check uses daily P&L, but does not enforce aggregate open exposure: ```js // 8. Daily loss check if (this.state.dailyStartBalance > 0) { const dailyLossPercent = Math.abs(Math.min(0, this.state.dailyPnL)) / this.state.dailyStartBalance; if (dailyLossPercent > this.config.maxDailyExposure * 0.8) { checks.push({ check: 'daily_exposure', passed: false, reason: `Near daily limit: ${(dailyLossPercent * 100).toFixed(1)}%` }); passed = f ...[truncated 2237 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
core/execution-engine.js:135
Finding

Risk-to-Reward Validation Fails Open Because Take Profit Has the Wrong Type

Content
View full analysis
Remediation
View remediation
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
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
Findings (46)

YARA rule 'agent_skill_credential_exfiltration_webhook': AI agent skill credential harvesting followed by webhook or external exfiltration [agent_skills]

Critical
Category
YARA Match
Confidence
85% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · alerts/telegram-alert.js (reported line 11)May include surrounding context.

js
=========================================================================
// TELEGRAM ALERT — Trade & Risk Notifications via Telegram Bot
// ============================================================================

const bus = require('../automation/event-bus');
const { EVENTS } = bus;

class TelegramAlert {
  constructor(config = {}) {
    this.config = {
      botToken: config.botToken || process.env.TELEGRAM_BOT_TOKEN || '',
      chatId: config.chatId || process.env.TELEGRAM_CHAT_ID || '',
      enabled: config.enabled !== undefined ? config.enabled : true,
      ...config
    };
  }

  start() {
    if (!this.config.enabled || !this.config.botToken) {
      console.log('[TELEGRAM-ALERT] Disabled or not configured');
      return;
    }

    bus.on(EVENTS.ALERT_TRADE, (data) => this.send(this._formatTrade(data)));
    bus.on(EVENTS.ALERT_RISK, (data) => this.send(this._formatRisk(data)));
    bus.on(EVENTS.EXECUTION_SIGNAL, (data) => this.send(this._formatSignal(data)));

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 · README.md (reported line 92)May include surrounding context.

Create a .env file in the skill root:

bash
nano .env

Add the following (fill in your values):

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README explicitly instructs users to move from advisory mode to fully automated live execution, but it does not provide a clear warning that this can place irreversible real-money trades and cause financial loss. In the context of an autonomous trading skill, omission of a prominent risk disclosure materially increases the chance of unsafe deployment by users who may treat the system as routine automation rather than high-risk financial execution.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents a comprehensive automated trading OS focused on analysis and execution for XAU/USD and XAG/USD. However, the supplied code chunk is narrowly focused on centralized risk alerting: subscribing to predefined events, formatting alert messages, logging them, retaining alert history, and dispatching notifications to WhatsApp and Telegram. This is a materially different primary purpose from trade analysis/execution. Additionally, outbound messaging capabilities are not reflected in the declared purpose or permissions. While risk management is thematically related to a risk-first trading system, this specific code performs notification/alert routing rather than trading operations, so the description does not accurately represent this chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a full automated trading OS focused on analysis, risk, and execution for precious metals pairs. The supplied code chunk does not implement trading logic, market analysis, execution, or instrument-specific behavior. Instead, it is a communications component that listens for internal events and forwards formatted messages to Telegram. This is a materially different primary purpose and includes an undeclared external messaging capability using Telegram's API. While alerts could be a supporting feature within a larger trading system, this specific skill description does not accurately represent what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The supplied code chunk does not implement trading strategy execution, market analysis, or a multi-engine trading OS for XAU/USD and XAG/USD. Its concrete behavior is limited to registering event listeners for trade, risk, performance, and order-filled events, formatting notification text, and sending those notifications to a WhatsApp API using external credentials. While alerts could be a supporting feature of a trading system, the declared description presents the skill as the core automated trading OS, whereas this code is a distinct messaging/notification integration with undeclared outbound communications capabilities and different triggers/resources. Therefore the description does not accurately represent this code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The declared description presents the skill as a full institutional automated trading system for gold and silver, including continuous analysis and execution. The supplied code chunk does not perform market analysis, signal generation, order management, or execution. Instead, it is a narrow risk-control utility that monitors macroeconomic/news events, emits alerts, and blocks trading during configured windows around high-impact events. While this is plausibly a supporting subsystem inside a trading OS, the code chunk itself does not accurately match the declared purpose if evaluated on its own behavior. Therefore this should be flagged as a mismatch due to materially narrower and different actual functionality.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description presents a complete automated trading operating system with analysis and execution pipeline behavior. This code chunk is much narrower: it is a market data ingestion module. It reads price data from MetaAPI/MT5, manages candles and tick buffers, computes spread stats, and publishes events. It does not place trades, enforce risk controls, run strategy engines, or implement an end-to-end execution pipeline. While a price feed is a supporting part of such a system, the supplied code does not itself match the broad declared purpose, so this chunk is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents a comprehensive automated trading OS focused on precious-metals trading, continuous analysis, risk controls, and execution. The supplied code chunk instead is a narrow infrastructure component: a scheduler that emits periodic events and reports on a fixed UTC timetable. While such scheduling could support a larger trading system, this code by itself does not implement the declared trading functionality and adds a concrete triggering mechanism (cron schedules) not reflected in the declaration. Therefore the description does not accurately represent what this specific code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents the skill as a complete, fully automated trading OS with multi-engine analysis and execution capabilities for specific metals instruments. The supplied code chunk does not implement that overall behavior. Instead, it is a narrow support module focused on trading-session timing, event emission, and high/low level tracking. While this component could plausibly be part of a larger trading system, on its own it does not match the declared primary purpose of a full automated trading and execution pipeline. Therefore this is a description-to-code mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The description presents a broad, fully automated institutional trading OS with continuous analysis and execution capabilities. The supplied code chunk does not implement such a system; it implements only one supporting subsystem: active risk and position management. It monitors open orders, listens for price updates and risk halt events, executes partial closes on TP hits, moves stops to breakeven, trails stops, and can close all positions. These actions are related to trading, so the code is in-domain, but the declared purpose materially overstates the actual behavior and primary function of this specific chunk. Therefore this is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The description portrays a comprehensive automated trading operating system with continuous analysis and execution capabilities. The supplied code chunk is much narrower: it calculates higher-timeframe and intraday bias, conviction, and alignment for gold/silver symbols; reacts to liquidity sweep events via cooldown logic; emits bias update/flip/conflict events; and saves/loads local memory. These behaviors are consistent with a supporting analytical engine inside a larger trading system, but not with the full declared system-level purpose. There are no suspicious unrelated permissions or external resource accesses beyond local file persistence and an internal event bus. The mismatch is therefore a scope/material-purpose mismatch: the description overstates what this specific code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description portrays a complete automated trading operating system with continuous analysis and execution for specific precious-metal instruments. This code chunk is much narrower: it is a supporting performance engine focused on post-trade recordkeeping, metric calculation, reporting, and drawdown-based risk adjustment. While risk-first behavior is partially consistent, the main purpose materially differs from a full analysis/execution trading OS. The module also persists data to files and is symbol-agnostic, which further diverges from the highly specific declared purpose.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The method accepts a direction parameter and computes actionType, but it always calls createMarketBuyOrder, so a requested short trade will be executed as a long trade. In an automated trading system handling live positions, this can invert strategy intent, break hedging/risk controls, and cause immediate financial loss under normal operation without any attacker needing to do more than supply direction: 'short'.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest explicitly advertises fully automated trading, continuous execution, and a live broker connector, but it does not include any user-facing warning, consent gate, sandbox/default-safe mode, or clear disclosure of financial loss risk. In this context, the absence of safety messaging and control boundaries is dangerous because a user or host agent could enable autonomous order placement against real instruments without adequately understanding that the skill may place trades, incur losses, or amplify risk through continuous execution.

Content

No source excerpt is available for this finding.

Session Persistence

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

Or if building directly on claw1:

cd ~/.openclaw/agents/trader/agent/ mkdir -p metals-desk-os

(paste files into the directory)

text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README directs users to create a .env file containing broker, messaging, and AI API credentials, but it does not warn about secret leakage, file permissions, source-control exposure, or secure storage practices. Because these credentials can enable trading, messaging abuse, and third-party account access, weak handling could lead to account compromise or unauthorized actions.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill documents access to environment-based secrets and multiple external integrations, but it does not declare an explicit tool/permission scope. In a trading automation context, undeclared access increases the chance of over-privileged execution, secret misuse, or unexpected outbound connectivity beyond what a user reviewing metadata would reasonably expect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill explicitly supports semi-automated and fully automated live trading plus outbound messaging, but it does not present a clear warning about financial loss, autonomous execution risk, or external transmission of trading/account data. In this context, omission of these warnings is dangerous because users may enable automation or notifications without understanding that real funds and sensitive operational data are at risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation advertises a WebSocket feed exposing live prices, bias, positions, P&L, drawdown, and event logs without any warning about confidentiality or access control. In a trading environment, such a feed can leak sensitive account and strategy telemetry to local or network-adjacent parties if bound insecurely or consumed by untrusted clients.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · alerts/telegram-alert.js (reported line 59)May include surrounding context.

js
if (!this.config.enabled || !this.config.botToken) return;
    try {
      const axios = require('axios');
      await axios.post(`https://api.telegram.org/bot${this.config.botToken}/sendMessage`, {
        chat_id: this.config.chatId,
        text,
        parse_mode: 'HTML'

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code sends trade, risk, order, and performance data to an external WhatsApp API via axios.post, which transmits potentially sensitive operational data off-system. While failures are logged, there is no user-facing warning, confirmation, or explanatory comment/docstring disclosing that alert contents and recipient data will be sent to a third-party service.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The logger is configured to write to both console and a persistent file, and later the code logs every event's data payload. This creates a user-data and system-data logging behavior, but the file contains no visible warning comment or disclosure that event contents may be persisted.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Every published event is automatically persisted to memory and written to logs, including arbitrary payload data supplied by upstream components. In a fully automated trading system, those payloads can contain sensitive strategy state, account/risk information, broker responses, or market context; broad automatic logging increases the chance of confidentiality leakage through local files, console aggregation, or centralized log pipelines.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code opens, modifies, partially closes, and fully closes trading positions through broker API calls, which are safety-critical and potentially irreversible operations. Although it emits internal event-bus messages after actions or on errors, there is no direct confirmation prompt or explicit user-facing disclosure in this file before executing those operations.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.env_credential_access

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
alerts/telegram-alert.js:11

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
alerts/whatsapp-alert.js:11

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
automation/news-monitor.js:18