Description: The AaveDIVAWrapperCore::_approveCollateralTokenForAave
function allows the contract to approve a specified collateral token for use by the Aave V3 pool. The current implementation sets the allowance to the maximum possible value (type(uint256).max - currentAllowance
) for the _aaveV3Pool
. While this is a common practice to avoid repeated approvals, it introduces potential risks, particularly if the approved address is compromised or behaves maliciously.
Impact: The function sets the allowance to maximum, effectively granting unlimited spending rights to the _aaveV3Pool
for the specified collateral token.
Please refer to this [article](https://kalis.me/unlimited-erc20-allowances) by Rosco Kalis titled "Unlimited ERC20 allowances considered harmful".
Recommended Mitigation: To reduce the risks while maintaining functionality, modify the function to accept an explicit amount parameter for the allowance. This ensures that only the required amount is approved, rather than granting unlimited access.
The modified function implementation is as follows:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.