Admin can withdraw the NFT before the winner timelock ends #246
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-146
edited-by-warden
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#L75-L138
Vulnerability details
Impact
The admin could set
recoverTimelock
beforedrawBufferTime
, thus he can withdraw the NFT before the winner Draw buffer time ends.Proof of Concept
The
drawBufferTime
need to be more then an hour and less then a month and therecoverTimelock
need to be at least a week, therefore if the admin setsrecoverTimelock
beforedrawBufferTime
(It could happen by mistake):In the case of a malicious admin:
In the case of an honest admin:
In past audits, we have seen contract admins claim that invalidated configuration setters are fine since “admins are trustworthy”. However, cases such as Nomad got drained for over $150M and Misconfiguration in the Acala stablecoin project allows attacker to steal 1.2 billion aUSD have shown again and again that even trustable entities can make mistakes. Thus any fields that might potentially result in insolvency of protocol should be thoroughly checked.
This is simple test that shows how the admin could withdraw the NFT before the winner:
Tools Used
Manual Review
Recommended Mitigation Steps
Add this check in the initialize function te prevent
recoverTimelock
from being set beforedrawBufferTime
.The text was updated successfully, but these errors were encountered: