Buyer on secondary NFT market can lose fund if they buy a NFT that is already used to claim the reward #119
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
M-08
primary issue
Highest quality submission among a set of duplicates
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L113
Vulnerability details
Impact
Buyer on secondary NFT market can lose fund if they buy a NFT that is already used to claim the reward
Proof of Concept
Let us look closely into the Quest.sol#claim function
After the NFT is used to claim, the _setClaimed(token) is called to mark the NFT as used to prevent double claiming.
The NFT is also tradeable in the secondary marketplace, I woud like to make a reasonable assumption that user wants to buy the NFT because they can use the NFT to claim the reward, which means after the reward is claimed, the NFT lose value.
Consider the case below:
User A can intentionally front-run User B's buy transaction by monitoring the mempool
in polygon using the service
https://www.blocknative.com/blog/polygon-mempool
Or it could be just two user submit transaction at the same and User A's claim transaction happens to execute first.
Tools Used
Manual Review
Recommended Mitigation Steps
Disable NFT transfer and trade once the NFT is used to claim the reward.
The text was updated successfully, but these errors were encountered: