the raffle process relies on blockchain parameters and the caller's address for determining the winner and NFT rarity, making it susceptible to exploit.
a user could exploit the system by making repeated calls through various accounts to improve their chances of winning or achieving a desired rarity. the randomness is weak and highly exploitable.
A saavy actor can essentially predict if they will be the winners at a given block, and from there also easily determine the rarity of the nft that will be minted to them. The WinnerSelect and rarity calculations are essentially not different enough to make this vector infeasible.
WinnerIndex relies on the calculation 'keccak256(abi.encodePacked(msg.sender,block.timestamp,block.difficulty))'
And rarity relies on the calculation 'keccak256(abi.encodePacked(msg.sender, block.difficulty))'
This is a high impact vulnerability.
It is trivial to bypass the sibyl resistance mechanism(no duplicate addresses), so a motivated attacker with a lot of resources can essentially ensure a key they control is selected as a winner, and they can run simulations through various keys they control to see which key at which block will satisfy the requirements.
It becomes a serious issue once the value of a high-rarity NFT is much greater than the entrance fee. This would compromise the fairness of the lottery and could result in financial loss for other participants.
manual review
consider removing msg.sender from the randomness calculation, as that is an input the attacker can change at will. It is highly recommended to use decentralized randomness sources such as chainlink VRF
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.