Skip to content
Business logic Audit finding Beginner

A global blocking check in claimprize prevents individual winner claims until all winners are drawn

The claimPrize function blocks any winner from claiming until all winners for that prize have been drawn, because it reverts if the prize is still active and fewer winners have been drawn than the total quantity. A legitimately selected winner cannot claim their prize until every winner slot is filled, potentially freezing funds if the admin never draws all winners.

XDZIBECX Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

51951 sc low a global blocking check in claimprize prevents individual winner claims until all winners are drawn

Submitted on Aug 6th 2025 at 19:57:08 UTC by @XDZIBECX for Attackathon | Plume Network

Description

Brief / Intro

The claimPrize function contains a validation logic flaw that creates a global blocking mechanism preventing any winner from claiming their prize until all winners for that specific prize have been drawn.

The function checks two conditions together:

  • whether the prize is still active: prizes[prizeId].isActive
  • whether the number of winners drawn is less than the total quantity: winnersDrawn[prizeId] < prizes[prizeId].quantity

If both conditions are true, the function reverts and blocks the claim attempt entirely. This global check occurs before any individual winner validation, meaning a legitimately selected winner is blocked if other winners for the same prize haven't been drawn yet.

The bug stems from a misunderstanding of multi-winner behavior: treating all winners as a single unit rather than allowing individual winners to claim their prizes independently once they have been selected.

Vulnerability Details

The issue in claimPrize prevents any winner from claiming their prize until all winners for a given prize have been drawn. This violates the intended multi-winner design documented for the raffle:

"Each winner must call claimPrize(prizeId, winnerIndex) to claim their specific prize. Since a prize can have multiple winners, the winnerIndex (starting from 0) is used to identify which winning slot is being claimed. Each winner's claim status is tracked independently. One user claiming their prize has no effect on the ability of other winners to claim theirs."

Vulnerable snippet (source pointer): https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/plume/src/spin/Raffle.sol#L299C5-L304C1

Example problematic code:

Solidity
function claimPrize(uint256 prizeId, uint256 winnerIndex) external {
    if (prizes[prizeId].isActive && winnersDrawn[prizeId] < prizes[prizeId].quantity) {
        revert WinnerNotDrawn(); // <-- this global blocking check is vulnerable
    }
    
    Winner storage individualWin = prizeWinners[prizeId][winnerIndex]; // <-- individual validation continues
}

Because the contract reverts the claim for any winner if the prize is still active (meaning more winners are yet to be drawn), as long as any winner remains undrawn for a prize, no winner can claim—regardless of whether their own win has been selected and recorded in prizeWinners. There is no on-chain timeout, expiry, or bypass to allow individual winners to claim independently.

Impact Details

This bug can permanently prevent legitimately selected winners from claiming their prize unless all winners for the prize are drawn. If the admin fails to draw all winners, prizes for that round could be frozen and unclaimable. Winners recorded in the contract would be blocked from accessing their rewards, potentially resulting in a permanent freeze of funds unless resolved via external intervention (e.g., contract upgrade).

{% hint style="warning" %} Permanent freezing of funds is possible: a single missed/failed draw for a multi-winner prize can block all winners from claiming their recorded prizes. {% endhint %}

Proof of Concept

{% code title="test_GlobalBlockingCheck_PreventsEarlyClaims.sol" %}

