HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

The `_approveCollateralTokenForAave` function use `safeIncreaseAllowance` which will not work for token like USDT

Summary

Some tokens (like USDT) have non-standard ERC20 implementations, such requiring approvals to be set to zero before changing them.

Vulnerability Details

https://github.com/Cyfrin/2025-01-diva/blob/1b6543768c341c2334cdff87b6dd627ee2f62c89/contracts/src/AaveDIVAWrapperCore.sol#L358

The _approveCollateralTokenForAave function uses safeIncreaseAllowance, which may not work for these tokens. For example, if the current allowance is non-zero, safeIncreaseAllowance will revert for USDT. Thus, this function might fail for certain tokens, requiring the allowance to be reset to zero first. The correct approach would be to call safeApprove with zero first, then safeIncreaseAllowance. However, the current code uses safeIncreaseAllowance, which could revert for tokens like USDT.

Impact

Tools Used

Manual review

Recommendations

USDT requires allowance reset to 0 before using safeIncreaseAllowance

Updates

Lead Judging Commences

bube Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.