The function isVerified() in the CharityRegistry.sol file returns the registery status of a charity instead of the verified status of the charity. Therefore a potentially scammy charity can still pass as verified without actually being verified and collect funds that never reach the intended charitable causes.
Function isVerified code returns the bool value of the mapping registeredCharities at address charity as seen in the code below:
When we check how charities are registered, anyone can register their charity.
Therefore this function does not return the status of being verified or not, only the status of being registered. Any registered charity can therefore bypass verification by trusted admin.
The false value returned can also be verified by the CharityRegistry.t.sol file I have written:
When this test is run with forge it fails, since it returns true
Note: Current test suite in the GivingThanks.t.sol file includes tests for donor function. If you only run the test testCannotDonateToUnverifiedCharity and see it reverts, and conclude "see it reverts, you cannot donate to unverified charities, it reverts because it requires charities to be verified", that would be false. If you run all tests you see GivingThanks.t.sol::testDonate() test also fails. Meaning current GivingThanks::donate() function is buggy and reverts even when it shouldn't. As it currently is no one can donate to any charity. But that's another topic.
Potentially anyone can register a charity and pass as a verified charity without actually being verified. A potentially scammy charity may still collect money from end users of the contract without being verified by the admin first. This basically removes the requirement of being verified by a trusted admin before a charity can collect money. Therefore a critical function of the protocol is nullified.
Foundry suite.
Correct the function isVerified as below to return actual verified status:
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.