Closed sherlock-admin3 closed 6 months ago
1 comment(s) were left on this issue during the judging contest.
panprog commented:
borderline low/medium, dup of #63, the core issue here is that incentive per token deposited can change before user's transaction executes (for different reasons) and user has no control (slippage check) about it, but this is a protocol choice and this issue can be considered informational. Still, the incentive might be important to user, hence borderline
Front-running should not be a valid issue as people can use flash-bots RPC to make calls through Metamask
Ironsidesec
medium
No slippage for ZVE rewards when depositing to tranches.
Summary
Whenever there is an exchange of value or reward transfer, there should be a minimum slippage input parameter because the amount of reward/tokenOut you will receive depends on a lot of states that are manipulatable by MEV or genuine normal transactions. Rewards that a user will receive when depositing is vulnerable to many changes in state that can be triggered by MEV or genuine normal transactions.
Vulnerability Detail
https://github.com/sherlock-audit/2024-03-zivoe/blob/01e00e6f27b58392a6fa0b82c84a46a783a0df3c/zivoe-core-foundry/src/ZivoeTranches.sol#L236
Users can deposit to tranches by calling ZivoeTranches.depositJunior() and ZivoeTranches.depositSenior(). And rewards will be incentivized in ZVE tokens depending on the following parameters: 1.
juniorSupp
andseniorSupp
2. ifavgRatio
> or < than theirlowerRatioIncentiveBIPS
orupperRatioIncentiveBIPS
3. diffRate which depends onmaxZVEPerJTTMint
andminZVEPerJTTMint
4. Balance of ZVE tokens inside theZivoeTranches.sol
With this much dependence and calculation in determining how much to reward to current tranche deposit based on the tranche supplies, zve balance, the ratios and minting rates as shown above. This shows that perople will deposit to tranches in a hope of getting these rewards. But look at the attack path.
attack path:
avgRate
in L255 above, which will decrease the amount of rewards he gonna get.So in this way, a genuine front run might also happen, which can decrease the total supply of the tokens and it will increase amount of rewards frontrunner will receive. But rewards are so low, then L262 will trigger for the victim's deposit and he will get less rewards.
And owner might change max and minimum minting rate, which will also affect how many rewards the victim will receive if he gets frontran.
So to deal and not hurt how much rewards the user will receive, mention a slippage parameter on ZivoeTranches.depositJunior() and ZivoeTranches.depositSenior().
Impact
Loss of ZVE rewards due to MEV, or genuine change in minting rate, JTT/STT token total supplies, and tranche ratios change. So giving it a medium
Code Snippet
Tool used
Manual Review
Recommendation
slippage parameter on ZivoeTranches.depositJunior() and ZivoeTranches.depositSenior().
Duplicate of #63