sherlock-audit / 2023-05-Index-judging

6 stars 3 forks source link

Angry_Mustache_Man - Remaining collateral assets get's stuck #320

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

Angry_Mustache_Man

medium

Remaining collateral assets get's stuck

Summary

In AaveV3LeverageModule.sol , while removing the ability of assets to be collateral through removeCollateralAssets , it is never checked whether there is a balance of the particular asset in the contract.

Vulnerability Detail

While removing borrow assets , we could see there is a condition -

 require(underlyingToReserveTokens[borrowAsset].variableDebtToken.balanceOf(address(_setToken)) == 0, "VDR");

which ensures that there is no balance of borrowAsset remaining in contract, but there is no such condition while removing collateral assets, preventing those assets to be used as collateral again, leading to temporary lockage of those assets .

Impact

Temporary lockage of assets.

Code Snippet

https://github.com/sherlock-audit/2023-05-Index/blob/main/index-protocol/contracts/protocol/modules/v1/AaveV3LeverageModule.sol#L637-#L649

Tool used

Manual Review

Recommendation

Replicate the condition applied in removeBorrowAssets for removeCollateralAssets.