Stuck emissions for nullified epochs
When a vault has zero total value locked (TVL) for an epoch that has emissions allocated, the epoch is nullified and the emissions become permanently stuck because no one can withdraw them. An attacker cannot directly exploit this, but the protocol loses the emissions tokens.
Source: https://github.com/sherlock-audit/2023-03-Y2K-judging/issues/122
Found by
0x52, Ch_301, bin2chen, carrot, cccz, hickuphh3, immeas, kenzo, libratus, ltyu, roguereddwarf, sinarette
Summary
If either the premium and / or collateral vault has 0 TVL for an epoch with emissions, those emissions will not be withdrawable by anyone.
Vulnerability Detail
The finalTVL set for a vault with 0 TVL (epoch will be nullified) will be 0. As a result, emissions that were allocated to that vault are not withdrawable by anyone.
It's admittedly unlikely to happen since the emissionsToken is expected to be Y2K which has value and is tradeable.
Impact
Emissions cannot be recovered.
Code Snippet
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L157 https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L630-L636
Tool used
Manual Review
Recommendation
Create a function to send emissions back to the treasury if an epoch is marked as nullified.
A related issue is that if both the premium and collateral vaults have 0 TVL, only the collateral vault gets marked as nullified. Consider handling this edge case.
Discussion
3xHarry
great catch
3xHarry
fix PR: https://github.com/Y2K-Finance/Earthquake/pull/139
IAm0x52
Fix looks good. setEpochNull is overridden in Carousel to transfer emissions back to treasury
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the nullification logic sets the final TVL to zero and does not provide a mechanism to return allocated emissions to the treasury when an epoch is nullified.
Impact
Emissions allocated to a nullified epoch become permanently stuck and cannot be recovered by anyone.
What the attacker needed
A vault has zero TVL for an epoch; emissions are allocated to that epoch
The fix
The fix was to override setEpochNull in Carousel so that emissions are transferred back to the treasury when an epoch is nullified.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In this protocol, users deposit funds into vaults for specific time periods called epochs. If no one deposits into a vault for an epoch, that epoch is cancelled (nullified). The problem is that reward tokens (emissions) were already set aside for that epoch, and because the epoch is cancelled, those tokens get locked forever with no way to retrieve them.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.