GivingThanks

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

Charity Verification Bypassed in `CharityRegistry::isVerified` Due to Incorrect Mapping Reference

[H-1] Charity Verification Bypassed in CharityRegistry::isVerified Due to Incorrect Mapping Reference

Summary

The CharityRegistry::isVerified function mistakenly checks the registeredCharities mapping instead of verifiedCharities to determine if a charity is verified. This oversight results in any registered charity being marked as "verified" without admin approval, allowing unauthorized charities to receive donations.

Vulnerability Details

The isVerified function currently references the registeredCharities mapping, as shown below:

mapping(address => bool) public verifiedCharities;
mapping(address => bool) public registeredCharities;
.
.
.
function isVerified(address charity) public view returns (bool) {
return registeredCharities[charity];
}

Since the function checks registeredCharities instead of verifiedCharities, any charity that is merely registered will appear as verified, bypassing the intended verification process managed by the contract administrators.

Impact

  • Unverified charities can be incorrectly treated as verified, potentially allowing unauthorized entities to receive donations intended only for vetted charities.

  • This introduces a security risk by undermining the integrity of the donation system, allowing non-verified charities to be mistakenly trusted by donors.

Tools Used

Manual Review

Recommendations

Correct the mapping reference within the isVerified function to ensure only verified charities are marked as such:

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

This fix ensures the function accurately reflects the verification status by checking the verifiedCharities mapping, restoring the intended functionality.

Updates

Lead Judging Commences

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