GivingThanks

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

Incorrect Registry Initialization

Summary

The GivingThanks contract constructor incorrectly initializes the registry address with msg.sender instead of the provided _registry parameter.

Vulnerability Details

constructor(address _registry) ERC721("DonationReceipt", "DRC") {
registry = CharityRegistry(msg.sender); // Incorrect initialization
owner = msg.sender;
tokenCounter = 0;
}

Impact

  • Registry initialization points to wrong address

  • Charity verification system completely fails

  • System becomes non-functional

Tools Used

  • Manual Review

Recommendations

event RegistryInitialized(address indexed _registry);
constructor(address _registry) ERC721("DonationReceipt", "DRC") {
require(_registry != address(0), "Invalid registry address");
registry = CharityRegistry(_registry);
owner = msg.sender;
tokenCounter = 0;
emit RegistryInitialized(_registry);
}
Updates

Lead Judging Commences

n0kto Lead Judge 8 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.