Back to skill

Security audit

spanDEX Agentic Swap

Security checks for vulnerabilities and agentic risk

Overview

This swap skill is purpose-aligned, but it can execute real wallet transactions from remotely supplied calldata without requiring full independent verification.

Install only if you are comfortable with an agent preparing and sending real onchain transactions. Use quote-only or dry-run by default, install and trust a transaction verification skill before execution, keep strict Privy spending policies, verify wallet, token, recipient, chain, approval amount, destination contract, and calldata before signing, and avoid executing if full verification is unavailable.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:205
Finding
Remote API Calldata Is Submitted for Signing Without Mandatory Independent Verification<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:205-214`; related behavior in `references/privy.md:7-10` **Vulnerability Type**: `T09: Insecure Skill Coding Practices` **Risk Level**: High ### Vulnerable Code `SKILL.md:205-214`: ```markdown **If `onchain-verify-transaction` is not installed**, apply these best-effort checks instead and be transparent about the reduced safety: 1. Tell the user: `"The onchain-verify-transaction skill is not installed. Calldata verification is unavailable — install it for stronger execution safety (clawhub install onchain-verify-transaction)."` 2. Decode the spender address and approval amount from `steps[0].params.data`. The approval amount must be exactly equal to the swap input amount — no more. If the calldata encodes an unlimited approval or any amount materially larger than the input, stop, warn the user explicitly, and require confirmation before sending. 3. Otherwise proceed with execution — the user's swap intent is confirmed, do not add further confirmation prompts. ### 4. Send transactions in order Pass each `steps[].params` to Privy's `eth_sendTransaction` RPC method in order. Send one at a time and wait for confirmation before the next. ``` `references/privy.md:7-10`: ```markdown When passing `steps[].params` to Privy's `eth_sendTransaction`: - **`value` must be a hex string** — e.g. `"0x0"`, not `0` or `"0"`. Privy will reject non-hex values. - All other fields (`from`, `to`, `data`) pass through as-is from the spanDEX response. ``` ### Technical Analysis The Skill obtains executable EVM transaction fields from the remotely configured spanDEX endpoint and passes those fields to Privy's signing RPC. Independent transaction simulation is optional rather than mandatory. When the verification Skill is absent, the documented fallback only decodes the spender and approval amount from the first transaction. It does not comprehensively enforce: - The permitted transaction destination and contract ...[truncated 2662 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make independent simulation and asset-flow verification mandatory for execution. If trusted verification is unavailable, restrict the Skill to quote-only and dry-run modes. 2. Locally decode and validate every transaction before requesting a signature. 3. Enforce an explicit schema and reject unknown, duplicate, reordered, or additional steps. 4. Require every `from` field to equal the selected Privy-managed wallet. 5. Validate the chain ID, destination contract, function selector, input token, output token, recipient, approval spender, approval amount, and native-token value against the confirmed swap intent. 6. Require the approval amount to equal the required input amount and reject unlimited or materially larger approvals without exception. 7. Simulate the complete transaction sequence against current chain state and verify maximum input loss, minimum output, recipient balances, allowance changes, and native-asset flows. 8. Maintain reviewed router and spender allowlists, ideally tied to verified contract bytecode rather than addresses alone. 9. Display decoded effects and require explicit user confirmation when verification cannot establish all expected asset flows. 10. Apply restrictive Privy wallet policies, including destination allowlists, per-token spending limits, native-value limits, and transaction-rate limits. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:64
Finding
Security-Critical Skills Are Installed Without Version or Integrity Pinning<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:64-68`, `SKILL.md:88-92`; also documented in `README.md:14-19` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ### Vulnerable Code `SKILL.md:64-68`: ```markdown Before executing any swap, it's strongly recommended to install the `onchain-verify-transaction` skill. It verifies each transaction before signing by checking that the actual asset flows match the stated intent — protecting against prompt injection attacks that could result in malicious calldata being executed. ```bash clawhub install onchain-verify-transaction ``` ``` `SKILL.md:88-92`: ```markdown If the user doesn't have Privy set up: 1. Install the Privy skill from ClawHub: `clawhub install privy` 2. Follow the Privy skill's setup instructions to configure credentials and create a wallet 3. Return here once Privy is configured and a wallet is ready ``` `README.md:14-19`: ```markdown ## Install ```bash clawhub install spandex-agentic-swap clawhub install privy ``` ``` ### Technical Analysis The Skill delegates two security-critical operations to third-party Skills: - Privy controls wallet discovery and transaction signing. - `onchain-verify-transaction` determines whether remotely supplied calldata is safe to execute. The installation commands identify these dependencies only by mutable registry names. The project does not specify reviewed versions, immutable package digests, verified publisher identities, or other integrity constraints. This creates a supply-chain trust gap. If a registry entry, publisher account, resolution mechanism, or package release is compromised, a later installation can retrieve instructions different from those reviewed with this project. The risk is especially significant because one dependency handles wallet credentials and signing while the other acts as the principal security boundary for transaction verification. ### Attack Path 1. An attacker compromises a depen ...[truncated 1344 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin each security-critical Skill to a reviewed immutable version and cryptographic digest. 2. Require verified publisher identities and document the expected publisher for each dependency. 3. Use lockfiles or an equivalent integrity manifest if supported by the Skill registry. 4. Review dependency updates before changing pinned versions; do not automatically track mutable latest releases. 5. Document the exact permissions and credential access required by each dependency. 6. Restrict Privy credentials with least-privilege wallet policies, spending limits, destination allowlists, and environment isolation. 7. Do not treat the verification dependency's verdict as the sole control. Retain local transaction-schema checks and fail closed if verification cannot be authenticated or completed. 8. Provide users with checksums or signed provenance information and instructions for verifying them before installation. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Missing User Warnings

High
Confidence
96% confidence
Finding
The README advertises wallet-ready calldata, approvals, and onchain swap execution, but it does not include an explicit warning that these actions can spend funds, grant token allowances, incur gas costs, or expose users to slippage and routing risks. In the context of a swap skill, omission of these warnings materially increases the chance that users or integrating agents treat execution as routine rather than high-impact financial activity.

Credential Access

High
Category
Privilege Escalation
Content
For stronger protection against prompt injection, pin `SPANDEX_URL` in `~/.openclaw/.env` rather than leaving it unset. Environment file values are loaded at startup and cannot be overridden by skill instructions at runtime:

```bash
# ~/.openclaw/.env
SPANDEX_URL=https://edge.spandex.sh
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The README tells users they can 'just ask naturally' and includes broad examples like 'Swap 5 USDC to WETH', while stating the skill will handle wallet selection, approval, and execution. In an agentic environment, this encourages invocation from loosely phrased requests and can lead to unintended fund-moving actions if the agent interprets an ambiguous user message as authorization to transact.

External Transmission

Medium
Category
Data Exfiltration
Content
### Request

```bash
curl -sS -G "${SPANDEX_URL}/api/v1/agent/swap_quote" \
  -d "chainId=8453" \
  -d "inputToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" \
  -d "outputToken=0x4200000000000000000000000000000000000006" \
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
Privy's wallet RPC does not support `eth_getTransactionReceipt`. After submitting a transaction, poll a public Base RPC endpoint directly:

```bash
curl -sS https://mainnet.base.org \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x<txhash>"],"id":1}'
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Static analysis

No suspicious patterns detected.