Bad randomness vulnerability occurs when a smart contract relies on a source of randomness that is not truly random or that can be predicted by an attacker. This can allow an attacker to manipulate the outcome of a transaction or gain an unfair advantage over other users.
A Player can create a smart contract that frontrun the organiser when he execute selectRamIfNotSelected , this contract will check if by minting a new NFT the attacker could be select as Ram , so he mint NFT for free until he got select and let he organiser execute selectRamIfNotSelected , and after that he could get reward
A attacker can frontrun the organiser during selectRamIfNotSelected and be selected as RAM and get the reward.
This code is to be added into the smart contract Dussehra.sol#CounterTest
:
Result
The attacker is selected as RAM
Manual review.
Use Chainlink or an Oracle. Chainlink VRF (Verifiable Random Function) is a provably fair and verifiable random number generator (RNG) that enables smart contracts to access random values without compromising security or usability.
The organizer is trusted, but the function `ChoosingRam::selectRamIfNotSelected` uses a way to generate a random number that is not completely random.
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.