GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Valid

Incorrect Initialization of registry in Constructor in GivingThanks contract

Summary

The registry is incorrectly initialized to the deployer's address (msg.sender) instead of the provided _registry address.

registry = CharityRegistry(msg.sender);

Vulnerability Details

In the constructor, registry = CharityRegistry(msg.sender); sets the registry to the deployer's address. This could lead to incorrect or unintended behavior since the registry should point to a specific CharityRegistry contract.

Impact

The contract may not function as intended, as it would not verify charities against the correct registry.

Tools Used

Manual Review

Recommendations

Initialize registry with the _registry parameter provided to the constructor. Change the line to:

registry = CharityRegistry(_registry);
Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-bad-registry-set-at-construction

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.