Back to skill

Security audit

Trade Executor

Security checks for vulnerabilities and agentic risk

Overview

This is a transparent crypto-trading skill, but it needs review because it can place real trades and its confirmation and stop-loss safeguards are underspecified.

Install only if you are comfortable giving an agent live trading authority. Use API keys with withdrawals disabled, least-privilege trading permissions, IP restrictions if available, and small limits. Require fresh order-specific confirmation for every submitted trade, verify stop-loss protection is active after execution, and prefer sandbox or dry-run testing before connecting real funds.

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
SKILL.md:31
Finding

Ambiguous Preauthorization Can Bypass Order-Specific User Confirmation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:31-40, with conflicting requirements at SKILL.md:117-123
Vulnerability Type: Authorization workflow inconsistency
Risk Level: High

Evidence

The following is an English translation of the relevant source section:

markdown
## Trigger Conditions

- The user explicitly requests that an order be placed.
- The market-monitor produces a signal and the user has granted prior authorization (`confidence ≥ 0.85`).

## Preconditions (all must be satisfied before execution)

1. The user has explicitly confirmed the trading intent.
2. All risk checks have passed.
3. The trading pair is in the allowlist.
4. The API key for the target exchange is configured and valid.

The security requirements later state:

markdown
## Security Constraints

- User confirmation is mandatory and cannot be skipped or automatically confirmed by code.
- exec = deny, write = deny.
- All trading records are written to the audit log by the gateway.
- Risk-control violations are automatically rejected and generate an alert.

Technical Analysis

The trigger conditions permit execution when market-monitor produces a signal with a confidence value of at least 0.85 and the user has granted prior authorization. However, the preconditions and security constraints require explicit user confirmation and prohibit automatic confirmation.

The specification does not define whether prior authorization satisfies the mandatory confirmation requirement. It also does not require a new confirmation tied to the final exchange, pair, side, order type, quantity, price, and total amount generated from the monitoring signal.

