The TwentyOne contract uses block parameters for randomness that remain constant within a transaction. Once an attacker finds a winning combination, they can repeat it in a loop to drain the contract's funds.
All randomness sources are constant within a block
Card draws become predictable once first attempt succeeds
Can be exploited within same transaction
Complete Fund Drain:
Winning combinations can be repeated
All contract funds can be extracted in one transaction
No limit on exploitation once winning path found
Economic Loss:
Contract can be emptied efficiently
Casino loses all deposited funds
Manual Code Review
PoC exploit contract
Secure Randomness Source:
Use Chainlink VRF or similar oracle
Implement proper commit-reveal scheme (potentially avoiding the need for VRF)
Per-Transaction Limits:
Restrict maximum wins per block
Add cooldown between games
Proper RNG:
Use accumulated entropy
Consider multiple randomness sources
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.
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.