T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:190
- Finding
- Unvalidated Signing of a Server-Controlled Solana Transaction## Vulnerability Details **File Location**: `SKILL.md`, lines 190–222 **Vulnerability Type**: Unvalidated signing and execution of an opaque, remotely supplied blockchain transaction **Risk Level**: High ### Vulnerable Code ```json { "swapTransaction": "base64-encoded-versioned-transaction...", "quote": { "inAmount": "...", "outAmount": "...", "platformFee": "..." }, "usage": { "platformFeeBps": 50, "defaultSlippageBps": 300, "note": "Sign the swapTransaction with your wallet and submit to Solana" } } ``` ```javascript import { VersionedTransaction, Connection } from "@solana/web3.js"; // 1. Get the transaction from ClawPump const res = await fetch("https://clawpump.tech/api/swap", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ inputMint: "So11111111111111111111111111111111111111112", outputMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", amount: "100000000", userPublicKey: wallet.publicKey.toBase58(), }), }); const { swapTransaction } = await res.json(); // 2. Deserialize, sign, and send const tx = VersionedTransaction.deserialize(Buffer.from(swapTransaction, "base64")); tx.sign([wallet]); const connection = new Connection("https://api.mainnet-beta.solana.com"); const txHash = await connection.sendRawTransaction(tx.serialize()); ``` ### Technical Analysis The Skill instructs the client to retrieve an opaque serialized transaction from `https://clawpump.tech`, decode it from base64, deserialize it, and immediately authorize it with the user's wallet. No validation is performed on the transaction's instructions, program IDs, account keys, recipients, token mints, transfer amounts, fee recipients, signer requirements, writable accounts, or expected balance changes. Base64 decoding and transaction deserialization are normal Solana operations and do not represent local shell-code execution. The vulnerability is the trust-boundary failure created by signing remotely c ...[truncated 1989 chars]
- Remediation
- ## Remediation Suggestions 1. Decode and inspect every transaction instruction before requesting a signature. 2. Allowlist the Solana program IDs required for the intended swap and reject all unexpected program invocations. 3. Verify that the transaction uses the requested input and output mints. 4. Enforce the requested maximum input amount and an independently calculated minimum output amount. 5. Validate all source, destination, fee-recipient, signer, and writable accounts against locally derived expectations. 6. Reject instructions that change authorities, approve delegates, close accounts, create unrelated accounts, or transfer unrelated assets. 7. Validate address lookup tables and all resolved account keys rather than inspecting only static message keys. 8. Simulate the transaction through a trusted RPC endpoint and compare predicted balance changes with the displayed quote. 9. Present a human-readable transaction summary and require explicit user confirmation before signing. 10. Bind quotes to transactions using a short-lived, integrity-protected quote identifier and verify all quoted parameters locally. 11. Use a narrowly funded, task-specific wallet instead of a primary wallet to limit the impact of a malicious transaction. 12. Treat the remote API response as untrusted even when HTTPS is used; TLS protects transport but does not protect against a compromised or malicious server.
