Skip to content
Business logic Audit finding Intermediate

Minor delays from oracle can unfairly reset users streak

The spin streak is only updated when the oracle callback arrives, so a callback that crosses midnight can reset a user's streak even though they spun in time. An attacker cannot force this, but any user can lose their streak and potential rewards due to oracle delay.

forgebyola Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

52998 sc low minor delays from oracle can unfairly reset users streak

Submitted on Aug 14th 2025 at 15:51:17 UTC by @forgebyola for Attackathon | Plume Network

Description

Brief/Intro

If the supra oracle delays callback, the user streak can get broken, unfairly penalizing the user.

Vulnerability Details

Users maintain spin streaks by spinning at least once every 24 hours. The greater the user streak the more rewards they can potentially gain, therefore users are economically incentivized to maintain their streak by spinning every day.

When users make a spin, a random number is generated from the supra oracle and the oracle has to call back into the Spin.sol contract. The issue is that the user streak is only updated when the callback is received.

Relevant snippet from handleRandomness:

Solidity
function handleRandomness(
        uint256 nonce,
        uint256[] memory rngList
    ) external onlyRole(SUPRA_ROLE) nonReentrant {
        address payable user = userNonce[nonce];
        if (user == address(0)) {
            revert InvalidNonce();
        }

        isSpinPending[user] = false;
        delete userNonce[nonce];
        delete pendingNonce[user];

        uint256 currentSpinStreak = _computeStreak(user, block.timestamp, true);
        uint256 randomness = rngList[0]; // Use full VRF range
        (string memory rewardCategory, uint256 rewardAmount) = determineReward(
            randomness,
            currentSpinStreak
        );

        ...................................................
        // update the streak count after their spin
        userDataStorage.streakCount = currentSpinStreak;

        userDataStorage.lastSpinTimestamp = block.timestamp;
        // ----------  Interactions: transfer Plume last ----------
        if (
            keccak256(bytes(rewardCategory)) == keccak256("Jackpot") ||
            keccak256(bytes(rewardCategory)) == keccak256("Plume Token")
        ) {
            _safeTransferPlume(user, rewardAmount * 1 ether);
        }

        emit SpinCompleted(user, rewardCategory, rewardAmount);
    }

The streak computation:

Solidity
function _computeStreak(
        address user,
        uint256 nowTs,
        bool justSpun
    ) internal view returns (uint256) {
        // if a user just spun, we need to increment the streak its a new day or a broken streak
        uint256 streakAdjustment = justSpun ? 1 : 0;

        uint256 lastSpinTs = userData[user].lastSpinTimestamp;

        if (lastSpinTs == 0) {
            return 0 + streakAdjustment;
        }
        uint256 lastDaySpun = lastSpinTs / SECONDS_PER_DAY;
        uint256 today = nowTs / SECONDS_PER_DAY;
        if (today == lastDaySpun) {
            return userData[user].streakCount;
        } // same day
        if (today == lastDaySpun + 1) {
            return userData[user].streakCount + streakAdjustment;
        } // streak not broken yet
        return 0 + streakAdjustment; // broken streak
    }

The user streak is reset if the user's lastSpinTimestamp surpasses 24 hours (i.e., crosses a day boundary based on integer division by seconds per day).

If, for example, a user spins at 11:58pm, and the supra oracle calls back into the contract at 12:01am, the user streak is calculated at the time when this callback happens, and therefore the user loses their streak (streak is reset) unfairly due to a condition out of their control.

Impact Details

The user gets their streak reset unfairly, which can lead to economic losses for the user.

References

Proof of Concept

{% stepper %} {% step %}

Scenario: user has an active streak

User has made spins for the last 4 days and has a current streak of 4 days. {% endstep %}

{% step %}

User spins late at night

User makes first spin of the day at 11:55pm expecting their streak to be maintained. {% endstep %}

{% step %}

Oracle callback delay

Supra oracle calls back at 12:01am. {% endstep %}

{% step %}

Streak recalculated on callback

User streak is calculated using this callback time. {% endstep %}

{% step %}

Result: streak reset

User's 4 day streak gets reset. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by forgebyola. 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

Likely the streak is computed from the oracle callback timestamp rather than the time the user submitted the spin, so a callback that crosses a day boundary resets the streak.

Impact

A user could lose their streak and the associated rewards if the oracle callback is delayed past a day boundary; the report does not claim an attacker can trigger this.

What the attacker needed

User has an active streak; user spins close to midnight; oracle callback is delayed past midnight

How it was found

  1. User has an active 4-day streak.
  2. User spins at 11:55pm to maintain the streak.
  3. The oracle callback arrives at 12:01am.
  4. The streak is recalculated using the callback time.
  5. The user's 4-day streak is reset.

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 user keeps a daily spin streak by spinning once every 24 hours. The contract only records the spin when a separate random-number service calls back, and if that call arrives after midnight the streak is treated as broken. This means a slow outside service can wipe out a user's progress through no fault of their own.

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 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.