Permanently stuck rewards in the Vault due to missing logic of withdrawing.
Vulnerability Details
When the Vault requests the allocate method inside TokeAutoEth.sol contract ( TokeAutoEth.sol contract inherits method allocate from parent contract MYTStrategy.sol) what happens is that the strategy is staking the passed amount to the Tokenmak Rewarder contract. The concept of this rewarder contract is to generate rewards by the time passing for all stakers based on their deposits. Once there is pending reward to be claimed then the strategy can request the rewarder.getReward method to claim the rewards. There are 2 problems here:
The TokeAutoEth strategy's method claimRewards lacks of access control validation meaning anyone can call it.
The rewarder.getReward request initiated inside method claimRewards is actually claiming the rewards directly to the Vault and the Vault has no logic to withdraw or rescue token funds. The received rewardToken is different than the vault.asset() thus cannot be used to be re-allocated back to some strategy.
Impact Details
Permanently stuck funds in the form of rewards received by the Tokemak's Rewarder contract.
Recommendation
Consider adding access control validation to method claimRewards inside src/MYTStrategy.sol
The rewards are claimed directly to the Morpho Vault V2, but the reward token type is different from the vault's asset(). Introduce new logic where rewards are claimed to the owner of the strategy or dedicated rewards collector.
Proof of Concept
Proof of Concept
Create file src/test/strategies/TokeAutoETHStrategy.claimRewards.t.sol and run it with command forge test src/test/strategies/TokeAutoETHStrategy.claimRewards.t.sol -vv: