Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minting receipts after withdrawRemainingTokens function has been called, can make that some participants wont be able to claim their receipts or protocol claim its fee. #249

Closed
code423n4 opened this issue Jan 29, 2023 · 4 comments
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 duplicate-601 edited-by-warden satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/QuestFactory.sol#L219
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleReceipt.sol#L98
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L81

Vulnerability details

Impact

The purpose of withdrawRemainingTokens is to withdraw all the tokens that wont be claimed by participants, because endTime has passed and some receipts were not minted. Leaving on the contract the exact amount for minted but not claimed receipts and for the protocol fee given the amount of minted receipts.

So the function has an assumption that receipts cannot be minted after endTime but following the control flow, there is no check that ensures this, nor a deadline for the signatures to be valid.

If someone mints a receipt after the owner called withdrawRemainingTokens then the contract wont have enough tokens to pay all the mintedd receipts nor the protocol fee.

Proof of Concept

Maybe the Front End wont stop giving signatures after endTime but the user can request a signature before endTime, and then cancelling the transaction but copying the valid signature to be used later.

Tools Used

Manual

Recommended Mitigation Steps

Make signatures have a deadline to be used or not allow minting after endTime

@code423n4 code423n4 added 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 labels Jan 29, 2023
code423n4 added a commit that referenced this issue Jan 29, 2023
@code423n4 code423n4 changed the title Minting receipts after withdrawRemainingTokens function has been called, can make that some participants wont be able to claim their receipts or protocol claim their fee. Minting receipts after withdrawRemainingTokens function has been called, can make that some participants wont be able to claim their receipts or protocol claim its fee. Jan 29, 2023
@c4-judge
Copy link
Contributor

c4-judge commented Feb 5, 2023

kirk-baird marked the issue as duplicate of #42

@c4-judge
Copy link
Contributor

c4-judge commented Feb 6, 2023

kirk-baird marked the issue as not a duplicate

@c4-judge c4-judge reopened this Feb 6, 2023
@c4-judge
Copy link
Contributor

c4-judge commented Feb 6, 2023

kirk-baird marked the issue as duplicate of #22

@c4-judge c4-judge closed this as completed Feb 6, 2023
@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Feb 14, 2023
@c4-judge
Copy link
Contributor

kirk-baird marked the issue as satisfactory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 duplicate-601 edited-by-warden satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants