GivingThanks

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

The donor can donate to a charity that is not verified by admin

Summary

When a donor calls the 'GivingThanks::donate' function, the function will check if the charity is verified. However, the 'CharityRegistry::verifyCharity' function does not check if the charity is verified by the admin, only if the charity has been registered.

Vulnerability Details

Proof of concept

The test 'GivingThanks::testCannotDonateToUnverifiedCharity' proves () that the 'CharityRegistry::verifyCharity' function does not check if the charity is verified by the admin, only if the charity has been registered.

Impact

Any registered address can receive donations, so the admin role would lose control over whether or not to allow donations, compromising the reliability of the protocol.

Tools Used

Foundry, Manual Code Review

Recommendations

The 'CharityRegistry::isVerified' function should be used to check if the charity is a verified charity by the admin.
``` diff
function isVerified(address charity) public view returns (bool) {
- return registeredCharities[charity];
+ return registeredCharities[charity] && verifiedCharities[charity];
}
```
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.