T09 · Insecure Skill Coding Practices
- Location
scripts/scaffold.sh:91- Finding
Payment Transactions Can Be Reused Across Restarts and Concurrent Requests
- Content
View full analysis
{ if (valid) { usedTxHashes.add(txHash.toLowerCase()); next(); } else { res.status(402).json({ error: "Payment not verified", hint: "Ensure USDC was sent to the correct address on Base", }); } }); } ``` ### Technical Analysis The scaffold tracks redeemed transaction hashes in an in-memory JavaScript `Set`. This state is lost whenever the process restarts, is redeployed, or runs in another worker or server instance. The transaction check and insertion are also non-atomic. Multiple concurrent requests can all execute `usedTxHashes.has()` before any asynchronous `verifyPayment()` call finishes. Each request can consequently verify the same transaction successfully and reach the protected endpoint before the transaction is recorded as used. A multi-process or horizontally scaled deployment makes the issue worse because each process maintains a separate set. ### Attack Path 1. The attacker makes one valid USDC payment and obtains its transaction hash. ...[truncated 888 chars]- Remediation
View remediation