Solidity
function test_GlobalBlockingCheck_PreventsEarlyClaims() public {
    // Setup: Create a prize with 3 winners
    vm.prank(ADMIN);
    raffle.addPrize("Multi-Winner Prize", "Desc", 100, 3);

    // Add tickets for multiple users
    spinStub.setBalance(USER, 5);
    vm.prank(USER);
    raffle.spendRaffle(1, 3); // USER: tickets 1-3
    
    spinStub.setBalance(USER2, 5);
    vm.prank(USER2);
    raffle.spendRaffle(1, 2); // USER2: tickets 4-5

    // Draw ONLY the first winner (USER2)
    uint256 req1 = requestWinnerForPrize(1);
    uint256[] memory rng1 = new uint256[](1);
    rng1[0] = 4; // Ticket #5 -> USER2
    vm.prank(SUPRA_ORACLE);
    raffle.handleWinnerSelection(req1, rng1);

    // Verify first winner was drawn correctly
    assertEq(raffle.getWinner(1, 0), USER2, "First winner should be USER2");
    
    // Check prize status - should still be active since only 1/3 winners drawn
    (,,, bool isActive,,,,,, uint256 drawn) = raffle.getPrizeDetails(1);
    assertTrue(isActive, "Prize should still be active");
    assertEq(drawn, 1, "Should have 1 winner drawn");

    // BUG: USER2 (the drawn winner) tries to claim their prize
    // This should work according to docs, but will fail due to global check
    vm.prank(USER2);
    vm.expectRevert(abi.encodeWithSelector(Raffle.WinnerNotDrawn.selector));
    raffle.claimPrize(1, 0);

    // Verify the winner exists and is not claimed
    Raffle.Winner[] memory winners = raffle.getPrizeWinners(1);
    assertEq(winners.length, 1, "Should have 1 winner");
    assertEq(winners[0].winnerAddress, USER2, "Winner should be USER2");
    assertFalse(winners[0].claimed, "Winner should not be claimed yet");

    // Draw the second winner (USER)
    uint256 req2 = requestWinnerForPrize(1);
    uint256[] memory rng2 = new uint256[](1);
    rng2[0] = 1; // Ticket #2 -> USER
    vm.prank(SUPRA_ORACLE);
    raffle.handleWinnerSelection(req2, rng2);

    // BUG: Even with 2/3 winners drawn, USER2 still cannot claim
    vm.prank(USER2);
    vm.expectRevert(abi.encodeWithSelector(Raffle.WinnerNotDrawn.selector));
    raffle.claimPrize(1, 0);

    // Draw the third winner (USER again)
    uint256 req3 = requestWinnerForPrize(1);
    uint256[] memory rng3 = new uint256[](1);
    rng3[0] = 2; // Ticket #3 -> USER
    vm.prank(SUPRA_ORACLE);
    raffle.handleWinnerSelection(req3, rng3);

    // NOW the prize is inactive and USER2 can finally claim
    (,,, bool isActiveFinal,,,,,, uint256 drawnFinal) = raffle.getPrizeDetails(1);
    assertFalse(isActiveFinal, "Prize should be inactive after all winners drawn");
    assertEq(drawnFinal, 3, "Should have 3 winners drawn");

    // This should work now
    vm.prank(USER2);
    raffle.claimPrize(1, 0);

    // Verify claim was successful
    winners = raffle.getPrizeWinners(1);
    assertTrue(winners[0].claimed, "Winner should now be claimed");
}

{% endcode %}

References

The original report as published on Immunefi, by XDZIBECX. 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 check that reverts when the prize is still active and not all winners are drawn is placed before individual winner validation, so it blocks all claims globally instead of allowing each recorded winner to claim independently.

Impact

Legitimately selected winners are blocked from claiming until all winners are drawn, and if the admin fails to draw all winners, prizes for that round could be permanently frozen and unclaimable.

What the attacker needed

A prize with multiple winner slots; at least one winner drawn but not all; admin does not draw remaining winners

The fix

The check should be removed or moved so that each recorded winner can claim independently once their win is selected, rather than requiring all winners to be drawn first.

How it was found

  1. Create a prize with three winner slots and add tickets for multiple users.
  2. Draw only the first winner and verify the prize is still active with one winner drawn.
  3. The drawn winner attempts to claim and the transaction reverts with WinnerNotDrawn.
  4. Draw the second winner; the first winner still cannot claim.
  5. Draw the third winner; the prize becomes inactive and the first winner can finally claim successfully.

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.

In a raffle, a prize can have several winners. The contract is supposed to let each winner collect their prize as soon as they are picked. Instead, it refuses every claim until every single winner for that prize has been chosen. So if the person running the raffle forgets or fails to pick the last winner, nobody can get their 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.

More by XDZIBECX

View all

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