RamNFT::mintRamNFT
is public and lacks any kind of access control. This results in anyone being able to mint ramNFTs and enter the Dussehra protocol without paying entree fees.Description: Participants are meant to enter the protocol and receive an ramNFT via the Dussehra::enterPeopleWhoLikeRam
function. The participants has to pay a fee when calling the enterPeopleWhoLikeRam
function, which then calls the RamNFT:mintRamNFT
to mint a ramNFT, logs the tokenId and adds initialises characteristics linked to the tokenId. The tokenId and characteristics allow people to participate in the event and win half of the collected fees.
However, RamNFT:mintRamNFT
lacks any kind of access control. This results in anyone beng able to call the function directly indefinitely, bypassing Dussehra::enterPeopleWhoLikeRam
, avoiding paying the entree fee and entering the event an indefinite amount of times.
Impact: Participants can enter the event for free, while still being able to win half of the collected entree fees. It takes away any incentive to pay the entree fee, leaving the contract without any funds to pay the winning Ram. It breaks the intended functionality of the protocol.
Proof of Concept:
A malicious user calls mintRamNFT
9999 times. Does not pay any entree fees.
mintRamNFT
does not revert.
Organiser calls choosingRam::selectRamIfNotSelected
.
The malicious user has a very high chance of being selected Ram.
Place the following in the CounterTest
contract in the Dussehra.t.sol
test file.
Recommended Mitigation: The Dussehra
contract needs to be the organiser
of the RamNFT
contract. This allows the addition of a check that it is the Dussehra
contract calling a function.
For clarity, rename organiser
to s_ownerDussehra
.
Have the Dussehra
contract initiate RamNFT
. This sets s_ownerDussehra
to the address of the Dussehra
contract.
Add a check that RamNFT::mintRamNFT
can only be called by s_ownerDussehra
.
In Dussehra.sol
:
In RamNFT.sol
:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.