GivingThanks constructor incorrectly assigns the address of CharityRegistry making it impossible to donate to charitiesDescription:
The variable registry is storing the address of the caller msg.senderand not the address of the charity stored.
Subsequent calls to GivingThanks::donate() will not be allowed. It fails the required condition. The address stored will not be CharityRegistry and therefore will not pass the CharityRegistry::isVerified()
Impact:
Donation is a core functionality of the protocol. The protocol is seriously disrupted if no donations are allowed.
Proof of Concept:
Unit test testDonate()
Test testDonate() failed as copied from terminal:
Ran 1 test for test/GivingThanks.t.sol:GivingThanksTest
[FAIL. Reason: EvmError: Revert] testDonate() (gas: 27751)
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 23.69ms (3.80ms CPU time)
Ran 1 test suite in 36.11ms (23.69ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests)
Failing tests:
Encountered 1 failing test in test/GivingThanks.t.sol:GivingThanksTest
[FAIL. Reason: EvmError: Revert] testDonate() (gas: 27751)
Encountered a total of 1 failing tests, 0 tests succeeded
Recommended Mitigation:
Correctly store the address of the charity in registry:
Tools Used
Manual Review
Likelyhood: High, the parameter is not well used and won't be set. Impact: Low, can be changed with the setter and no one will be able to donate to malicious charity.
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.