Jackpot eligibility uses stale streak
The jackpot eligibility check in the spin contract compares against the previous day's streak count instead of the freshly computed streak, so a user who has just reached the required streak is wrongly denied the jackpot. An attacker cannot gain anything, but honest users are delayed by one day before they can win.
- Disclosed after under an hour
50796 sc high jackpot eligibility uses stale streak
Submitted on Jul 28th 2025 at 16:24:35 UTC by @BeastBoy for Attackathon | Plume Network
- Report ID: #50796
- 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 handleRandomness the code begins by computing:
currentSpinStreak = _computeStreak(user, block.timestamp, true)
but then, inside the “Jackpot” branch, evaluates:
else if (userDataStorage.streakCount < (currentWeek + 2)) {
userDataStorage.nothingCounts += 1;
rewardCategory = "Nothing";
}
Here userDataStorage.streakCount still holds yesterday’s value, so even if currentSpinStreak meets the required threshold (currentWeek + 2), the check fails. Only after this logic does the code execute:
userDataStorage.streakCount = currentSpinStreak;
meaning the first day a user actually reaches the needed streak they are incorrectly treated as ineligible.
Impact
{% hint style="warning" %} Users must spin an extra day before becoming eligible for the jackpot, contrary to intended behavior and degrading user experience. {% endhint %}
Recommendation
{% hint style="info" %}
Assign userDataStorage.streakCount = currentSpinStreak before the jackpot check or change the condition to compare currentSpinStreak directly against the required threshold so that today’s spin counts immediately.
{% endhint %}
Proof of Concept
{% code title="PoC: testStreakJackpotBug.sol" %}
function testStreakJackpotBug() public {
// Set up Week 0 (requires 2-day streak)
vm.warp(spin.getCampaignStartDate());
// Day 1: User spins for first time
vm.deal(USER, INITIAL_SPIN_PRICE);
uint256 nonce1 = performPaidSpin(USER);
// Mock jackpot-winning randomness but expect denial due to insufficient old streak
uint256[] memory rng1 = new uint256[](1);
rng1[0] = 0; // Force jackpot
vm.prank(SUPRA_ORACLE);
vm.recordLogs();
spin.handleRandomness(nonce1, rng1);
Vm.Log[] memory logs1 = vm.getRecordedLogs();
(string memory result1,) = abi.decode(logs1[logs1.length - 1].data, (string, uint256));
assertEq(result1, "Nothing", "Day 1: Should be denied (old streak = 0)");
// Verify current streak is now 1
assertEq(spin.currentStreak(USER), 1, "Current streak should be 1 after day 1");
// Day 2: User spins again (should have 2-day streak but gets denied)
vm.warp(block.timestamp + 1 days);
vm.deal(USER, INITIAL_SPIN_PRICE);
uint256 nonce2 = performPaidSpin(USER);
// Before the spin, verify the user SHOULD be eligible
uint256 wouldBeStreak = spin.currentStreak(USER); // This will be 1 (old)
// But _computeStreak(USER, block.timestamp, true) would return 2
uint256[] memory rng2 = new uint256[](1);
rng2[0] = 0; // Force jackpot
vm.prank(SUPRA_ORACLE);
vm.recordLogs();
spin.handleRandomness(nonce2, rng2);
Vm.Log[] memory logs2 = vm.getRecordedLogs();
(string memory result2,) = abi.decode(logs2[logs2.length - 1].data, (string, uint256));
// THE BUG: User should get jackpot (actual streak = 2) but gets denied (old streak = 1)
assertEq(result2, "Nothing", "Day 2: BUG - User denied despite having 2-day streak");
// Day 3: Now user finally gets jackpot
vm.warp(block.timestamp + 1 days);
vm.deal(USER, INITIAL_SPIN_PRICE);
uint256 nonce3 = performPaidSpin(USER);
uint256[] memory rng3 = new uint256[](1);
rng3[0] = 0; // Force jackpot
vm.prank(SUPRA_ORACLE);
vm.recordLogs();
spin.handleRandomness(nonce3, rng3);
Vm.Log[] memory logs3 = vm.getRecordedLogs();
(string memory result3,) = abi.decode(logs3[logs3.length - 1].data, (string, uint256));
assertEq(result3, "Jackpot", "Day 3: Finally eligible (one day late)");
console2.log("BUG CONFIRMED: User eligible on day 2 but denied until day 3");
}
{% endcode %}
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 branch reads the stored streakCount before it is updated with the freshly computed currentSpinStreak.
Impact
Users must spin an extra day before becoming eligible for the jackpot, which contradicts the intended behaviour and degrades the user experience; no funds are lost.
What the attacker needed
A funded user account; oracle returns a jackpot-forcing value; user spins on consecutive days
The fix
The stored streak should be updated before the jackpot check, or the condition should compare the freshly computed streak directly against the required threshold.
How it was found
- Start the campaign at week 0, where a two-day streak is required.
- On day 1 the user performs a paid spin and the oracle returns a jackpot-forcing value; the result is 'Nothing' because the stored streak is 0.
- On day 2 the user spins again; the freshly computed streak is 2, but the stored streak is still 1, so the result is again 'Nothing'.
- On day 3 the user spins once more and finally receives 'Jackpot', one day later than intended.
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 deciding whether a spin wins the jackpot, the code looks at the old saved count rather than the count it just worked out for today. That means the first day a user actually qualifies, the contract still thinks they are one day short and gives them nothing.
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.