The TwentyOne smart contract contains critical vulnerabilities in its randomness implementation, allowing miners/validators to manipulate game outcomes through MEV (Miner Extractable Value) exploitation.
The contract relies on block.timestamp, msg.sender, and block.prevrandao for randomness generation in two critical functions:
These values are predictable and manipulatable by miners/validators.
Proof of concept demonstrates:
Winning hand manipulation using timestamp 1700000002
Predictable dealer bust patterns
Consistent profit generation through MEV
Miners can simulate and choose profitable game outcomes
Players with MEV capabilities can manipulate dealer behavior
Front-running opportunities for guaranteed wins
Potential for systematic draining of contract funds
slither .
aderyn
manuel code review
Replace current randomness with Chainlink VRF:
Implement commit-reveal scheme:
Use time-delayed randomness:
Separate game initiation and outcome determination
Use future block hashes as entropy source
Implement minimum waiting period
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.