The GivingThanks contract incorrectly sets the registry variable to the caller's address instead of the provided _registry address during the contract's construction. This makes the whole givintThankscontract unusable .
In the constructor of the GivingThanks contract, the registry variable is assigned the value of msg.sender instead of the _registry parameter passed to the constructor. This means that the contract will not interact with the intended CharityRegistry contract , registry will be set to the caller .
Add this file to GivingThanks.t.sol :
run
Output :
This vulnerability can lead to several issues:
The contract will not verify charities correctly, as it is not referencing the intended CharityRegistry. Calls will revert and Donations cannot be made .
Manual code review
Cursor
Update the constructor to correctly assign the registry variable using the _registry parameter:
Implement access control mechanisms to ensure that only authorized addresses can update the registry in the future.
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.