Logic error in streak validation causes legitimate jackpot wins to be denied, violating reward contract expectations
The Spin contract checks jackpot eligibility using the user's streak count from before the current spin, so a user who reaches the required streak during that spin is denied the jackpot. The spin fee is still taken, and the user loses a reward they had earned.
- Disclosed after under an hour
50450 sc high logic error in streak validation causes legitimate jackpot wins to be denied violating reward contract expectations
Submitted on Jul 24th 2025 at 19:18:58 UTC by @Bug82427 for Attackathon | Plume Network
- Report ID: #50450
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/spin/Spin.sol
- Impacts: Contract fails to deliver promised returns, but doesn't lose value
Description
In the Spin contract, jackpot eligibility is determined during handleRandomness() by checking whether userDataStorage.streakCount is greater than or equal to (currentWeek + 2). However, this streak count reflects the user’s state before the current spin. Since updateUserData() is called after this check, users spinning their way into jackpot eligibility are denied their rightful rewards.
This is a classic logic flaw in state-dependent access control, where stale state is used to make a reward decision. The impact is that users who legitimately earn jackpot eligibility during their current spin will have their win silently discarded if they land on the jackpot, despite meeting all conditions.
While no funds are stolen or transferred, the jackpot — which should have been won — is withheld. The spin fee is still consumed and non-refundable. This results in broken reward mechanics and undermines user trust. The jackpot funds remain in the contract but the user’s reward is lost forever due to a flawed conditional check.
Proof of Concept
Assumptions:
currentWeek = 3- Jackpot eligibility requires
streakCount ≥ currentWeek + 2 = 5 - Player Alice has
streakCount = 4before spinning - Alice is about to spin and successfully lands on a jackpot
Execution trace (stepper):
{% stepper %} {% step %}
Alice starts the spin
- Alice calls
startSpin(). - She pays the 2 PLUME fee.
- A random request is sent to the Supra VRF.
- Her request ID is stored. {% endstep %}
{% step %}
Oracle returns randomness
- The Supra oracle later calls
handleRandomness(...)with a result corresponding torewardCategory = "Jackpot". - Inside
handleRandomness(), the contract retrieves Alice’suserDataStorage:streakCount == 4lastSpinWeek == currentWeek == 3
- During this spin,
streakCountwould be incremented to 5 byupdateUserData(), but that update has not yet run. {% endstep %}
{% step %}
Eligibility check uses stale state
- Before
updateUserData()is called, the contract checks eligibility:
if (userDataStorage.streakCount < (currentWeek + 2)) {
revert InvalidSpin("Not enough streak");
}
- Since
streakCount == 4, this check fails, even though the user would reach 5 during this spin. {% endstep %}
{% step %}
Outcome
- Jackpot reward logic is skipped entirely, and the spin ends with a revert or lower reward.
updateUserData()is only called after the reward condition is checked, so Alice is wrongly denied the jackpot. {% endstep %} {% endstepper %}
Conclusion
State-dependent reward checks use a stale streakCount (pre-spin) before updateUserData() runs, which causes legitimate jackpot wins earned during the current spin to be denied. This breaks the reward mechanics: users pay the spin fee but may be incorrectly prevented from receiving a jackpot they earned that same spin.
References
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 jackpot eligibility check reads the stored streak count before the function that increments it for the current spin has run, so the decision uses stale state.
Impact
A user who legitimately earns jackpot eligibility during a spin could have that win silently discarded, while the spin fee is still consumed and non-refundable.
What the attacker needed
A user with a streak one below the jackpot threshold; the spin lands on the jackpot reward
How it was found
- Alice calls startSpin() and pays the spin fee.
- The oracle returns randomness that maps to the jackpot reward.
- The contract reads Alice's stored streak count, which is still the pre-spin value.
- The eligibility check fails because the streak is below the required threshold.
- The jackpot logic is skipped and the spin ends with a revert or lower reward.
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 is a program on a blockchain that runs automatically. This one gives a jackpot to players who have spun a certain number of weeks in a row. The bug is that it checks the player's streak before adding the current spin, so a player who just reached the needed streak is told they are not eligible and loses the prize.
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.