initialize()
checks if admin
owns NFT but startDraw()
doesn't.
#105
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-88
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2022-12-forgeries/blob/fc271cf20c05ce857d967728edfb368c58881d85/src/VRFNFTRandomDraw.sol#L125-L136
https://github.com/code-423n4/2022-12-forgeries/blob/fc271cf20c05ce857d967728edfb368c58881d85/src/VRFNFTRandomDraw.sol#L172-L198
Vulnerability details
Impact
admin
can sell, transfer or have theirtokenId
NFT stolen via phishing attack to another address after initialising theVRFNFTRandomDraw
contract.This would make it impossible to
startDraw
becauseadmin
is no longer in possession oftokenId
.An
admin
with the intention of never really going through with the raffle could maliciouslyinitialize
a raffle just for PR purposes and then back out.This makes the contract far from trustless.
Proof of Concept
initialize()
checks ifadmin
owns NFT butstartDraw()
doesn't.https://github.com/code-423n4/2022-12-forgeries/blob/fc271cf20c05ce857d967728edfb368c58881d85/src/VRFNFTRandomDraw.sol#L125-L136
https://github.com/code-423n4/2022-12-forgeries/blob/fc271cf20c05ce857d967728edfb368c58881d85/src/VRFNFTRandomDraw.sol#L172-L198
For the reasons above and others mentioned in separate findings, I believe the disjointed execution of
initialize()
andstartDraw()
allows for
admin
to manipulate incentives for users to join a raffle and not follow through with his promise.Recommended Mitigation Steps
Make
startDraw()
internal and call it withininitialize()
.The text was updated successfully, but these errors were encountered: