withdrawRemainingTokens in Erc20Quest could be called several times by the owner, allowing him to withdraw part of the non-claimable tokens #638
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-b
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/main/contracts/Erc20Quest.sol#L81-L87
Vulnerability details
Impact
This would allow the owner to steal the ERC20 rewards which have not yet been claimed after the end of the claim, contradicting the natspec of
withdrawRemainingTokens
Proof of Concept
The owner simply has to wait the end of the quest and then call multiple times the
withdrawRemainingTokens
function.Recommended Mitigation Steps
Add a state variable
ownerHasWithdrawnRemaining
which would be set to true the first time the owner callswithdrawRemainingTokens
, and add arequire(!ownerHasWithdrawnRemaining)
at the start of the function.The text was updated successfully, but these errors were encountered: