T09 · Insecure Skill Coding Practices
- Location
scripts/ai-cheese.ts:88- Finding
Remote Payment Instructions Can Trigger Unrestricted USDC Transfers
- Content
View full analysis
({})); console.error(`❌ Error ${firstTry.status}: ${err.error || 'Unknown'}`); process.exit(1); } const requirements = await firstTry.json(); const payTo = requirements.accepts[0].payTo; const amount = BigInt(requirements.accepts[0].maxAmountRequired); const amountUsd = Number(amount) / 1e6; console.log(` Payment required: $${amountUsd.toFixed(2)} USDC to ${payTo}`); // Step 2: Pay USDC const usdc = new ethers.Contract(USDC_ADDRESS, USDC_ABI, wallet); console.log(` Sending USDC...`); const tx = await usdc.transfer(payTo, amount); ``` The source of the payment response can also be changed through an environment variable: ```ts const SERVER = process.env.AICHEESE_SERVER || 'https://aicheese.app'; ``` ### Technical Analysis The script treats an HTTP `402` response as sufficient authorization for an irreversible blockchain payment. Both the recipient address (`payTo`) and token amount (`maxAmountRequired`) are taken directly from the remote response and passed to the USDC contract without enforcing a local transaction policy. The implementation does not validate: - Whether `payTo` is a valid and expected recipient for the selected user. - Whether the requested amount mat ...[truncated 2659 chars]- Remediation
View remediation
