RabbitHole Quest Protocol contest - vagrant'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: 165/173

Findings: 1

Award: $2.59

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

Impact

The Owner can set the minterAddress at any point to an arbitrary address that is not the original QuestFactory via: https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleReceipt.sol#L83 An exploit could look like this:

  1. The owner sets minterAddress to his own address
  2. Mints infinite amount of receipts
  3. Owner redeems them

Also possible, but less likely in my opinion: He could grief other participants via minting an infinte amount of tokens to participants address. This prevent them from successfully calling Quest.claim() due to transaction running out of gas: https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L99 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L104 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L113

But simply setting the minterAddress to something other than the QuestFactory will already be sufficient since that will break QuestFactory.mintReceipt()

Proof of Concept

https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleReceipt.sol#L83 An exploit could look like this:

  1. The owner sets minterAddress to his own address
  2. Mints infinite amount of receipts
  3. Owner redeems them

Also possible, but less likely in my opinion: He could grief other participants via minting an infinte amount of tokens to participants address. This prevent them from successfully calling Quest.claim() due to transaction running out of gas: https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L99 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L104 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L113

Tools Used

Manual Analysis

I am not sure whether it is needed to have a function that can set the minterAddress after it has been set in Initialze(). Remove the setMinterAddress function if possible.

#0 - c4-judge

2023-02-06T08:58:21Z

kirk-baird marked the issue as duplicate of #9

#1 - c4-judge

2023-02-14T08:34:07Z

kirk-baird changed the severity to 3 (High Risk)

#2 - c4-judge

2023-02-14T08:34:07Z

kirk-baird changed the severity to 3 (High Risk)

#3 - c4-judge

2023-02-14T08:37:39Z

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