GivingThanks

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

Incorrect logic in isVerified function leads to unauthorized charity verification bypass

Summary

The isVerified function is intended to return whether an address represents a verified charity. However, due to an error, it instead checks if the address is merely registered, failing to confirm actual verification.

Vulnerability Details

In the CharityRegistry contract, the isVerified function currently returns the registeredCharities status of an address instead of the verifiedCharities status. This function should verify whether the charity has passed the verifyCharity step, but it mistakenly indicates that registration alone is sufficient.

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

By returning registeredCharities[charity] instead of verifiedCharities[charity], this implementation flaw causes the isVerified function to incorrectly confirm verification status for any registered address. Because there is no restriction on registration, any address can register as a charity and appear verified without going through the proper verification process.

Impact

This vulnerability enables unauthorized entities to bypass charity verification by simply registering. This could harm the protocol by allowing unverified charities to access benefits or functionality intended solely for verified entities. It undermines the security and integrity of the system, as any address can appear verified without actually meeting the verification requirements. This could lead to exploitation or loss of user trust in the charity verification system.

Tools Used

Manual Review

Recommended Mitigation

Modify the isVerified function to check the verifiedCharities mapping instead of registeredCharities, as shown below:

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

This change will ensure that only truly verified charities are marked as such in the contract.

Updates

Lead Judging Commences

n0kto Lead Judge about 1 year 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.