VRFNFTRandomDraw admin can prevent created or started raffle from taking place
The admin/owner of a raffle contract can start a draw in a way that prevents the random number oracle from ever fulfilling it, for example by supplying an invalid key hash or ensuring the VRF subscription lacks funds. This allows the owner to avoid paying out the reward NFT while still appearing to start the raffle.
Submitted by 9svR6w, also found by deliriusz, BAHOZ, 0xdeadbeef0x, trustindistrust, gasperpre, and codeislight
Impact
The admin/owner of VRFNFTRandomDraw can startDraw() a raffle, including emitting the SetupDraw event, but in a way that ensures fulfillRandomWords() is never called. For example:
-
keyHashis not validated withincoordinator.requestRandomWords(). Providing an invalidkeyHashwill allow the raffle to start but prevent the oracle from actually supplying a random value to determine the raffle result. -
The admin/owner could alternatively ensure that the owner-provided chain.link VRF subscription does not have sufficient funds to pay at the time the oracle attempts to supply random values in
fulfillRandomWords().
In addition, the owner/admin could simply avoid ever calling startDraw() in the first place.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Recommended Mitigation Steps
Depending on the desired functionality with respect to the raffle owner, a successful callback to fulfillRandomWords() could be a precondition of the admin/owner reclaiming the reward NFT. This would help ensure the owner does not create raffles that they intend will never pay out a reward.
iainnash (Forgeries) confirmed
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the contract does not validate that the VRF key hash is correct or that the subscription has sufficient funds before starting the draw, and it does not require a successful random number callback before the owner can reclaim the prize.
Impact
The raffle owner can start a raffle that will never complete, so the reward NFT is never awarded, while the owner may still reclaim it.
What the attacker needed
Attacker is the raffle admin/owner; raffle uses Chainlink VRF
The fix
A successful callback to `fulfillRandomWords()` should be a precondition for the admin/owner to reclaim the reward NFT, ensuring the owner cannot create raffles intended never to pay out.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A raffle contract lets an owner start a draw, but the winner is chosen by an external random number service. The owner can start the draw with settings that make the random number service fail, so the raffle never finishes and the prize is never awarded. This means the owner can pretend to run a raffle without ever giving away the prize.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.