Reverting on callback increases chances of winning
The handleRandomness callback pays out rewards immediately, and if the recipient contract reverts, the whole callback fails. Since Supra dVRF retries failed callbacks, an attacker can delay the payout until a later timestamp when the reward is larger, or repeatedly revert to drain the sponsor's gas.
Plume Network
Originally disclosed on Immunefi
50428 sc medium reverting on callback increases chances of winning
Submitted on Jul 24th 2025 at 14:12:28 UTC by @Oppi992 for Attackathon | Plume Network
- Report ID: #50428
- Report Type: Smart Contract
- Report severity: Medium
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/spin/Spin.sol
- Impacts:
- Theft of gas
- Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Brief / Intro
handleRandomness() pays out rewards immediately by calling _safeTransferPlume(). If the recipient is a contract that reverts on receiving the assets, the whole callback reverts. Since Supra dVRF re‑tries failed callback, and because determineReward() depends on the current block.timestamp, an attacker can delay the successful callback until a more favourable timestamp, or drain the sponsor’s gas budget.
Vulnerability Details
On a successful spin, handleRandomness() calls _safeTransferPlume() to send the winning user the rewards via a low-level value transfer. Since this low-level call can be purposefully rejected, and since _safeTransferPlume requires the low-level call to succeed, a malicious user can decide to revert the entire callback (by spending all the available gas). In Supra dVRF V3, "Failed callback transactions (due to insufficient gas) are automatically retried every 6 hours, for up to 48 hours." (see Ref #1) Therefore, the user would get another "spin of the wheel" at a later time. Though the randomness would not change, the block.timestamp would. Apart from the obvious gas theft, this degree of freedom allows the user to improve their situation, on behalf of other users, as detailed below.
Impact Details
{% stepper %} {% step %}
Wait until a better day of the week
A draw that only wins a Plume token on day D can win the jackpot on day D+1 (because the jackpotProbabilities are monotonically increasing). As winning Plume tokens still guarantees a call to _safeTransferPlume(), one can revert the callback and wait for a day that would yield the jackpot.
{% endstep %}
{% step %}
Wait until next week
A draw that wins a small jackpot on week W can win a larger jackpot on week W+1 by delaying the callback until the later week. {% endstep %}
{% step %}
Avoid losing the jackpot
If in a week W the jackpot was already taken, naively leaving the user empty-handed, it is worthwhile to postpone the "spin" to next week and try to win next week's unclaimed jackpot. {% endstep %}
{% step %}
Gas drain
Always revert the transaction (if Plume tokens have been won) to repeatedly cause failed callbacks and steal gas from the sponsor who provided the gas funds for Supra. {% endstep %} {% endstepper %}
References
<details> <summary>Ref #1 — Supra dVRF V3 documentation</summary>https://docs.supra.com/dvrf/migration-to-dvrf-3.0#whats-new-in-dvrf-3.0
</details>Proof of Concept
We give concrete demonstrations for each attack vector from "Impact Details". Assumptions: jackpotProbabilities, jackpotPrizes, and plumeAmounts are at their initial values; campaignStartDate is Monday at midnight.
{% stepper %} {% step %}
Wait until a better day of the week (Concrete)
Bob starts a spin on Tuesday, and he gets randomness of 4. This is not enough for the jackpot on Tuesday (jackpotThreshold=3), but Bob does get a Plume token. He purposefully reverts the entire transaction and waits until the callback is invoked on Thursday. Then the same randomness of 4 is below the Thursday jackpotThreshold (=7), and so Bob gets the jackpot.
{% endstep %}
{% step %}
Wait until next week (Concrete)
Bob starts a spin on Sunday in the second week, and gets a randomness of 0. This is below the jackpotThreshold and so Bob is entitled to 5,000 Plume tokens. However, he can revert the callback and wait until Monday (beginning of the third week), where this randomness would net him 10,000 tokens.
{% endstep %}
{% step %}
Avoid losing the jackpot (Concrete)
Bob starts a spin on Sunday in the first week, and gets a randomness of 0. This is below the jackpotThreshold, but the jackpot was already claimed, so Bob is entitled to 0 tokens. handleRandomness() would still call _safeTransferPlume() with 0 tokens, so Bob can revert the callback and wait until Monday (beginning of the second week), where this randomness would net him 5,000 tokens.
{% endstep %}
{% step %}
Gas drain (Concrete)
Bob starts a spin on Tuesday, and he gets randomness of 1000, which nets him one Plume token. He decides to revert this transaction to waste gas for the sponsor. After six hours, the callback is retried, and Bob reverts again. This can repeat up to 8 times, wasting a considerable amount of gas fees paid by the sponsor.
{% endstep %}
{% endstepper %}
Context
The target is the Spin.sol contract of the Plume Network Attackathon, a smart contract that implements a spin the wheel style game. A user starts a spin, randomness is requested from Supra dVRF, and when the oracle calls back into the contract, handleRandomness() decides what the user has won and pays it out immediately by calling _safeTransferPlume().
The reward decision is not fixed at the moment the spin is started. determineReward() depends on the current block.timestamp, so the same randomness value can map to different prizes depending on the day of the week and the week number at the time the callback executes. The jackpotProbabilities are monotonically increasing over the campaign.
The report was submitted on Jul 24th 2025 at 14:12:28 UTC by @Oppi992, report ID #50428, severity Medium. The listed impacts are theft of gas and direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield.
Setup
The proof of concept assumes the initial values of jackpotProbabilities, jackpotPrizes and plumeAmounts, and a campaignStartDate of Monday at midnight. No accounts, tools or versions beyond that are described. The relevant external precondition is the behaviour of Supra dVRF V3: according to the documentation referenced in the report, failed callback transactions due to insufficient gas are automatically retried every 6 hours, for up to 48 hours.
Finding it
The researcher noticed that handleRandomness() pays out rewards immediately by calling _safeTransferPlume(). If the recipient is a contract that reverts on receiving the assets, the whole callback reverts. Because Supra dVRF retries failed callbacks, and because determineReward() depends on the current block.timestamp, an attacker can delay the successful callback until a more favourable timestamp, or drain the sponsor's gas budget.
On a successful spin, handleRandomness() calls _safeTransferPlume() to send the winning user the rewards via a low-level value transfer. Since this low-level call can be purposefully rejected, and since _safeTransferPlume requires the low-level call to succeed, a malicious user can decide to revert the entire callback by spending all the available gas. The randomness does not change between retries, but the block.timestamp does, which gives the user another spin of the wheel at a later time.
Exploitation
The report gives concrete demonstrations for each attack vector. The assumptions are the initial values of jackpotProbabilities, jackpotPrizes and plumeAmounts, and a campaignStartDate of Monday at midnight.
Wait until a better day of the week
A draw that only wins a Plume token on day D can win the jackpot on day D+1, because the jackpotProbabilities are monotonically increasing. As winning Plume tokens still guarantees a call to _safeTransferPlume(), one can revert the callback and wait for a day that would yield the jackpot.
Concretely: Bob starts a spin on Tuesday and gets randomness of 4. This is not enough for the jackpot on Tuesday (jackpotThreshold=3), but Bob does get a Plume token. He purposefully reverts the entire transaction and waits until the callback is invoked on Thursday. Then the same randomness of 4 is below the Thursday jackpotThreshold (=7), and so Bob gets the jackpot.
Wait until next week
A draw that wins a small jackpot on week W can win a larger jackpot on week W+1 by delaying the callback until the later week.
Concretely: Bob starts a spin on Sunday in the second week and gets a randomness of 0. This is below the jackpotThreshold and so Bob is entitled to 5,000 Plume tokens. However, he can revert the callback and wait until Monday (beginning of the third week), where this randomness would net him 10,000 tokens.
Avoid losing the jackpot
If in a week W the jackpot was already taken, naively leaving the user empty-handed, it is worthwhile to postpone the spin to next week and try to win next week's unclaimed jackpot.
Concretely: Bob starts a spin on Sunday in the first week and gets a randomness of 0. This is below the jackpotThreshold, but the jackpot was already claimed, so Bob is entitled to 0 tokens. handleRandomness() would still call _safeTransferPlume() with 0 tokens, so Bob can revert the callback and wait until Monday (beginning of the second week), where this randomness would net him 5,000 tokens.
Gas drain
Always revert the transaction, if Plume tokens have been won, to repeatedly cause failed callbacks and steal gas from the sponsor who provided the gas funds for Supra.
Concretely: Bob starts a spin on Tuesday and gets randomness of 1000, which nets him one Plume token. He decides to revert this transaction to waste gas for the sponsor. After six hours, the callback is retried, and Bob reverts again. This can repeat up to 8 times, wasting a considerable amount of gas fees paid by the sponsor.
Root cause
The payout and the reward decision are coupled in the same callback. handleRandomness() computes the reward with determineReward(), which reads the current block.timestamp, and then immediately performs the transfer through _safeTransferPlume(). Because _safeTransferPlume requires the low-level call to succeed, a recipient contract that rejects the transfer makes the whole callback revert, and no state from that callback is committed.
The randomness is already fixed at that point, but the timestamp is not, so every retry re-evaluates the same randomness against a later day and week. The retry policy of Supra dVRF V3, which retries failed callback transactions due to insufficient gas every 6 hours for up to 48 hours, gives the attacker repeated attempts. The existing design has no mechanism that separates the randomness result from the payout, and no mechanism that prevents the recipient from forcing the callback to fail.
Impact
A malicious user can revert the callback whenever the current outcome is not to their liking, as long as they have won at least a Plume token, or even 0 tokens in the case where the jackpot was already claimed, because _safeTransferPlume() is still called. This lets them wait for a day with a higher jackpotThreshold or for the next week's larger or unclaimed jackpot, improving their payout at the expense of other users. Separately, repeatedly reverting the callback drains the gas budget of the sponsor who provided the gas funds for Supra, with up to 8 retries per spin. The report lists the impacts as theft of gas and direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield.
Fix
The report does not describe a fix or a change that was made. The design issue it identifies is the immediate payout inside the callback combined with a timestamp-dependent reward decision, so any fix would need to break that coupling, for example by recording the outcome and letting the user claim it later, or by making the payout unable to revert the callback. The report itself does not state which approach was taken.
Variants to test
- Any oracle callback that both decides an outcome from
block.timestampand pays out in the same transaction. A positive result is a randomness value that maps to a different prize on a later day or week, reachable through the retry window. - Payout paths that use a low-level call requiring success, where the recipient can be a contract. A positive result is a callback that can be forced to revert by the recipient while the randomness stays valid for a retry.
- Zero-value transfers that are still attempted. A positive result is a callback that calls the transfer function even when the computed reward is 0, giving the recipient a revert lever with no prize at stake.
- Retry policies of other randomness providers. A positive result is a documented retry schedule, such as every 6 hours for up to 48 hours, that multiplies the number of attempts an attacker gets from one spin.
Hunting notes
This kind of bug tends to hide where an external oracle callback combines a time-dependent decision with an immediate transfer to a user-controlled address. During recon, look for reward or lottery contracts that read block.timestamp inside the callback, for thresholds or prize tables that change over the campaign, and for payout helpers that require a low-level call to succeed. The retry behaviour of the randomness provider is part of the attack surface: a provider that retries failed callbacks gives the attacker repeated attempts with the same randomness.
The researcher gave a concrete scenario for each consequence, with named randomness values, thresholds and token amounts, and referenced the provider's documented retry policy. That turns a generic "callback can revert" observation into specific wins and a quantified gas drain.
What happened, in plain words
Plume Network ran a game that works like a spin of a wheel. You start a spin, a random number is produced for you, and the game decides what you have won based on that number. The report looks at the smart contract that runs this game, Spin.sol, and finds a flaw in the order in which things happen.
The key point is that the prize is not decided when you start the spin. It is decided later, when the random number is delivered back to the contract, and the decision depends on the current date and time. The contract then pays the prize out immediately in the same step. If the payment fails, the whole step is undone, and the random number provider tries again a few hours later. Because the random number stays the same but the date and time have moved on, the same number can now be worth a bigger prize. A player who can make the payment fail on purpose can therefore keep re-rolling the outcome in time until it suits them, and can also burn the sponsor's money on gas.
Context
The product and the feature
The target is the Spin.sol contract of the Plume Network Attackathon. A smart contract is a small program that lives on a blockchain. A blockchain is a shared record book that many computers keep copies of, and a smart contract runs automatically when someone sends it a transaction. Nobody can change its code after it is deployed, and every run is visible to everyone.
The contract implements a spin-the-wheel style game. The flow is:
- A user starts a spin.
- The contract asks an outside service for a random number.
- That service later calls back into the contract with the number.
- The function
handleRandomness()decides what the user has won and pays it out immediately by calling_safeTransferPlume().
An oracle is an outside service that feeds information into a blockchain, because a contract cannot reach the internet by itself. Here the oracle is Supra dVRF. dVRF stands for decentralised Verifiable Random Function: a service that produces random numbers and proves they were produced fairly. A callback is the moment the oracle calls back into the contract to hand over the result. Think of ordering a parcel: you place the order (start the spin), and later the courier knocks on your door (the callback).
Why the timing matters
The reward decision is not fixed at the moment the spin is started. determineReward() depends on the current block.timestamp. A timestamp is simply the date and time attached to a block. A block is a batch of transactions added to the blockchain, and each block carries the time it was created. So block.timestamp is, in effect, "the current time according to the blockchain".
Because of this, the same random number can map to different prizes depending on the day of the week and the week number at the time the callback executes. The jackpotProbabilities are monotonically increasing over the campaign. A threshold here is a cut-off: a random number below it wins the jackpot. Monotonically increasing means the values only ever go up, never down, as the campaign progresses. A campaign is the period during which the game runs.
The report itself
The report was submitted on Jul 24th 2025 at 14:12:28 UTC by @Oppi992, report ID #50428, severity Medium. Severity is the rating of how serious a bug is, from low to critical. The listed impacts are theft of gas and direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield. Gas is the fee paid to run a transaction on a blockchain, a bit like postage. Funds at-rest means money sitting in an account; in-motion means money currently being moved by a transaction. Unclaimed yield means rewards that have been earned but not yet collected, which the report explicitly excludes from the impact.
Setup
The proof of concept assumes the initial values of jackpotProbabilities, jackpotPrizes and plumeAmounts, and a campaignStartDate of Monday at midnight. A proof of concept is a concrete demonstration that a bug really works, rather than just a claim. No accounts, tools or versions beyond that are described.
The relevant external precondition is the behaviour of Supra dVRF V3. According to the documentation referenced in the report, failed callback transactions due to insufficient gas are automatically retried every 6 hours, for up to 48 hours. In plain terms: if the callback runs out of gas and fails, the oracle does not give up. It tries again six hours later, and keeps trying for two days. The oracle keeps retrying within that window, which matters a great deal below.
Finding it
The researcher noticed that handleRandomness() pays out rewards immediately by calling _safeTransferPlume(). If the recipient is a contract that reverts on receiving the assets, the whole callback reverts. To revert means to cancel and undo a transaction completely, as if it never happened. A contract here means the recipient is not an ordinary person's wallet but another program, and a program can be written to refuse incoming payments on purpose.
Because Supra dVRF retries failed callbacks, and because determineReward() depends on the current block.timestamp, an attacker can delay the successful callback until a more favourable timestamp, or drain the sponsor's gas budget. The sponsor is the party paying the gas for the oracle's callbacks.
On a successful spin, handleRandomness() calls _safeTransferPlume() to send the winning user the rewards via a low-level value transfer. A low-level call is a way for one contract to send value or data to another address without the usual safety wrapper; it reports success or failure back to the caller instead of handling errors itself. Since this low-level call can be purposefully rejected, and since _safeTransferPlume requires the low-level call to succeed, a malicious user can decide to revert the entire callback by spending all the available gas. Spending all the gas is a reliable way to force a failure: the transaction runs out of fuel and is cancelled.
The randomness does not change between retries, but the block.timestamp does, which gives the user another spin of the wheel at a later time. The random number is locked in; only the clock moves. That is the heart of the bug.
Exploitation
The report gives concrete demonstrations for each attack vector. An attack vector is a particular way of carrying out the attack. The assumptions are the initial values of jackpotProbabilities, jackpotPrizes and plumeAmounts, and a campaignStartDate of Monday at midnight.
Wait until a better day of the week
A draw that only wins a Plume token on day D can win the jackpot on day D+1, because the jackpotProbabilities are monotonically increasing. As winning Plume tokens still guarantees a call to _safeTransferPlume(), one can revert the callback and wait for a day that would yield the jackpot.
Concretely: Bob starts a spin on Tuesday and gets randomness of 4. This is not enough for the jackpot on Tuesday (jackpotThreshold=3), but Bob does get a Plume token. He purposefully reverts the entire transaction and waits until the callback is invoked on Thursday. Then the same randomness of 4 is below the Thursday jackpotThreshold (=7), and so Bob gets the jackpot.
In plain words: on Tuesday the cut-off is 3, and Bob's number 4 is above it, so no jackpot. On Thursday the cut-off has risen to 7, and the same number 4 is now below it, so the jackpot is his. He did not get a new random number; he simply refused the first payout and let the retry happen on a better day.
Wait until next week
A draw that wins a small jackpot on week W can win a larger jackpot on week W+1 by delaying the callback until the later week.
Concretely: Bob starts a spin on Sunday in the second week and gets a randomness of 0. This is below the jackpotThreshold and so Bob is entitled to 5,000 Plume tokens. However, he can revert the callback and wait until Monday (beginning of the third week), where this randomness would net him 10,000 tokens.
In plain words: the same number 0 is a winning number in both weeks, but the prize table has grown, so waiting one day more than doubles the payout.
Avoid losing the jackpot
If in a week W the jackpot was already taken, naively leaving the user empty-handed, it is worthwhile to postpone the spin to next week and try to win next week's unclaimed jackpot.
Concretely: Bob starts a spin on Sunday in the first week and gets a randomness of 0. This is below the jackpotThreshold, but the jackpot was already claimed, so Bob is entitled to 0 tokens. handleRandomness() would still call _safeTransferPlume() with 0 tokens, so Bob can revert the callback and wait until Monday (beginning of the second week), where this randomness would net him 5,000 tokens.
In plain words: even a payout of zero still triggers the transfer call, and that call is the lever Bob needs. He can refuse a worthless outcome and try again in a week where the jackpot is still available.
Gas drain
Always revert the transaction, if Plume tokens have been won, to repeatedly cause failed callbacks and steal gas from the sponsor who provided the gas funds for Supra.
Concretely: Bob starts a spin on Tuesday and gets randomness of 1000, which nets him one Plume token. He decides to revert this transaction to waste gas for the sponsor. After six hours, the callback is retried, and Bob reverts again. This can repeat up to 8 times, wasting a considerable amount of gas fees paid by the sponsor.
In plain words: every failed attempt still costs gas, and the sponsor pays it. Repeated retries across many spins add up.
Root cause
The payout and the reward decision are coupled in the same callback. handleRandomness() computes the reward with determineReward(), which reads the current block.timestamp, and then immediately performs the transfer through _safeTransferPlume(). Because _safeTransferPlume requires the low-level call to succeed, a recipient contract that rejects the transfer makes the whole callback revert, and no state from that callback is committed. State means the stored data of the contract, such as who owns what; if the callback reverts, none of its changes are saved.
The randomness is already fixed at that point, but the timestamp is not, so every retry re-evaluates the same randomness against a later day and week. The retry policy of Supra dVRF V3, which retries failed callback transactions due to insufficient gas every 6 hours for up to 48 hours, gives the attacker repeated attempts. The existing design has no mechanism that separates the randomness result from the payout, and no mechanism that prevents the recipient from forcing the callback to fail.
A useful comparison is a shop that decides the price of your item at the till, and if you refuse to pay, the shop keeps your order open and lets you come back later at the new price. If prices only rise, refusing is a strategy.
Impact
A malicious user can revert the callback whenever the current outcome is not to their liking, as long as they have won at least a Plume token, or even 0 tokens in the case where the jackpot was already claimed, because _safeTransferPlume() is still called. This lets them wait for a day with a higher jackpotThreshold or for the next week's larger or unclaimed jackpot, improving their payout at the expense of other users. Separately, repeatedly reverting the callback drains the gas budget of the sponsor who provided the gas funds for Supra, with up to 8 retries per spin. The report lists the impacts as theft of gas and direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield.
Fix
The report does not describe a fix or a change that was made. The design issue it identifies is the immediate payout inside the callback combined with a timestamp-dependent reward decision, so any fix would need to break that coupling, for example by recording the outcome and letting the user claim it later, or by making the payout unable to revert the callback. The report itself does not state which approach was taken.
Variants to test
These are the same four angles the technical write-up lists, for anyone hunting similar bugs elsewhere:
- Any oracle callback that both decides an outcome from
block.timestampand pays out in the same transaction. A positive result is a randomness value that maps to a different prize on a later day or week, reachable through the retry window. - Payout paths that use a low-level call requiring success, where the recipient can be a contract. A positive result is a callback that can be forced to revert by the recipient while the randomness stays valid for a retry.
- Zero-value transfers that are still attempted. A positive result is a callback that calls the transfer function even when the computed reward is 0, giving the recipient a revert lever with no prize at stake.
- Retry policies of other randomness providers. A positive result is a documented retry schedule, such as every 6 hours for up to 48 hours, that multiplies the number of attempts an attacker gets from one spin.
Hunting notes
This kind of bug tends to hide where an external oracle callback combines a time-dependent decision with an immediate transfer to a user-controlled address. During recon, look for reward or lottery contracts that read block.timestamp inside the callback, for thresholds or prize tables that change over the campaign, and for payout helpers that require a low-level call to succeed. Recon means the early survey of a target before testing it in depth. The retry behaviour of the randomness provider is part of the attack surface: a provider that retries failed callbacks gives the attacker repeated attempts with the same randomness. Attack surface is the total set of places where an attacker could try to get in.
The researcher gave a concrete scenario for each consequence, with named randomness values, thresholds and token amounts, and referenced the provider's documented retry policy. That turns a generic "callback can revert" observation into specific wins and a quantified gas drain.
Glossary
- Smart contract: a program stored on a blockchain that runs automatically when transactions are sent to it.
- Blockchain: a shared, tamper-resistant record book kept in copies by many computers.
- Transaction: a request sent to a blockchain to run an action, such as starting a spin.
- Block: a batch of transactions added to the blockchain together, carrying a timestamp.
block.timestamp: the date and time recorded for the current block, used by contracts as "now".- Oracle: an outside service that supplies data, such as random numbers, to a blockchain.
- Supra dVRF: the random number service used by the game; dVRF means decentralised Verifiable Random Function.
- Callback: the moment the oracle calls back into the contract to deliver the random number.
- Revert: to cancel and undo a transaction completely, as if it never happened.
- Gas: the fee paid to run a transaction on a blockchain.
- Gas drain: wasting another party's gas budget through repeated failed transactions.
- Low-level call: a way for a contract to send value or data to an address without the usual safety wrapper, reporting success or failure back to the caller.
_safeTransferPlume(): the contract's payout helper that sends Plume tokens and requires the underlying low-level call to succeed.handleRandomness(): the callback function that decides the prize and pays it out.determineReward(): the function that computes the prize, reading the currentblock.timestamp.jackpotThreshold: the cut-off value a random number must fall below to win the jackpot.jackpotProbabilities: the jackpot odds, which only increase over the campaign (monotonically increasing).jackpotPrizes: the prize amounts for the jackpot, which grow over the campaign.plumeAmounts: the amounts of Plume tokens awarded for smaller wins.campaignStartDate: the date the game campaign begins; the proof of concept assumes Monday at midnight.- Monotonically increasing: only ever going up, never down.
- Threshold: a cut-off value that separates a win from a loss.
- Campaign: the period during which the game runs.
- Sponsor: the party paying the gas for the oracle's callbacks.
- State: the stored data of a contract, such as balances; a reverted transaction commits none of it.
- Severity: the rating of how serious a bug is, from low to critical.
- Proof of concept: a concrete demonstration that a bug really works.
- Attack vector: a particular way of carrying out an attack.
- Attack surface: the total set of places where an attacker could try to get in.
- Recon: the early survey of a target before testing it in depth.
- Funds at-rest / in-motion: money sitting in an account versus money currently being moved by a transaction.
- Unclaimed yield: rewards that have been earned but not yet collected.
- Retry: an automatic second attempt by the oracle after a failed callback.