When withdrawing funds from the Curve Vault via LendingPool::_withdrawFromVault, the function burns the shares of msg.sender instead of LendingPool. Since the user never deposited directly into the vault (only the LendingPool did), they do not possess any shares, causing a revert. This affects both deposit and withdrawal operations.
Deposits:
LendingPool deposits funds into the vault.
The vault mints shares to LendingPool in exchange.
Users do not directly interact with the vault and do not receive shares.
Withdrawals:
The function _withdrawFromVault(uint256 amount) calls:
Here, msg.sender is expected to burn their vault shares to redeem crvUSD, but msg.sender never received any shares—LendingPool did.
This results in a revert due to insufficient shares.
get the vyper contract from https://etherscan.io/address/0xd8063123BBA3B480569244AE66BFE72B6c84b00d
put this contract in the contracts folder of the protocol
edit the contract as follows :
replace the existing def init(): with the below one :
now there exists a parameter in this contract known as deposit_limit by default it is 0 and inorder to accept the deposits, it must be set to uint256 max but can only be done by certain roles.
On trying to set the roles was unable to do so due to lack of vyper code knowledge, decided to skip past this role part by commenting out the below code in our pasted contract,
commenting this code would just stop checking how much is LendingPool allowed to actually deposit which does not play any important role for this bug :
Next, for testing purpose make the LendingPool::_depositIntoVault & LendingPool::_withdrawFromVault functions public in LendingPool.sol.
now paste the below code in Lendpool.test.js :
Withdrawals Always Fail:
Since msg.sender never owns any shares, all withdrawal attempts fail.
This affects _rebalanceLiquidity() and _ensureLiquidity(amount), leading to liquidity issues.
Depositors Cannot Withdraw Their Funds:
Even if LendingPool has enough funds, the incorrect share-burning mechanism prevents withdrawal.
Manual Review
Hardhat Testing
Modify _withdrawFromVault to burn LendingPool's shares 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.