RabbitHole Quest Protocol contest - M4TZ1P's results

A protocol to distribute token rewards for completing on-chain tasks.

General Information

Platform: Code4rena

Start Date: 25/01/2023

Pot Size: $36,500 USDC

Total HM: 11

Participants: 173

Period: 5 days

Judge: kirk-baird

Total Solo HM: 1

Id: 208

League: ETH

RabbitHole

Findings Distribution

Researcher Performance

Rank: 82/173

Findings: 2

Award: $22.36

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L102-L104

Vulnerability details

Impact

Since there is no code to check whether fee has been drawn, withdrawFee() might be called multiple times. This allows protocolFeeRecipient to steal all of the unclaimed reward tokens after quest ended.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

Tools Used

Sublime Text

Add a code to confirm that the fee can be withdrawn only once as shown below.

bool public withdrawal = false; function withdrawFee() public onlyAdminWithdrawAfterEnd { require(withdrawal == false, "already took withdraw fee"); withdrawal = true; IERC20(rewardToken).safeTransfer(protocolFeeRecipient, protocolFee()); }

#0 - c4-judge

2023-02-06T23:35:05Z

kirk-baird marked the issue as duplicate of #23

#1 - c4-judge

2023-02-14T08:54:11Z

kirk-baird marked the issue as satisfactory

Awards

21.6061 USDC - $21.61

Labels

bug
2 (Med Risk)
downgraded by judge
satisfactory
duplicate-601

External Links

Lines of code

https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L81-L87

Vulnerability details

Impact

mintReceipt could mint receipt after endtime. If owner execute withdrawRemainingTokens user’s receipt that mint after endtime can’t claim.

Proof of Concept

function withdrawRemainingTokens(address to_) public override onlyOwner { super.withdrawRemainingTokens(to_); uint unclaimedTokens = (receiptRedeemers() - redeemedTokens) * rewardAmountInWeiOrTokenId; uint256 nonClaimableTokens = IERC20(rewardToken).balanceOf(address(this)) - protocolFee() - unclaimedTokens; IERC20(rewardToken).safeTransfer(to_, nonClaimableTokens); }

withdrawRemainingTokens withdraw all of fund in Quest except unredeemedToken. unredeemedToken doesn’t contain unminted receipt so when mint receipt after withdrawRemainingTokens are unclaimable.

Tools Used

Sublime Text

prevent receipt after endtime or withdrawRemainingTokens.

#0 - c4-judge

2023-02-06T23:35:56Z

kirk-baird marked the issue as duplicate of #22

#1 - c4-judge

2023-02-14T08:41:03Z

kirk-baird changed the severity to 2 (Med Risk)

#2 - c4-judge

2023-02-14T08:41:28Z

kirk-baird marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter