After ERC1155 quest ends, admin can withdraw rewards that are still meant to be claimed #233
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
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc1155Quest.sol#L54-L62
Vulnerability details
Impact
It should be possible for users to claim rewards after quest ends. However, for ERC1155 Quests owner can withdraw all tokens from the contract as soon as the quest ends by calling
withdrawRemainingTokens
. Then, if someone tries to claim a reward with a valid receipt, the execution will revert due to insufficient balance.Proof of Concept
The following test reverts due to 'ERC1155: insufficient balance for transfer'. This test:
withdrawRemainingTokens
by the ownerTools Used
Manual Review
Recommended Mitigation Steps
Similar to ERC20 Quest, I recommend calculating how many receipts haven't been claimed yet and leaving corresponding amount of tokens on the contract.
The text was updated successfully, but these errors were encountered: