Skip to content
Business logic Audit finding Intermediate

In Spin::handleRandomness() jackpot eligibility uses outdated streakCount instead of updated streak

The jackpot eligibility check in Spin.sol compares the stored streak count from before the current spin against the required threshold, rather than the streak that includes the current spin. This can wrongly grant or deny the jackpot, leading to unfair attribution of yield.

Paludo0x Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

52601 sc high in spin handlerandomness jackpot eligibility uses outdated streakcount instead of updated streak

Submitted on Aug 11th 2025 at 21:32:08 UTC by @Paludo0x for Attackathon | Plume Network

Description

Vulnerability Details

In Spin.sol, the jackpot eligibility check during handleRandomness() compares the older streak userDataStorage.streakCount against the required threshold currentWeek + 2, instead of the current streak at the moment of the spin currentSpinStreak.

The jackpot rule is: a player can get the jackpot only if their consecutive days streak ≥ (currentWeek + 2).

In handleRandomness, the contract computes the correct “today” streak currentSpinStreak but then checks eligibility against the old stored streakCount. This means a player could spin in consecutive days, stop for some days, and still be counted as eligible for the jackpot, even if they should not be because the actual streak is not consecutive to the previous ones.

Moreover it can wrongly reject players who reach the required streak with the current spin. Because the logic uses a value from before the current spin’s streak is incremented, it can produce false positives and false negatives for jackpot eligibility.

Impact Details

This issue causes:

  • False positives: If the stored streak is still high but not consecutive to the current spin, the player might be incorrectly eligible.
  • False negatives: A player whose streak reaches the required threshold because of the current spin may be incorrectly denied the jackpot.

Therefore the yield could be attributed in an unfair manner if the jackpot is hit.

Recommended fix

Use the streak that includes today’s spin when checking the rule streak ≥ (currentWeek + 2):

Solidity
if (currentSpinStreak < (currentWeek + 2)) {
    // deny jackpot
}

Proof of Concept

This is the relevant snippet where the wrong check is performed:

{% code title="Spin.sol (relevant snippet)" %}

Solidity
function handleRandomness(uint256 nonce, uint256[] memory rngList) external onlyRole(SUPRA_ROLE) nonReentrant {
   ....
    // CURRENT STREAK IS COMPUTED
    uint256 currentSpinStreak = _computeStreak(user, block.timestamp, true);
   ....
    if (keccak256(bytes(rewardCategory)) == keccak256("Jackpot")) {
        uint256 currentWeek = getCurrentWeek();
        if (currentWeek == lastJackpotClaimWeek) {
            userDataStorage.nothingCounts += 1;
            rewardCategory = "Nothing";
            rewardAmount = 0;
            emit JackpotAlreadyClaimed("Jackpot already claimed this week");
        // THE FORMER STREAK COUNT IS USED TO CHECK ELIGIBILITY
        } else if (userDataStorage.streakCount < (currentWeek + 2)) {
            userDataStorage.nothingCounts += 1;
            rewardCategory = "Nothing";
            rewardAmount = 0;
            emit NotEnoughStreak("Not enough streak count to claim Jackpot");
        } else {
            ....
        }
        // update the streak count after their spin
        userDataStorage.streakCount = currentSpinStreak;
        userDataStorage.lastSpinTimestamp = block.timestamp;
      .....     
}

{% endcode %}

<details> <summary>Additional notes / rationale</summary>

Because the contract checks userDataStorage.streakCount (the stored value before the current spin) rather than currentSpinStreak (the value that accounts for the current spin), eligibility decisions can be incorrect in both directions. Replacing the check with currentSpinStreak when evaluating jackpot eligibility aligns the check with the intended rule and resolves both false positives and false negatives.

</details>

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

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 code uses the stored streak count from before the current spin instead of the newly computed streak that includes the current spin when checking jackpot eligibility.

Impact

The jackpot could be awarded unfairly, either to players who are not eligible or denied to those who are, leading to theft of unclaimed yield.

What the attacker needed

None

The fix

The check should use the current spin streak instead of the stored streak count.

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.

A smart contract game rewards players who spin on consecutive days. The contract keeps a running count of consecutive days, but when deciding if a player wins the jackpot, it looks at the count from before the current spin instead of after. This means a player might win when they shouldn't, or miss out when they should win.

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 Paludo0x

View all

42 more disclosed reports, best first.

More from Plume Network

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.