Erc1155Quest's withdrawRemainingTokens doesn't take in consideration unclaimed tokens #223
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
Erc1155Quest's
withdrawRemainingTokens
function allows the owner to claim all the remaining tokens, the unclaimed tickets will become worthless since they won't be claimable. Note this functionality for the Erc20Quest correctly take in consideration the unclaimed ticket remaining.Proof of Concept
The quest ended and there are 100 unclaimed tickets corresponding to 100 ERC1155 token rewards. The owner calls
withdrawRemainingTokens
and withdraw all the remaining tokens, the unclaimed tickets can't be claim anymore.Recommended Mitigation Steps
In
withdrawRemainingTokens
the correct amount of tokens to withdraw should be contract's ERC1155 tokens balance - unclaimed tokens (questFactoryContract.getNumberMinted(questId) - redeemedTokens).The text was updated successfully, but these errors were encountered: