GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Function `CharityRegistry::isVerified` returns a wrong value

Description The CharityRegistry::isVerified function returns the value of registeredCharities mapping instead of the verifiedCharities one.

Impact The function will always return a value of true for all the registered charities that are passed as a parameter, even if they are not actually verified by the admin.

Proof of Concepts

Add the following test to Test.t.sol file.

function testIsVerifiedReturnsWrongValue() public {
address newCharity = makeAddr("newCharity");
vm.prank(admin);
registryContract.registerCharity(newCharity);
// The new charity is only registered, but not verified
assert(registryContract.isVerified(newCharity));
}

Recommended mitigation Add the proper return value to CharityRegistry::isVerified

function isVerified(address charity) public view returns (bool) {
- return registeredCharities[charity];
+ return verifiedCharities[charity];
}
Updates

Lead Judging Commences

n0kto Lead Judge 8 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-isVerified-return-registered-charities

Likelyhood: High, the function returns registered charities instead of verified ones. Impact: High, Any charities can be registered by anyone and will be declared as verified by this function bypassing verification.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.