Submitted by leastwood
ConvexYieldWrapper.sol is a wrapper contract for staking convex tokens on the users behalf, allowing them to earn rewards on their deposit. Users will interact with the Ladle.sol contracts batch() function which:
_getDepositedBalance() takes into consideration the users total collateral stored in all of their owned vaults. However, as a vault owner, you are allowed to give the vault to another user, move collateral between vaults and add/remove collateral. Therefore, it is possible to manipulate the result of this function by checkpointing one users balance at a given time, transferring ownership to another user and then create a new checkpoint with this user.
As a result, a user is able to generate protocol yield multiple times over on a single collateral amount. This can be abused to effectively extract all protocol yield.
Consider the following exploit scenario:
https://github.com/code-423n4/2022-01-yield/blob/main/contracts/ConvexYieldWrapper.sol#L100-L120
Manual code review.
Discussion/confirmation with the Yield Protocol team.
Ensure that any change to a vault will correctly checkpoint the previous and new vault owner. The affected actions include but are not limited to; transferring ownership of a vault to a new account, transferring collateral to another vault and adding/removing collateral to/from a vault.
iamsahu (Yield) confirmed
Alex the Entreprenerd (judge) commented:
alcueca (Yield) commented:
