Skip to content
Business logic Audit finding Beginner

No check if raffle actually has enough funds

The addPrize function in Raffle.sol does not check that the contract holds enough funds to cover the prize value and quantity being added. An admin could set an unaffordable prize, and a winner's claim would then revert for insufficient funds, preventing payout.

PotEater Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

50949 sc insight no check if raffle actually has enough funds

Submitted on Jul 29th 2025 at 22:19:06 UTC by @PotEater for Attackathon | Plume Network

Description

Brief/Intro

In the Raffle.sol contract, in the function addPrize, there is no check that the raffle actually has enough funds to cover the prize.

Vulnerability Details

The function addPrize is used to add a new prize to the raffle system. However, there is no check that the contract actually has enough to cover the prize and can afford to offer such a prize.

Code snippet:

{% code title="Raffle.sol (excerpt)" %}

{% endcode %}

Solidity
    function addPrize(
        string calldata name,
        string calldata description,
        uint256 value,
        uint256 quantity
    ) external onlyRole(ADMIN_ROLE) {
        uint256 prizeId = nextPrizeId++;
        prizeIds.push(prizeId);

        require(bytes(prizes[prizeId].name).length == 0, "Prize ID already in use");
        require(quantity > 0, "Quantity must be greater than 0");

        prizes[prizeId] = Prize({ 
            name: name,
            description: description,
            value: value,
            endTimestamp: 0,
            isActive: true,
            winner: address(0), // deprecated
            winnerIndex: 0, // deprecated
            claimed: false, // deprecated
            quantity: quantity
        });

        emit PrizeAdded(prizeId, name);
    }

This function should implement a check that ensures admin doesn't mistakenly set the prize to some large value that the contract cannot afford to offer.

Impact Details

Mistakenly or intentionally setting the prize to a value that the contract cannot afford to offer would result in the contract failing to deliver the promised payout: when a user tries to claim the prize, the transaction would revert due to insufficient funds. This effectively prevents users from receiving their winnings.

References

https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/plume/src/spin/Raffle.sol#L128

Proof of Concept

{% stepper %} {% step %}

Step

The admin sets a prize to a value that the contract cannot afford to offer (example: $10m). This could be malicious or accidental. {% endstep %}

{% step %}

Step

A user places a bet and wins the (overstated) $10m prize. {% endstep %}

{% step %}

Step

The user attempts to claim the prize, but the claim transaction reverts due to insufficient contract funds. {% endstep %}

{% step %}

Step

The user is unable to receive the prize—effectively scammed by the contract's inability to pay the declared prize. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by PotEater. 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 addPrize function validates quantity but not whether the contract balance can cover value multiplied by quantity.

Impact

The contract could fail to deliver the promised payout, so winners may be unable to claim their prizes.

What the attacker needed

Admin role; prize value exceeds contract funds

How it was found

  1. The admin adds a prize whose value exceeds the contract's available funds.
  2. A user places a bet and wins that prize.
  3. The user tries to claim the prize and the transaction reverts due to insufficient contract funds.
  4. The user cannot receive the prize.

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 lets an administrator add prizes that winners can later claim. This report says the contract never checks whether it actually holds enough money to pay a prize before advertising it. If the prize is too big, the winner's claim fails because the contract cannot pay, so the promised reward is never delivered.

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 PotEater

View all

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