Closed sherlock-admin closed 1 year ago
3 comment(s) were left on this issue during the judging contest.
panprog commented:
invalid, because the lines quoted are for Lender's own ERC20 implementation, not some unknown ERC20 token
tsvetanovv commented:
I don't think we have a problem here
MohammedRizwan commented:
invalid issue
alymurtazamemon
medium
Did not Approve to Zero First
Summary
Allowance was not set to zero first before changing the allowance.
Vulnerability Detail
Some tokens (e.g.
USDT
,KNC
) do not allow approving an amount M > 0 when an existing amount N > 0 is already approved. This is to protect from an ERC20 attack vector described here.The following attempts change the allowance without setting the allowance to zero first:
Lender.sol - Line 182
Lender.sol - Line 322
Lender.sol - Line 337
Lender.sol - Line 388
Impact
However, if the token involved is an ERC20 token that does not work when changing the allowance from an existing non-zero allowance value, it will break all of these key functions or features of the protocol.
Code Snippet
Provided Above
Tool used
Manual Review
Recommendation
It is recommended to set the allowance to zero before increasing the allowance or use safeApprove/safeIncreaseAllowance.