Skip to content
Business logic Audit finding Intermediate

Null epochs will freeze rollovers

The rollover check in Carousel.sol incorrectly requires that a user's entitled shares exceed their assets, which fails when a null epoch occurs because no payout is made. This causes rollovers to halt after a null epoch, leaving users unable to roll over their positions.

0x52 Follow with berndartmueller, bin2chen and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-03-Y2K-judging/issues/442

Found by

0x52, berndartmueller, bin2chen, iglyx, p0wd3r

Summary

When rolling a position it is required that the user didn't payout on the last epoch. The issue with the check is that if a null epoch is triggered then rollovers will break even though the vault didn't make a payout

Vulnerability Detail

Carousel.sol#L401-L406

            uint256 entitledShares = previewWithdraw(
                queue[index].epochId,
                queue[index].assets
            );
            // mint only if user won epoch he is rolling over
            if (entitledShares > queue[index].assets) {

When minting rollovers the following check is made so that the user won't automatically roll over if they made a payout last epoch. This check however will fail if there is ever a null epoch. Since no payout is made for a null epoch it should continue to rollover but doesn't.

Impact

Rollover will halt after null epoch

Code Snippet

Carousel.sol#L361-L459

Tool used

Manual Review

Recommendation

Change to less than or equal to:

-           if (entitledShares > queue[index].assets) {
+           if (entitledShares >= queue[index].assets) {

Discussion

3xHarry

makes sense

3xHarry

Won't be able to fix this edge case. Changes in the rollover queue make it now that positions are not deleted anymore but rather marked to 0 to prevent rollover queue manipulation. In this case, users would have to resolve their stuck rollover position manually. https://github.com/Y2K-Finance/Earthquake/pull/127

IAm0x52

Issue has been acknowledged by sponsor

The original report as published on Sherlock, by 0x52. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

The condition uses a strict greater-than comparison instead of greater-than-or-equal, so when entitled shares equal assets (as in a null epoch), the rollover is incorrectly blocked.

Impact

Rollover will halt after a null epoch, preventing users from rolling over their positions.

What the attacker needed

A null epoch occurs; user attempts to roll over

The fix

The check should be changed to use greater-than-or-equal to allow rollover when entitled shares equal assets, but the sponsor acknowledged the issue and stated they won't fix this edge case, instead requiring manual resolution.

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 a vault, users can roll over their position to the next epoch. The code checks if the user won the previous epoch by comparing entitled shares to assets. If there was a null epoch (no payout), the check fails and rollover stops, even though the user should be allowed to roll over.

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.

More by 0x52

View all

211 more disclosed reports, best first.

More from Y2K

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.