Description:Description\
The buybackTokenByV2 function interacts with general Blast tokens and ERC20 standard tokens. However, it does not reset the approval to zero before setting a new approval.This results in failed transactions or reverts and incompatibility with tokens.
The safeApprove function has explicit warning:
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
Attack Scenario\
Initial State:
The contract has an allowance of 100 tokens set for the DEX router.
Buyback Operation:
The contract attempts to perform a buyback operation that requires an allowance of 200 tokens.
Approval Update:
The contract directly sets the new allowance to 200 tokens without resetting the previous allowance to zero.
the safeApprove call will fail, causing the entire buyback operation to revert.
Attachments
the approval should be reset to zero before setting a new approval
inputTokenCache.safeApprove(address(router), 0); // Reset approval to zero first
inputTokenCache.safeApprove(address(router), amountIn); // Set new approval
Github username: -- Twitter username: -- Submission hash (on-chain): 0x451f09f8ecfacda777b913e57dcea753a9586c889c1417009eb818fcd2b7be49 Severity: medium
Description: Description\ The
buybackTokenByV2
function interacts with general Blast tokens andERC20
standard tokens. However, it does notreset
theapproval
tozero
before setting anew approval
.This results in failed transactions or reverts and incompatibility with tokens.The
safeApprove
function has explicit warning:Attack Scenario\
Initial State: The contract has an allowance of 100 tokens set for the DEX router.
Buyback Operation: The contract attempts to perform a buyback operation that requires an allowance of 200 tokens.
Approval Update: The contract directly sets the new allowance to 200 tokens without resetting the previous allowance to zero.
the
safeApprove
call will fail, causing the entire buyback operation to revert. AttachmentsProof of Concept (PoC) File
Revised Code File (Optional)