A high severity vulnerability was identified in the TwentyOne.sol
contract where the endGame()
function is vulnerable to reentrancy attacks. This allows malicious actors to transfer all ETH in single win.
The vulnerability exists in the following code section:
The reentrancy vulnerability arises because of the following sequence:
The contract executes payable(player).transfer(2 ether)
to send Ether to the player.
The transfer method invokes the player's fallback or receive function, allowing the player to execute arbitrary code before endGame
completes its execution.
A malicious player could exploit reentrancy to repeatedly play the game until he wins and triggers the endGame
function repeatedly using reentrancy and receive multiple payouts of 2 ether, draining the contract’s funds.
Use openzepplin's ReentrancyGuard
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.