Open code423n4 opened 1 year ago
kirk-baird marked the issue as duplicate of #9
kirk-baird marked the issue as satisfactory
kirk-baird marked the issue as selected for report
kirk-baird marked the issue as primary issue
waynehoover marked the issue as sponsor confirmed
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/RabbitHoleTickets.sol#L47-L50
Vulnerability details
Both
RabbitHoleReceipt
andRabbitHoleTickets
contracts define amint
function that is protected by aonlyMinter
modifier:RabbitHoleReceipt:
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleReceipt.sol#L98-L104
RabbitHoleTickets:
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleTickets.sol#L83-L85
However, in both cases the modifier implementation is flawed as there isn't any check for a require or revert, the comparison will silently return false and let the execution continue:
Impact
Any account can mint any number of
RabbitHoleReceipt
andRabbitHoleTickets
tokens.This represents a critical issue as receipts can be used to claim rewards in quests. An attacker can freely mint receipt tokens for any quest to steal all the rewards from it.
PoC
The following test demonstrates the issue.
Recommendation
The modifier should require that the caller is the
minterAddress
in order to revert the call in case this condition doesn't hold.