The _depositIntoVault and _withdrawFromVault functions in the LendingPool contract interact with the ICurveCrvUSDVault interface to manage liquidity. However, the _withdrawFromVault function contains incorrect parameter settings, specifically for the owner and receiver arguments in the withdraw function call. This misconfiguration could lead to improper handling of shares and assets, potentially causing liquidity management issues or loss of funds.
In _depositIntoVault function, the deposit function of ICurveCrvUSDVault is called with amount and address(this) as arguments.
Here is the comment in the deposit function of ICurveCrvUSDVault
In _depositIntoVault function, address(this) is correctly set as the receiver of the shares, meaning the LendingPool contract will own the shares. This implementation is correct and aligns with the intended functionality.
In _withdrawFromVault function, the withdraw function of ICurveCrvUSDVault is called with the following arguments:
assets: The amount of assets to withdraw.
receiver: The address receiving the assets, set to address(this).
owner: The address owning the shares, set to msg.sender.
maxLoss: The maximum acceptable loss, set to 0.
strategies: Optional strategies to withdraw from, set to an empty array.
The owner is set to msg.sender, which is incorrect. The shares are owned by the LendingPool contract (address(this)), not the caller (msg.sender). This could cause the withdrawal to fail, as msg.sender does not own the shares.
The receiver is set to address(this), which is incorrect. The withdrawn assets should be sent directly to the reserve.reserveRTokenAddress (the reserve token contract) to ensure proper liquidity management. Sending the assets to address(this) could result in assets being stuck in the LendingPool contract.
Asset Mismanagement:
Sending the withdrawn assets to address(this) instead of reserve.reserveRTokenAddress could result in assets being trapped in the LendingPool contract, disrupting the liquidity management system.
Potential Loss of Funds:
If the withdrawal fails or assets are mismanaged, users may be unable to withdraw their funds, leading to potential loss of trust or financial losses.
The impact is High, the likelihood is Medium, so the severity is High.
Manual Review
Consider following fix:
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.