Skip to content
Business logic Audit finding Intermediate

Winner selection vulnerability in yeetback contract allows multiple reward for the same lucky winner

The winner selection algorithm in the Yeetback contract can pick the same participant multiple times, allowing them to claim multiple shares of the reward pot. This leads to an unfair distribution of rewards, especially when there are fewer than 10 participants.

perseverance Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

41291 sc insight winner selection vulnerability in yeetback contract allows multiple reward for the same lucky winner

#41291 [SC-Insight] Winner Selection Vulnerability in Yeetback Contract Allows Multiple Reward for the Same Lucky Winner

Submitted on Mar 13th 2025 at 12:16:19 UTC by @perseverance for Audit Comp | Yeet

Description

Description

Brief/Intro

The Yeetback contract implements a winner selection mechanism where 10 winners are chosen from participants in each round to receive equal portions of the pot. However, due to a flaw in the winner selection algorithm, the same participant can be selected multiple times, allowing them to claim multiple rewards.

The vulnerability

Vulnerability Details

In the draftWinners function of the Yeetback contract, winners are selected using the following logic:

https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/Yeetback.sol#L79-L88

Solidity
    for (uint256 i; i < nrOfWinners; i++) {
            uint256 randomDataNumber = uint256(keccak256(abi.encodePacked(randomNumber, i)));
            uint256 winningYeetIndex = randomDataNumber % nrOfYeets; // index of the winning yeet
            address winnerAddress = yeetsInRound[round][winningYeetIndex];

            // Update amountToWinners and amountOfWins
            amountOfWins[round][winnerAddress] += 1;

            emit YeetbackWinner(round, winnerAddress, winnings, winningYeetIndex);
        }

The contract selects 10 winners regardless of the number of participants (nrOfYeets). Each duplicate selection increases the winner's amountOfWins count, allowing them to claim multiple portions of the reward pot.

The duplicate is not expected by the game theory and users as the document of Yeet stated: 20% of the prize pool is distributed via verifiably random lottery to 10 participating addresses . Reference: https://docs.yeetit.xyz/yeet/yeet-game/mechanics

The vulnerability exists in some scenarios:

  • Scenario 1:

    • If the nrOfYeets is less than 10, the modulo operation (randomDataNumber % nrOfYeets) will inevitably produce duplicate indices.

    Probably this scenarios is not high as the number of participants in the game usually higher than 10. But still this can happen.

  • In scenario 2 : If nrOfYeets is greateer than 10, that scenario is more likely to happen

    • There is no check to prevent the same address from being selected multiple times, so there is probability that the winningYeetIndex is duplicated multiple times. The smaller the nrOfYeets, the higher the probability of duplicates.

Impacts

About the severity assessment

This is a High severity issue because:

  1. It directly affects the economic fairness of the protocol
  2. It can lead to unfair distribution of reward when the number of participants is small
  3. The impact is more severe in early rounds or when participation is low

The duplicate is not expected by the game theory and users as the document of Yeet stated: 20% of the prize pool is distributed via verifiably random lottery to 10 participating addresses . Reference: https://docs.yeetit.xyz/yeet/yeet-game/mechanics

Bug Severity: High

I map the impact to the closest listed impact as this is related to unfair distribution of reward, lucky winner

Theft of unclaimed royalties

Theft of unclaimed yield

Recommendation

  • Take both scenarios in the algorithm
  • Implement the algorithm to avoid duplicates to avoid rewarding the same address multiple times.

Proof of Concept

Proof of Concept

Scenario 1: Small Number of Participants (nrOfYeets < 10)

  1. Alice, Bob, and Charlie participate by yeet() in round 1. Suppose the nrOfYeets is 3 participants. The contract adds them to yeetsInRound[1] array
  2. After the Round1 ends and cooldown period, a user call "restart()" in Yeet.sol to start Round 2. The contract calls addYeetback() with 100 BERA as the pot value
  3. The draftWinners() function is called back from entropyCallback() to select 10 winners
  4. Due to modulo operation with only 3 participants:
    • randomDataNumber % 3 will only produce values 0, 1, or 2
    • Some addresses must be selected multiple times to reach 10 winners
  5. Alice is selected 4 times, Bob 3 times, and Charlie 3 times
  6. When claiming rewards:
    • Alice claims 4/10 of the pot (40 BERA)
    • Bob claims 3/10 of the pot (30 BERA)
    • Charlie claims 3/10 of the pot (30 BERA)
  7. This results in unfair distribution where Alice receives more.

Scenario 2: Large Number of Participants (nrOfYeets > 10)

  1. 100 participants join Round 2 of Yeet
  2. After the Round2 ends and cooldown period, a user call "restart()" in Yeet.sol to start Round 3. The contract calls addYeetback() with 100 BERA as the pot value
  3. The draftWinners() function is called back from entropyCallback() to select 10 winners
  4. Due to the random modulo operation with 100 participants:
    • randomDataNumber % 100 can produce any value from 0 to 99
    • There is a probability that the same index is selected multiple times
  5. By chance, index 42 is selected twice:
    • First selection: randomDataNumber1 % 100 = 42
    • Second selection: randomDataNumber2 % 100 = 42
  6. The participant at index 42:
    • Gets their amountOfWins increased twice
    • Can claim 2/10 of the pot (20 BERA) instead of 1/10 (10 BERA)
  7. This creates an unfair advantage for the lucky participant who was selected multiple times

In both scenarios, the core issue is the lack of check for duplicate selections, allowing participants to receive multiple portions of the reward pot. The impact is more severe in Scenario 1 where duplicates are guaranteed, while Scenario 2 shows how the vulnerability can still affect fair distribution even with many participants.

The original report as published on Immunefi, by perseverance. 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 winner selection loop does not check for or prevent duplicate addresses, so the same index can be chosen multiple times.

Impact

A participant selected multiple times could claim a larger share of the reward pot, leading to unfair distribution; the text does not mention any defence that would limit this.

What the attacker needed

Participants join a round; round ends and cooldown passes; someone calls restart()

The fix

The algorithm should be changed to avoid selecting the same address more than once, for example by tracking selected indices or using a shuffle.

How it was found

  1. Participants join a round by calling yeet().
  2. After the round ends and cooldown, a user calls restart() to start the next round, which triggers addYeetback() with the pot value.
  3. The draftWinners() function is called from entropyCallback() to select 10 winners.
  4. The selection uses modulo operation on random numbers, which can produce duplicate indices.
  5. Duplicate winners have their amountOfWins increased, allowing them to claim multiple portions of the pot.

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 lottery, you expect each winner to be picked only once. Here, the code that picks winners can accidentally choose the same person more than once, so that person gets a bigger share of the prize. This is unfair to other participants.

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 perseverance

View all

35 more disclosed reports, best first.

More from Yeet

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.