The dealer's threshold can be manipulated since the randomness is predictible.
The attacker can win all the time, and withdraw all the token of the smart contract.
In traditionnal Black Jack games, threshold is fixed at 17. If the dealer has strictly more than 16 in his hands, he stops here.
Here, the dealer's threshold is calculated before hitting a card.
The standThreshold variable in TwentyOne:call function, which represents the dealer's threshold, is generated with a pseudorandom mecanism, block.prevrandao.
This implementation causes an issue because this random number is predictible. Since block.prevrandao can be predicted (or manipulated by validators), block.timestamp fixed when the current block is mined,
and msg.sender fixed, the attacker could find the correct configuration to trick this variable.
If the attacker managed to have standThreshold equal to 21, then he will win for sure since the dealer's will always be over 21 (he will hit cards until he reaches 21).
Moreover, the standThreshold variable will remain the same in the same block. If the attacker managed to have multiple transactions in one block, it could win more than one time a block.
The impact is critical because an attacker could potentially withdaw all the Ether of the smart contract.
Use Chainlink VRF for true randomness
Randomness Manipulation: The randomness mechanism relies on block.timestamp, msg.sender, and block.prevrandao, which may be predictable in certain scenarios. Consider using Chainlink VRF or another oracle for more secure randomness.
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.