GivingThanks

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

isVerified will always return true if the charity is registered

Summary

In CharityRegistry contract we have a function called isVerified which is used to check if the charity is verified before donating. But isVerified will always return true if the charity is registered as we are using registeredCharities[charity] check to verify the charity instead of verifiedCharities[charity].

Vulnerability Details

In the isVerified function, we are using incorrect mapping to check if the charity is verified or not. We should be using verifiedCharities[charity] instead of registeredCharities[charity].

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

Impact

isVerified will always return true if the charity is registered allowing the malicious actor to register the malicious charity contract and steal all the donations.

Tools Used

Manual review and foundry.

Recommendations

Replace registeredCharities[charity] with verifiedCharities[charity].

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

Lead Judging Commences

n0kto Lead Judge 10 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.