Description: If all the collateral of a vault is in the protocol Aave earning yield and someone wants to withdraw their collateral is not going to be possible, is going to throw an error of overflow / underflow because the vault contract itself doesn't have any collateral at all, all is in Aave.
In the function KittyVault::executeWhiskdrawal()
:
AS you can see the transfer happens from the vault contract to the address of the user, can not be done if all the collateral is in Aave.
Impact: User have to wait to withdraw collateral until the Meowntainer
withdraws some from Aave to the vault contract.
Proof of Concept: Couple of steps to execute:
Paste this modifier to the KittyFiTest.t.sol
:
Four users deposit collateral and mint from the protocol KittyFi
MODIFIER
Paste this test below the modifier on the same file:
Once the four users deposited the collateral.
Meowntainer
puts all the collateral to Aave to start earning yield.
If one user
tries to withdraw all the collateral it has from the vautl is going to revert.
TEST
Recommended Mitigation: You have some options:
Make a new function KittyPool::requestWithdraw()
to let know the Meowntainer
that has to withdraw some collateral from the Aave protocol in order execute KittyPool::whiskdrawMeowllateral()
.
Modify the function KittyVault::executeWhiskdrawal
in order that when it is called, it has to withdraw first from the Aave the amount requested to withdraw and then transfer the amount to the user. (Assuming of course that you first check for KittyPool::_hasEnoughMeowllateral
, and calculate the right amount of collateral to withdraw based on the cattyNips
).
Put some extra value in the vault of the same collateral token of the vault in order to make withdraws directly and then you can fill up again the contract vault withdrawing from Aave.
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.