Description:
Predictable Inputs
block.timestamp: The block timestamp can be influenced to a small degree by miners (within ~15 seconds of variability), allowing them to manipulate the randomness outcome.
msg.sender: The address of the caller is deterministic and fully controlled by the user executing the transaction.
block.prevrandao: Although this is sourced from the randomness beacon introduced in Ethereum's PoS consensus, it may still be insufficiently random when combined with the other weak factors.
Miner Manipulation
Miners have control over both block.timestamp and block.prevrandao to some extent. By strategically adjusting these values, they can bias the randomness to favor a particular outcome.
For example, if an attacker is also the miner, they can influence the random index to draw specific cards for the player or the dealer.
Impact:
Drawing a random card for either the dealer or player can be manipulated by an attacker to obtain a desired card, enabling the player to win.
An attacker can exploit this weakness to predict or manipulate the outcome of drawCard().
For example, they can ensure the player receives high-value cards while the dealer gets low-value cards, thereby guaranteeing a win for the attacker.
Proof of Concept:
Recommended Mitigation:
Use Chainlink VRF:
Integrate Chainlink's Verifiable Random Function (VRF) to generate cryptographically secure random numbers that are unpredictable and tamper-proof.
Avoid On-Chain Only Randomness:
Avoid relying solely on on-chain inputs like block.timestamp and block.prevrandao.
Combine with off-chain randomness for stronger entropy.
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.