owner can withdraw the NFT at any time if they wait with starting the draw until after recoverTimelock
#214
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-146
satisfactory
satisfies C4 submission criteria; eligible for awards
upgraded by judge
Original issue severity upgraded from QA/Gas by judge
Lines of code
https://github.com/code-423n4/2022-12-forgeries/blob/main/src/VRFNFTRandomDraw.sol#L306
Vulnerability details
Description
When creating a random draw the owner specifices a
recoverTimelock
which is a last resort option to recover the raffled NFT if the draw fails.There are some validations that this is between a week and a year in the future but there's no guarantee that the draw actually will start before the
recoverTimeLock
is possible.Impact
A malicious owner could wait with starting the draw until after
recoverTimeLock
and thus affect the outcome of the draw by withdrawing the NFT before the winner can claim it.This could affect trust in using this protocol for random draws as the winner is not guaranteed a chance to claim their NFT.
Eve holds a lottery of a fancy ArtGobbler for her two friends Alice and Bob. She mints two NFT lottery tickets for 10 eth each. Eve opens the random draw but waits with starting the draw until after
recoverTimeLock
has passed. Then when the result comes in and one of them wins Eve quickly callslastResortTimelockOwnerClaimNFT
to take back the NFT and keep the funds.Proof of Concept
PoC test in
VRFNFTRandomDraw.t.sol
:Tools Used
manual review, forge
Recommended Mitigation Steps
instead of providing an absolute timestamp in
recoverTimeLock
have it as arecoverTime
which is set when the NFT is transferred to the contract (startDraw
).That way the user knows that the NFT will be available to claim for a certain time once the draw starts.
The text was updated successfully, but these errors were encountered: