In ERC1155 quests the owner withdraws all of the remaining tokens even for the unclaimed receipts. Leaving users who didn't claim their receipts before the quest end time unable to claim rewards. #631
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
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-528
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc1155Quest.sol#L54-L63
Vulnerability details
Impact
In ERC1155 quests the owner is able to withdraw all of the remaining tokens even for the unclaimed receipts.
This problem prevents users from claiming their rewards, as a receipt can be claimed only on its allocated quest.
Proof of Concept
In ERC1155 quests, the function
withdrawRemainingTokens
is called by the owner to withdraw the remaining tokens.The problem here is that the owner withdraws all of the ERC1155 tokens even the unclaimed ones, which are allocated to the users that finished the quest. As there is no check to see how many receipts were minted for this particular quest and how many receipts were claimed. The owner is able to withdraw all of the remaining tokens, preventing users from claiming their rewards as a minted receipt can be claimed only on its allocated quest contract.
Example:
We have 4 people - Jake, Finn, Alice and Kiki
withdrawRemainingTokens
and withdraws all of the tokens, as there is no check to see how many receipts were minted and how many were actually claimed.This problem prevents users from claiming their rewards, as the owner isn't supposed to withdraw the tokens allocated for the unclaimed receipts after the quest end time.
You can see that this is enforced in the ERC20 quests and the tokens for the unclaimed receipts can't be withdrawn by the owner at the end of the quest. This is clearly stated as well in the function comment on L79 - minted receipts should still be able to claim rewards even after the quest end time and can't be withdrawn by the owner.
Tools Used
Manual review
Recommended Mitigation Steps
Consider adding the function
receiptRedeemers
to Erc1155Quest.sol, which checks how many people actually finished the quest and got minted receipts. And refactor the functionwithdrawRemainingTokens
to withdraw the ERC1155 tokens without the unclaimed ones:The text was updated successfully, but these errors were encountered: