Closed code423n4 closed 1 year ago
kirk-baird marked the issue as duplicate of #42
kirk-baird changed the severity to QA (Quality Assurance)
This previously downgraded issue has been upgraded by kirk-baird
kirk-baird marked the issue as satisfactory
kirk-baird changed the severity to 2 (Med Risk)
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc1155Quest.sol#L54-L63
Vulnerability details
Impact
Erc1155Quest
like theErc20Quest
have a method that allows the owner of the quest to withdraw all the remaining tokens once the quest has passed theendTime
.The main difference is that the
Erc1155Quest
contract does not check if some of those token have been already "locked" to some user that has minted a receipt.Once the owner has called
withdrawRemainingTokens
those users will not be able to redeem their reward anymore.Let's make an example
1)
alice
complete a quest and receive a receipt 2)alice
decide to wait before claiming the reward 3) The quest end and theowner
of it callwithdrawRemainingTokens
transferring all the tokens that the quest owns 4)alice
will not be able anymore to callclaim
because now the quest has 0 balance of the reward tokenProof of Concept
Link to affected code
Test code
Tools Used
Manual review + Test
Recommended Mitigation Steps
The
withdrawRemainingTokens
function should check if there are some receipts minted that have not been claimed yet and transfer only the difference between the current balance and that amount.