ContestManager::getContestRemainingRewards does not check that param address contract is an approved contest, allowing function calls on unapproved contractsContestManager::getContestRemainingRewards does not check that param address contract is an approved contest, allowing function calls on unapproved contracts. The logic currently puts contests in array ContestManager::contests, which could be checked, although we recommend the use of a mapping to do this check. See mitigation section.
Likelihood:
This will happen any time an address is is passed to ContestManager::getContestRemainingRewards that has a function that matches the function signature of Pot::getRemainingRewards.
Impact:
The impact is that a given address is not checked as a valid contest, which means that a contract using the same function signature as Pot::getRemainingRewards can be called, returning an incorrect value to ContestManager::getContestRemainingRewards, instead of this function reverting.
We define a fake contract DummyContract in the test file test/TestMyCut.t.sol, which has a function with an identical function signature to Pot::getRemainingRewards.
In our test function, we deploy a fake contest contract fakePot, and its address is passed to ContestManager::getContestRemainingRewards, which calls fakePot::getRemainingRewards, which returns fakeNumber, thus inserting incorrect information into the protocol.
We recommend that a mapping of addresses to booleans be created to define if an address is a contest in ContestManager.
The mapping will allow for constant-time look-up to verify that a given address is a contest. This mapping can be updated in ContestManager::createContest:
We recommend that a custom error be added to ContestManager:
We recommend that the mapping be checked, and if the check does not return true, the custom error be thrown.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.