RabbitHole Quest Protocol contest - millersplanet'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: 151/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#L58-L61 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleReceipt.sol#L98-L104

Vulnerability details

Unrestricted minting of RabbitHoleReceipt tokens (ERC-721) due to improper access control

The RabbitHoleReceipt.sol contract has a onlyMinter() modifier attempting to allow a specific address only to be allowed to mint. However, the implementation for the modifier is not correct and allows any address to bypass it because it does not revert in case the minterAddress != msg.sender:

modifier onlyMinter() { msg.sender == minterAddress; _; }

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

Impact

Improper access control on incorrectly implemented modifier allows any caller to mint tokens on the protocol at any given time, ultimately rendering the value of the NFTs to zero.

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

Proof of Concept

  • Bob the attacker (or any curios user) calls the mint() function passing his address in the to_ parameter assigning any uncreated questId_ he likes.
  • He does it again. And again.

Tools Used

  • Manual review

Place an if() statement to check that the msg.sender is minterAddress and revert if it isn't.

modifier onlyMinter() { if (msg.sender != minterAddress) revert OnlyMinter(); _; }

#0 - c4-judge

2023-02-03T11:03:48Z

kirk-baird marked the issue as primary issue

#1 - Simon-Busch

2023-02-03T11:35:52Z

Mark the issue as duplicate-9 as requested by @kirk-baird

#2 - c4-judge

2023-02-14T08:39:33Z

kirk-baird marked the issue as satisfactory

Lines of code

https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleTickets.sol#L47-L50 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleTickets.sol#L83-L85 https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleTickets.sol#L92-L99

Vulnerability details

Unrestricted minting of RabbitHoleTickets tokens (ERC-1155) due to improper access control

The RabbitHoleTickets.sol contract has a onlyMinter() modifier attempting to allow a specific address only to be allowed to mint. However, the implementation for the modifier is not correct and allows any address to bypass it because it does not revert in case the minterAddress != msg.sender:

modifier onlyMinter() { msg.sender == minterAddress; _; }

https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleTickets.sol#L47-L50

Impact

Improper access control on incorrectly implemented modifier allows any caller to mint tokens on the protocol at any given time, ultimately rendering the value of the NFTs to zero.

Vulnerable mint() function: https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleTickets.sol#L83-L85

Vulnerable mintBatch()) function: https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleTickets.sol#L92-L99

Proof of Concept

  • Bob the attacker (or any curios user) calls the mintBatch() function passing his address in the to_ parameter and sending any _amounts of token he likes, passing any arbitrary _data that he likes as well.
  • He does it again. And again.

Tools Used

  • Manual review

Place an if() statement to check that the msg.sender is minterAddress and revert if it isn't.

modifier onlyMinter() { if (msg.sender != minterAddress) revert OnlyMinter(); _; }

#0 - c4-judge

2023-02-03T11:18:57Z

kirk-baird marked the issue as duplicate of #9

#1 - c4-judge

2023-02-14T08:39:32Z

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