GivingThanks

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

`CharityRegistry::isVerified` checks for registration instead of verification, leading to users being potentially losing funds

Summary

The CharityRegistry::isVerified function which is used in GivingThanks::donate function checks for charity registration instead of verification, this could potentially lead to users contributing to causes that might be imitating others and therefore being conned of their funds since anyone can register their own charity

Vulnerability Details

The donate function below has a require that is meant to check whether a charity is verified.

function donate(address charity) public payable {
@> require(registry.isVerified(charity), "Charity not verified");
(bool sent,) = charity.call{value: msg.value}("");
require(sent, "Failed to send Ether");
_mint(msg.sender, tokenCounter);
string memory uri = _createTokenURI(msg.sender, block.timestamp, msg.value);
_setTokenURI(tokenCounter, uri);
tokenCounter += 1;
}

But instead checks whether a charity is registered.

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

Impact

This could lead to users donating funds to fake charities that imitate others and potentially losing their funds.

Tools Used

Manual Review

Recommendations

make the following modification to the CharityRegistry::isVerified function

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

Lead Judging Commences

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