Already claimed receipt could be sold on secondary markets but the receiver will not be able to claim the rewards #562
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-119
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleReceipt.sol#L143-L155
Vulnerability details
Impact
Each user who completes a quest will receive a receipt. That specific receipt can be redeemed at any point to gain a reward token.
A user could decide not to be interested in the reward and sell their receipt to another user in exchange for something.
The second user will be able to claim the reward because now it owns the receipt.
The problem exists if the first user will claim the reward before transferring the receipt. The second user will not be able to claim the reward anymore.
Let's make an example
alice
complete a quest and receive a receipt withtokenId = 1
by callingfactory.mintReceipt(...)
alice
decide to claim the reward by callingquest.claim(...)
alice
decide to sell the receipt on secondary marketbob
is interested in the reward and exchange the receipt for1 ETH
bob
at this point will not be able to receive the reward because it has been already claimed byalice
Proof of Concept
Link to affected code
Test code
Tools Used
Manual review + Test
Recommended Mitigation Steps
There are two possible solutions to the problem
_beforeTokenTransfer
hook ofRabbitHoleReceipt
could implement a check that prevents a token to be transferred if it has been already claimedThe text was updated successfully, but these errors were encountered: