Missing approve(0) #141
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Lines of code
https://github.com/code-423n4/2022-05-sturdy/blob/main/smart-contracts/YieldManager.sol#L221
Vulnerability details
Impact
IERC20.approve() function is called only once without setting the allowance to zero. Some tokens, like USDT, require first reducing the address' allowance to zero by calling approve(_spender, 0). Transactions will revert when using an unsupported token like USDT
Proof of Concept
https://github.com/code-423n4/2022-05-sturdy/blob/main/smart-contracts/YieldManager.sol#L221
Tools Used
Manual review
Recommended Mitigation Steps
Use approve(_spender, 0) to set the allowance to zero immediately before each of the existing approve() calls.
The text was updated successfully, but these errors were encountered: