Submitted by leastwood, also found by kenzo
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:
During wrap() and unwrap() actions, _checkpoint() is used to update the rewards for the from_ and to_ accounts. However, the reference contract implements a _beforeTokenTransfer() function which has been removed from Yield Protocols custom implementation.
As a result, it is possible to transfer wCVX tokens to another account after an initial checkpoint has been made. By manually calling user_checkpoint() on the new account, this user is able to update its deposited balance of the new account while the senders balance is not updated. This can be repeated to effectively replicate a users deposited balance over any number of accounts. To claim yield generated by the protocol, the user must only make sure that the account calling getReward() holds the tokens for the duration of the call.
The exploit can be outlined through the following steps:
Manual code review.
Discussion/confirmation with the Yield Protocol team.
Consider implementing the _beforeTokenTransfer() function as shown in the reference contract. However, it is important to ensure the wrapper contract and collateral vaults are excluded from the checkpointing so they are not considered in the rewards calculations.
alcueca (Yield) confirmed and commented:
 iamsahu (Yield) resolved
Alex the Entreprenerd (judge) commented:
Alex the Entreprenerd (judge) commented:
