Constructor input parameter _registry in contract GivingThanks is not used to define the CharityRegistry causing the registry variable was not referred to the correct implementation right after contract deployment, resulting a mismatch of implementation for the correct CharityRegistry within the GivingThanks protocol.
In contract GivingThanks, the input parameter _register was not used to define the CharityRegistry variable. Instead, msg.sender is used to define the variable registry. This causes the registry variable does not reflect the correct registry implementation upon contract deployment
Proof of Concept:
Add the following test to test\GivingThanks.t.sol
Run the test forge test --match-test test_audit_charityRegistryAddressAtConstructorOfGivingThanksContract -vvv
The test failed indicating that the registry variable captured in the GivingThanks contract is different from what was defined in the constructor input parameter in the setUp function
Mismatch of registry variable information in GivingThanks contract versus the input given during contract deployment causes confusion and doubts to protocol users.
Manual review with tset
Replace the msg.sender to _register in the constructor of contract GivingThanks as follow:
Rerun the test above forge test --match-test test_audit_charityRegistryAddressAtConstructorOfGivingThanksContract -vvv
The test passed indicating that the recommended change had corrected the registry implementation.
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.