GivingThanks

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

`constructor` of `GivingThanks.sol` don't set the correct registry

Summary

constructor of GivingThanks.sol don't set the correct registry.

Vulnerability Details

constructor of GivingThanks.sol don't set the correct registry:

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

it need to set registry to _registry.

Impact

The owner needs to manually modify the register; otherwise, all contract calls with return values related to the register will fail.

Tools Used

foundry

Recommendations

fix code like this:

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

Lead Judging Commences

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