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 -
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 .
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 -
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
forremoveCollateralAssets
.