T09 · Insecure Skill Coding Practices
- Location
opensea-swaps/scripts/opensea-swap.sh:98- Finding
Credentialed Token Swap Executes Without an Enforced Confirmation or Dry-Run Gate
- Content
View full analysis
Vulnerability Details
File Location:
opensea-swaps/scripts/opensea-swap.sh, lines 98–104
Vulnerability Type: Unconfirmed irreversible financial operation
Risk Level: HighCode Snippet:
bash exec opensea swaps execute \ --wallet-provider "$WALLET_PROVIDER" \ --from-chain "$CHAIN" \ --from-address "$FROM_TOKEN_ADDRESS" \ --to-chain "$CHAIN" \ --to-address "$TO_TOKEN_ADDRESS" \ --quantity "$AMOUNT"Technical Analysis
After detecting wallet-provider credentials and accepting the token, amount, chain, and provider arguments, the script directly replaces itself with
opensea swaps execute. This operation can sign and submit an irreversible asset swap.The executable path does not require an explicit execution flag, interactive confirmation, separately issued authorization token, transaction simulation, quote review, spending limit, or slippage limit. Credential validation establishes that the wallet can perform the operation, but it does not establish that the wallet owner reviewed and approved the specific transaction.
The corresponding workflow in
opensea-swaps/SKILL.mddocuments direct execution and provides credential-safety guidance, but it does not impose a confirmation gate that the script enforces. Optional provider-side wallet policies may constrain the operation, but the script cannot rely on those policies being configured.Attack Path
- Wallet-provider credentials and an OpenSea API key are available in the execution environment.
- A calling agent or automated workflow invokes
opensea-swap.shwith a selected destination token, amount, chain, and optional wallet provider. - The script validates only that the required credentials are present.
- Without presenting a quote or requesting transaction-specific approval, the script invokes
opensea swaps execute. - The configured provider signs and submits the swap using the credentialed wallet.
This ...[truncated 858 chars]
- Remediation
View remediation
Remediation Suggestions
- Make quote-only or dry-run behavior the default.
- Require an explicit
--executeoption before any signing or submission can occur. - Before execution, display and verify the wallet address, source and destination assets, amount, recipient, chains, expected output, minimum output, fees, route, approvals, and slippage.
- Require interactive confirmation for terminal use. For non-interactive automation, require a separately generated, short-lived confirmation token bound to the exact transaction parameters.
- Enforce configurable maximum transaction values, slippage limits, token allowlists, recipient allowlists, and chain allowlists in the executable path.
- Simulate the transaction and reject it if the actual calldata, recipient, value, approvals, or expected asset movement differs from the reviewed quote.
- Encourage provider-side spending and recipient policies as defense in depth, without treating them as a substitute for transaction-specific consent.
