Likelihood: High — selectWinner has no access control, so the attacker chooses the block and computes the keccak256 result off-chain before calling. All inputs (msg.sender, block.timestamp, block.difficulty) are known at call time.
Impact: High — the attacker can guarantee they win the raffle, stealing the prize pool (80% of all entrance fees) from honest participants.
This test shows the attacker can force their own win. They enter the raffle,
then brute-force a block.difficulty value off-chain until the contract's
keccak256 formula resolves to their own index. They set that value, call
selectWinner(), and the contract confirms they won — receiving the 4 ETH prize
and the NFT. No randomness is involved; the outcome is chosen in advance.
On-chain values cannot be a source of secure randomness; adding more of them
does not help. Use a verifiable randomness oracle such as Chainlink VRF, which
returns a random number with a cryptographic proof it was not manipulated.
Access control on selectWinner() is a complementary measure but does not fix
the randomness itself.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.