T09 · Insecure Skill Coding Practices
- Location
scripts/call_smells.py:43- Finding
Unbounded Server-Controlled USDC Payment Authorization
- Content
View full analysis
str: opt = pick_base_option(challenge) pay_to = opt["payTo"] amount = int(opt["maxAmountRequired"]) # USDC has 6 decimals nonce = "0x" + secrets.token_hex(32) valid_after = 0 valid_before = int(time.time()) + 3600 typed_data = { "types": { "EIP712Domain": [ {"name": "name", "type": "string"}, {"name": "version", "type": "string"}, {"name": "chainId", "type": "uint256"}, {"name": "verifyingContract", "type": "address"}, ], "TransferWithAuthorization": [ {"name": "from", "type": "address"}, {"name": "to", "type": "address"}, {"name": "value", "type": "uint256"}, {"name": "validAfter", "type": "uint256"}, {"name": "validBefore", "type": "uint256"}, {"name": "nonce", "type": "bytes32"}, ], }, "primaryType": "TransferWithAuthorization", "domain": { "name": USDC_NAME, "version": USDC_VERSION, "chainId": BASE_CHAIN_ID, "verifyingContract": USDC_ADDRESS, }, "message": { "from": wallet, "to": pay_to, "value": amount, "validAfter": valid_after, "validBefore": valid_before, "nonce": nonce, }, } account = Account.from_key(private_key) signed = account.sign_typed_data( typed_data["domain"], {"TransferWithAuthorization": typed_data["types"]["TransferWithAuthorization"]}, typed_data["message"], ) payload = { "x402Version": 1, "schem ...[truncated 3072 chars]- Remediation
View remediation
