GivingThanks::updateRegistry() in GivingThanks.sol is publicly accessible, allowing any user to change the contract’s registry to an arbitrary address. This design flaw enables unauthorized parties to bypass the verification process, which could result in unverified charities receiving donations.
Publicly Accessible Function (GivingThanks.sol line 37)
Add the following test and contract in GivingThanks.t.sol:
Run the test with the command forge test --mt testMaliciousRegistryUpdate
which results in the following output:
Bypassing Verification Process:
A malicious actor can replace the registry with a contract they control, allowing them to manipulate the isVerified function to always return true, bypassing verification requirements and allowing any address to receive donations.
Loss of Trust:
Users may donate to unverified addresses if the registry is modified, compromising the integrity and trust of the contract's verification process.
Manual review, Foundry
Restrict Access to updateRegistry:
Limit access to updateRegistry by making it onlyOwner to ensure only authorized accounts can modify the registry.
Updated Access Control:
OpenZeppelin's Ownable contract has already been included in GivingThanks.sol. The rest of the contract must also be updated to behave correctly.
Likelyhood: High, anyone can change it at anytime Impact: High, can bypass the verification process
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.