Back to skill

Security audit

Perfect Storm Options

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent paper-trading spec, but it gives an autonomous trading agent broker credentials and order authority while leaving the paper-only boundary ambiguous.

Review carefully before installing. Use only paper Alpaca credentials, enforce the exact origin https://paper-api.alpaca.markets in executable code before every authenticated request, remove any live-trading toggle or confirmation bypass, and align all decision states so every skipped or rejected symbol is logged consistently.

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:425
Finding
Weak broker endpoint validation may expose Alpaca credentials to an attacker-controlled server## Vulnerability Details **File Location**: `SKILL.md:23-25`, `SKILL.md:73`, and `SKILL.md:425-435` **Vulnerability Type**: Improper validation of a security-sensitive network endpoint **Risk Level**: High ### Vulnerable Code ```text > **Paper trading only.** This skill must never execute against a live brokerage > endpoint. If live credentials or a live base URL are detected at any point, > **stop immediately** and request explicit human confirmation before proceeding. ``` ```text 2. Confirm APCA_API_BASE_URL == https://paper-api.alpaca.markets — halt if live ``` ```text ### Execution Checklist Before Any Order ``` ✓ BASE_URL contains "paper-api" — never "api.alpaca.markets" ✓ account.status == "ACTIVE" ✓ account.trading_blocked == false ✓ Buying power sufficient for order ✓ Position limit not exceeded (check open positions count) ✓ Order is LIMIT type ✓ client_order_id set to trace order in journal ``` ``` ### Technical Analysis The Skill provides inconsistent endpoint-validation requirements. The boot procedure requires exact equality with `https://paper-api.alpaca.markets`, while the execution checklist only requires that the configured URL contain the string `paper-api`. Substring matching is not a valid origin-validation mechanism. Attacker-controlled hosts such as `https://paper-api.attacker.example` or `https://attacker.example/paper-api` contain the required text but are not Alpaca endpoints. If the referenced broker helper implements the execution checklist literally, it could attach Alpaca authentication credentials to requests sent to an attacker-controlled server. The statement permitting execution to proceed after human confirmation when a live endpoint is detected also conflicts with the declared invariant that the Skill must never execute against a live brokerage endpoint. Network access and paper-account credentials are necessary for the declared paper-trading function, but access ...[truncated 1559 chars]
Remediation
## Remediation Suggestions 1. Parse the endpoint as a URL and require exact matches for all security-sensitive components: - Scheme: `https` - Hostname: `paper-api.alpaca.markets` - Effective port: `443` - No embedded username or password 2. Use an immutable allowlist containing only the exact origin `https://paper-api.alpaca.markets`. 3. Do not accept suffix, prefix, substring, path, wildcard, or regular-expression approximations of the hostname. 4. Disable cross-origin redirects or revalidate the destination origin before following every redirect. Never forward authentication headers to another origin. 5. Remove the human-confirmation exception for live endpoints. A paper-only Skill should reject live endpoints unconditionally. 6. Enforce paper mode inside the broker helper immediately before every authenticated request and order submission, rather than relying only on natural-language instructions. 7. Fail closed when the URL is missing, malformed, ambiguous, or cannot be normalized safely. 8. Add tests covering hostile values such as `paper-api.attacker.example`, `attacker.example/paper-api`, HTTP endpoints, alternate ports, user-information syntax, and cross-origin redirects. 9. Use paper-only API credentials with the narrowest permissions supported by the broker and ensure secrets are never included in journal output or error messages.

T09 · Insecure Skill Coding Practices

Warning
Location
risk_config_openclaw_best_practices.yaml:149
Finding
Live-trading toggle contradicts the Skill's paper-only security boundary## Vulnerability Details **File Location**: `risk_config_openclaw_best_practices.yaml:149-154`, related policy at `SKILL.md:23-25` **Vulnerability Type**: Unnecessary privileged operating mode and contradictory safety configuration **Risk Level**: Medium ### Vulnerable Code ```yaml safety: halt_on_data_error: true halt_on_broker_state_uncertain: true halt_on_abnormal_spread_expansion: true require_manual_toggle_for_live_trading: true allow_new_entries_when_agent_degraded: false ``` The related Skill policy states: ```text > **Paper trading only.** This skill must never execute against a live brokerage > endpoint. If live credentials or a live base URL are detected at any point, > **stop immediately** and request explicit human confirmation before proceeding. ``` ### Technical Analysis `require_manual_toggle_for_live_trading: true` implies that live trading is a supported state after a manual transition. This conflicts with the declared functionality and security boundary, which describe the Skill as paper-trading only. The setting creates an unnecessary capability beyond the minimum privileges required for strategy evaluation and paper execution. It also combines dangerously with the instruction to request confirmation after detecting a live endpoint: together, these controls can be interpreted as authorizing a transition to real-money trading instead of enforcing an immutable prohibition. A manual toggle is weaker than a hard technical boundary because it may be changed accidentally, through configuration drift, by an unauthorized configuration modification, or through an ambiguous agent interaction. The artifact does set top-level `mode: paper`, but it does not demonstrate that this value is immutable or validated immediately before every broker request. ### Attack Path 1. An operator, attacker, or compromised automation process modifies or activates the live-trading toggle. 2. Live Alpaca c ...[truncated 1091 chars]
Remediation
## Remediation Suggestions 1. Replace the live-trading toggle with an immutable setting such as: ```yaml safety: allow_live_trading: false ``` 2. Treat any live endpoint, live credential indicator, or non-paper account response as a fatal error that cannot be bypassed through conversational confirmation. 3. Validate `mode: paper` in executable code at startup and again immediately before every authenticated request or order submission. 4. Bind the client to the exact paper API origin in code instead of accepting a general environment-controlled base URL. 5. Use credentials provisioned specifically for a paper account and reject accounts that cannot be positively identified as paper accounts. 6. Remove all documentation suggesting that manual approval can authorize live execution. 7. If live trading is ever required, implement it as a separate Skill and deployment profile with independent review, credentials, authorization, monitoring, and explicit human approval for each order. 8. Add automated tests proving that configuration changes, environment variables, or user instructions cannot transition this Skill from paper to live mode.
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)

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The skill defines one state machine early on (`IGNORE`, `WATCHLIST`, `ARM_ENTRY`, `ENTER`, `EXIT`) but later mandates a different output schema (`ENTER | HOLD | EXIT | SKIP | WATCHLIST`). This inconsistency can cause downstream agents or orchestrators to mis-handle decisions, skip enforcement paths, or fail closed/open unpredictably, especially around pre-entry and rejection states.

Intent-Code Divergence

Low
Confidence
90% confidence
Finding
The workflow instructs gate failures to return `IGNORE` or `SKIP`, but `IGNORE` is not representable in the required decision object. In an automated trading pipeline, this ambiguity can lead to dropped records, incomplete journaling, or adapters coercing `IGNORE` into another action, weakening auditability and potentially bypassing controls tied to explicit `SKIP` logging.

Static analysis

No suspicious patterns detected.