Jackpot check uses previous streakCount instead of current computed streak, denying jackpot on first eligible day
The jackpot eligibility check compares the stored streak count from the previous day instead of the freshly computed streak that includes today's spin. A user who reaches the required streak today is wrongly denied the jackpot and receives nothing.
- Disclosed after under an hour
52986 sc high jackpot check uses previous streakcount instead of current computed streak denying jackpot on first eligible day
Submitted on Aug 14th 2025 at 15:10:59 UTC by @daxun for Attackathon | Plume Network
- Report ID: #52986
- 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
{% hint style="warning" %}
High severity: Jackpot eligibility check uses stored streakCount (previous value) instead of the freshly computed streak that includes today's spin.
{% endhint %}
Description
Brief / Intro
During a spin, the contract computes:
currentSpinStreak = _computeStreak(user, now, true)(which includes today’s spin)
but verifies jackpot eligibility against the stored userData[user].streakCount (yesterday’s value). On the first day a user reaches the required streak, they can be downgraded to “Nothing”.
Vulnerability Details
In handleRandomness() (simplified):
{% code title="handleRandomness (simplified)" %}
uint256 currentSpinStreak = _computeStreak(user, block.timestamp, true);
...
if (isJackpot) {
uint256 currentWeek = getCurrentWeek();
if (currentWeek == lastJackpotClaimWeek) { ... }
else if (userDataStorage.streakCount < (currentWeek + 2)) {
// ↓ uses previous stored streak instead of currentSpinStreak
rewardCategory = "Nothing"; rewardAmount = 0;
} else {
// award jackpot
}
}
...
userDataStorage.streakCount = currentSpinStreak; // updated only after the check
{% endcode %}
Because userDataStorage.streakCount is updated after the check, a user who just reached the required streak today is unfairly denied.
Impact Details
- Immunefi Impact: Low — Contract fails to deliver promised returns, but doesn't lose value
- Users meeting the milestone can miss the jackpot exactly on the day it should be awarded.
Proof of Concept
{% stepper %} {% step %}
Scenario setup
Assume requiredStreak = currentWeek + 2 = 5.
{% endstep %}
{% step %}
Yesterday's stored streak
Yesterday’s stored userData[user].streakCount == 4 (consecutive).
{% endstep %}
{% step %}
Today's computed streak
Today, _computeStreak(..., true) returns 5.
{% endstep %}
{% step %}
Jackpot check uses stored value
Jackpot path checks userDataStorage.streakCount < 5 → true, so it sets reward to “Nothing”.
{% endstep %}
{% step %}
streakCount updated after check
Only after the check, it writes userDataStorage.streakCount = 5.
{% endstep %}
{% step %}
Net result
Net: user is denied the jackpot today, despite meeting the requirement. {% endstep %} {% endstepper %}
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
The jackpot check reads the stored streakCount before it is updated with the current spin's computed streak.
Impact
Users who meet the streak milestone can miss the jackpot exactly on the day it should be awarded, though no funds are lost.
What the attacker needed
A user with a consecutive spin streak; reaching the required streak on the current day
The fix
The jackpot check should use the freshly computed currentSpinStreak instead of the stored streakCount.
How it was found
- Assume the required streak is five.
- Yesterday the stored streak count was four.
- Today the computed streak returns five.
- The jackpot check compares the stored four against five and sets the reward to nothing.
- Only after the check is the stored streak updated to five.
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 keeps a running count of how many days in a row a user has spun. When a user finally reaches the target number, the contract should pay out a jackpot. Here it checks yesterday's saved count instead of today's new count, so the payout is skipped on the very day it is earned.
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.