RabbitHole Quest Protocol contest - yosuke'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: 163/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

Handle

yosuke

Impact

The mint function in RabbitHoleReceipt.sol uses the onlyMinter modifier. This modifier is shown below, and the revert is not working, so anyone can pass the check.

modifier onlyMinter() {
    msg.sender == minterAddress; //Where is revert()?
    _;
}

Furthermore, since the mint function is public and can be easily called from outside the contract, an attacker who is not on-chain-tasked can mint multiple receipts. An attacker who mints them can exchange them for ERC20 or ERC1155, draining funds from the contract and fatally damaging the protocol. Also, those who are originally entitled to the rewards will not get them. For these reasons, I consider this bug to be highly serious.

Proof of Concept

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

Tools Used

pen and paper

Please fix the onlyMinter modifier as shown below.

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

#0 - c4-judge

2023-02-06T08:44:30Z

kirk-baird marked the issue as duplicate of #9

#1 - c4-judge

2023-02-14T08:37:41Z

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