The contract uses a predictable source of randomness in the selectWinner function. The randomness for selecting the raffle winner is derived from on-chain data, specifically block.timestamp, msg.sender, and block.difficulty:
These parameters, particularly block.timestamp and block.difficulty, can be influenced or predicted to a certain extent. block.timestamp can be manipulated by miners within certain boundaries, and block.difficulty follows a predictable adjustment pattern. Additionally, msg.sender is known to the participant initiating the transaction. This predictability can be exploited by a miner or a participant with the ability to influence transaction order, allowing them to increase their chances of winning the raffle.
The use of predictable sources of randomness compromises the fairness and security of the raffle process. Miners or participants with advanced knowledge or control over these parameters could manipulate the outcome to their advantage. This undermines the integrity of the raffle, leading to a loss of trust and potential financial loss for other participants.
Use of Verifiable Random Function (VRF): Implement a more secure randomness generation mechanism, such as Chainlink's VRF (Verifiable Random Function), which provides provably fair and tamper-proof random numbers.
Off-Chain Randomness: Consider generating randomness off-chain using a trusted oracle service and feeding it into the contract securely.
Commit-Reveal Scheme: Implement a commit-reveal scheme where participants submit hashes of their secret values in one transaction and reveal them in a subsequent transaction, contributing to the randomness.
Enhanced On-Chain Randomness: If on-chain randomness is necessary, combine multiple unpredictable sources and consider adding participant-generated randomness to increase unpredictability.
Root cause: bad RNG Impact: manipulate winner
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.