when lending pool doesn’t have a sufficient amount for user withdrawal, it will try to get some token back from curve vault, using _withdrawFromVault but this function sending msg.sender instead of lendingPool as owner of the shares and this will revert because user doesn't have any shares to burn.
When user deposit crvUsd to lending pool, some percentage that crvUSD is deposited to curve vault for extra yield. The deposit is handled by _rebalanceLiquidity which is called from deposit
if you look at the depositIntoVault the second parameter in curveVault:deposit is the recipient of shares, which as you see is set to address(this) or lendingPool itself.
Now when a user tries to withdraw their crvUSD from lending pool the _ensureLiquidity is called to make sure there is enough liquidity in the contract if not then it should be withdrawn from curveVault
https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/pools/LendingPool/LendingPool.sol#L249
_ensureLiquidity will call _withdrawFromVault if contract doesn’t have enough to cover the withdraw request
https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/pools/LendingPool/LendingPool.sol#L809
third parameter of the curveVault:withdraw function is the owner of the shares, we can see the code is providing msg.sender as an owner, which is wrong because we know from the deposit flow that shares are owned by the lending pool, not the msg.sender.
When a curveVault tries to check for allowance of token to lendingPool from user then the transaction will revert.
_withdrawFromVault will revert because user don’t have that many shares, even if he does have shares from is external deposit to curveVault, because he has not approved the lendingPool to use that, the transaction will revert.
The worst case is that if the user has approved his own shares to the lending pool then he will lose it.
user address(this) as a owner when withdrawing instead of msg.sender
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.