[WP-G1] InsureDAOERC20#transferFrom()
Do not reduce approval on transferFrom if current allowance is type(uint256).max
#213
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
The Wrapped Ether (WETH) ERC-20 contract has a gas optimization that does not update the allowance if it is the max uint.
The latest version of OpenZeppelin's ERC20 token contract also adopted this optimization.
https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/InsureDAOERC20.sol#L152-L168
See:
Recommendation
Change to:
The text was updated successfully, but these errors were encountered: