GivingThanks

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

The constructor of `GivingThanks` is incorrectly initializing `registry` with `msg.sender`, making the following call to `registry` fail

Summary

The constructor of GivingThanks contract is incorrectly initializing registry with msg.sender. This makes the following call to registry fail.

Vulnerability Details

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

Impact

The latter calls registry.isVerified in the donate function will fail, causing the whole contract malfunction.

Recommendations

constructor(address _registry) ERC721("DonationReceipt", "DRC") {
@> registry = CharityRegistry(_registry);
owner = msg.sender;
tokenCounter = 0;
}
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.