Skip to content
Business logic Audit finding Intermediate

Flaw in Raffle::determineReward in Jackpot Prize Calculation after week 12

The jackpot prize mapping only defines values for weeks 0 to 11, so after week 12 a jackpot win returns a prize of zero. An attacker could win a jackpot but receive nothing, wasting the outcome and reducing the chance of other rewards.

Paludo0x Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

52576 sc high flaw in raffle determinereward in jackpot prize calculation after week 12

Submitted on Aug 11th 2025 at 18:14:24 UTC by @Paludo0x for Attackathon | Plume Network

Description

Brief/Intro

There is a logical flaw in the jackpot mechanism where, after week 12, the jackpotPrizes mapping will return 0 for any jackpot prize amount.

This results in a situation where a jackpot can be “won” with reward = 0, wasting the winning outcome and reducing the probability for winning other reward types.

Vulnerability Details

The jackpot mechanism references jackpotPrizes[week] to determine the prize amount.

However, jackpotPrizes is a mapping, not an array, and only contains defined values for weeks 0 through 11 (twelve entries). Any week index beyond those defined entries will return 0 by default, without reverting.

This means that when week > 11 (i.e., after week 12 counting from zero), a jackpot “hit” will still be registered and processed, but the prize value will be zero.

Impact Details

  • The jackpot can be “won” after week 12, but the prize is 0.
  • This reduces the probability pool for other possible rewards since the jackpot branch consumes RNG outcome space, effectively lowering other reward chances (fairness impact).
  • Players may believe they have won a jackpot when in fact they receive nothing.

Recommended Fix

{% stepper %} {% step %}

Keep jackpot prize constant after defined weeks

If week is greater than the last defined jackpot prize week, keep the jackpot prize constant (for example, equal to the last defined prize). This ensures jackpot winners after week 12 still receive the intended prize amount instead of 0. {% endstep %}

{% step %}

Revert jackpot attempts beyond defined weeks

Explicitly revert when a jackpot hit occurs for week > 12 so that no jackpot is awarded and the call reverts instead of registering a zero-value win. This prevents consuming the RNG outcome space with a zero-value jackpot. {% endstep %}

{% step %}

Skip jackpot outcome selection for later weeks

Skip selecting jackpot outcomes for week > 12 entirely: do not increment jackpotWins, do not update lastJackpotClaimWeek, and treat the RNG outcome as if the jackpot branch did not occur (so other reward branches remain available). {% endstep %} {% endstepper %}

Proof of Concept

In Raffle::determineReward() the jackpot prize is determined based on number of weeks since campaign start:

Solidity
function determineReward(
    uint256 randomness,
    uint256 streakForReward
) internal view returns (string memory, uint256) {
   ...
    // Determine the current week in the 12-week campaign
    uint256 daysSinceStart = (block.timestamp - campaignStartDate) / 1 days;
    uint8 weekNumber = uint8(getCurrentWeek());
    uint8 dayOfWeek = uint8(daysSinceStart % 7);

    // Get jackpot threshold for the day of week
    uint256 jackpotThreshold = jackpotProbabilities[dayOfWeek];

    if (probability < jackpotThreshold) {
        return ("Jackpot", jackpotPrizes[weekNumber]);
    } 
    ...
}

getCurrentWeek() is calculated as follows:

Solidity
function getCurrentWeek() public view returns (uint256) {
    return (block.timestamp - campaignStartDate) / 7 days;
}

While jackpotPrizes is initialized as follows:

Solidity
    jackpotPrizes[0] = 5000;
    jackpotPrizes[1] = 5000;
    jackpotPrizes[2] = 10_000;
    jackpotPrizes[3] = 10_000;
    jackpotPrizes[4] = 20_000;
    jackpotPrizes[5] = 20_000;
    jackpotPrizes[6] = 30_000;
    jackpotPrizes[7] = 30_000;
    jackpotPrizes[8] = 40_000;
    jackpotPrizes[9] = 40_000;
    jackpotPrizes[10] = 50_000;
    jackpotPrizes[11] = 100_000;

In function handleRandomness there is no check that the current week falls within the range of defined jackpot weeks; storage is updated as a common jackpot win but no rewards are distributed to the winner when prize resolves to 0:

Solidity
function handleRandomness(uint256 nonce, uint256[] memory rngList) external onlyRole(SUPRA_ROLE) nonReentrant {
   ...

    // ----------  Effects: update storage first  ----------
    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");
        } else if (userDataStorage.streakCount < (currentWeek + 2)) {
            userDataStorage.nothingCounts += 1;
            rewardCategory = "Nothing";
            rewardAmount = 0;
            emit NotEnoughStreak("Not enough streak count to claim Jackpot");
        } else {
            userDataStorage.jackpotWins++;
            lastJackpotClaimWeek = currentWeek;
        }
    } 
    ...

    // ----------  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);
}

Because jackpotPrizes[weekNumber] returns 0 for weeks beyond those initialized, the code will:

  • Register a jackpot win (increment jackpotWins, update lastJackpotClaimWeek), but
  • Transfer 0 PLUME to the user and emit a SpinCompleted indicating a Jackpot with amount 0.

This both wastes a winning slot and decreases other rewards' effective probabilities.

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

Likely the jackpot prize mapping is not checked for weeks beyond the initialised range, so missing entries default to zero instead of reverting or using a fallback value.

Impact

After week 12, a jackpot can be won but pays zero, wasting the winning outcome and lowering the effective probability of other rewards.

What the attacker needed

Campaign runs past week 12; user has enough streak to claim jackpot

The fix

The jackpot prize should be kept constant after the last defined week, or the contract should revert or skip jackpot outcomes for weeks beyond the defined range.

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 raffle contract uses a lookup table to decide the jackpot amount for each week. The table only has entries for the first 12 weeks, so later weeks get a default value of zero. This means a player can win the jackpot but get no prize, and that win still uses up a chance that could have been another reward.

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.