Because this Skill authorizes irreversible financial operations, an implementation may reasonably but unsafely interpret broad prior authorization as confirmation for every subsequent qualifying signal. No confirmation identifier, expiration period, immutab ...[truncated 1371 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require fresh, order-specific confirmation after all order parameters and risk checks have been finalized.
  2. Explicitly state that monitor preauthorization may initiate preparation of an order but cannot authorize submission.
  3. Bind confirmation to an immutable digest containing the exchange, pair, side, type, quantity, price or slippage limit, stop loss, take profit, and estimated amount.
  4. Assign every confirmation a unique identifier and short expiration period.
  5. Invalidate confirmation if any material order parameter changes.
  6. Require the user to confirm again after expiration, price deviation beyond an approved tolerance, or partial execution that changes the remaining strategy.
  7. Fail closed whenever confirmation state is missing, ambiguous, stale, or inconsistent.
  8. Record the confirmation identifier, parameter digest, timestamp, and final submitted parameters in the gateway audit log.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:48
Finding

Non-Atomic Protective Order Workflow Can Leave Executed Trades Without a Stop Loss

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:48-68, impl/binance.md:58-64, and impl/okx.md:85-97
Vulnerability Type: Inconsistent risk validation and non-atomic protective-order placement
Risk Level: High

Evidence

The following is an English translation of the relevant interface requirements:

markdown
[RISK CHECK] Verify each item before execution:
├── [ ] Is the trading pair in the allowlist?
├── [ ] Is the amount for one trade no more than 1,000 USDT?
├── [ ] Is today's trade count below 20?
├── [ ] Is today's accumulated loss below 500 USDT?
├── [ ] Is the operation safe and not a withdrawal, transfer, or permission change?
├── [ ] Has the user confirmed?
└── [ ] Has a stop loss been set?

Any failed item results in refusal to execute.

Required: exchange, pair, side (buy/sell), type (limit/market), quantity
Optional: price (required for limit orders), stopLoss, takeProfit

The Binance implementation places protection through a separate API request:

text
POST https://api.binance.com/api/v3/order/oco
Parameters:
  symbol
  side (SELL)
  quantity
  price (take-profit price)
  stopPrice (stop-loss trigger)
  stopLimitPrice (stop-loss limit price)

The OKX implementation also uses a separate algorithm-order request:

json
POST https://api.okx.com/api/v5/trade/order-algo
Body: {
  "instId": "{pair}",
  "tdMode": "cash",
  "side": "sell",
  "ordType": "oco",
  "sz": "{quantity}",
  "tpTriggerPx": "{takeProfit}",
  "slTriggerPx": "{stopLoss}"
}

Technical Analysis

The mandatory risk checklist requires a stop loss, but parameter validation declares stopLoss optional. This contradiction permits an implementation to accept and submit an order without a stop-loss value even though the risk policy states that such an order must be rejected.

In both exchange implementations, the primary order and its protective OCO or algorit ...[truncated 1898 chars]

Remediation
View remediation

Remediation Suggestions

  1. Make stopLoss a required parameter for every order covered by the mandatory risk policy.
  2. Reject the trade before confirmation if the stop-loss value is absent, nonnumeric, incorrectly oriented relative to the entry price, outside permitted bounds, or incompatible with exchange precision rules.
  3. Include the stop-loss parameters and estimated maximum loss in the order-specific confirmation prompt.
  4. Prefer exchange-supported atomic or attached protective-order functionality where available.
  5. If protection requires a second request, do not report full success until the exchange confirms that the protective order is active.
  6. Define bounded retries for transient failures and query the exchange before retrying to prevent duplicate orders.
  7. Implement a fail-closed compensating procedure. If protection cannot be established, cancel any unfilled entry quantity and close filled exposure according to a preapproved emergency policy.
  8. Reconcile protective quantity after partial fills and verify that the entire executed position is covered.
  9. Record the primary order ID, protective order ID, protection status, failure reason, retry history, and compensating action in the audit log.
  10. Alert the user immediately and prominently whenever the primary trade succeeds but protection is not confirmed.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (9)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill title and core instructional text are written in Chinese, including the required confirmation flow, without indicating that users may choose another language. This creates a language policy concern because the skill appears to require a specific locale for operation rather than offering opt-in or alternatives.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The document gives concrete instructions for placing authenticated live Binance orders and OCO orders but does not include an explicit warning that these actions execute real trades with financial consequences. In the context of an agent skill that can act on user requests, this omission increases the chance of unintended or insufficiently confirmed execution, which can directly cause monetary loss.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · impl/binance.md (reported line 17)May include surrounding context.

下单请求

text
POST https://api.binance.com/api/v3/order
Headers:
  X-MBX-APIKEY: ${BINANCE_API_KEY}
  Content-Type: application/x-www-form-urlencoded

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · impl/binance.md (reported line 68)May include surrounding context.

下单请求

text
POST https://api.binance.com/api/v3/order
Headers:
  X-MBX-APIKEY: ${BINANCE_API_KEY}
  Content-Type: application/x-www-form-urlencoded

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This implementation documents live trade placement, order status checks, and OCO stop-loss/take-profit actions against a real exchange, but it does not include an explicit warning that these operations affect actual account funds or require strong user confirmation. In a trading-execution skill, omission of that warning increases the chance of unintended real-money transactions, especially if another layer fails to enforce confirmation consistently.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · impl/okx.md (reported line 29)May include surrounding context.

下单请求

text
POST https://api.okx.com/api/v5/trade/order
Headers:
  OK-ACCESS-KEY:        ${OKX_API_KEY}
  OK-ACCESS-SIGN:       {signature}

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · impl/okx.md (reported line 76)May include surrounding context.

下单请求

text
POST https://api.okx.com/api/v5/trade/order
Headers:
  OK-ACCESS-KEY:        ${OKX_API_KEY}
  OK-ACCESS-SIGN:       {signature}

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · impl/okx.md (reported line 91)May include surrounding context.

下单请求

text
POST https://api.okx.com/api/v5/trade/order
Headers:
  OK-ACCESS-KEY:        ${OKX_API_KEY}
  OK-ACCESS-SIGN:       {signature}

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The skill documents the names of environment variables containing Binance API credentials but provides no guidance on secret handling, logging restrictions, or exposure risks. In a trading skill, leaked API keys can enable unauthorized account access or trade execution depending on key permissions, making undocumented secret hygiene a real security concern.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.