GivingThanks

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

Logic error -GivingThanks::constructor doesn't use the correct parameter to set the registration.

Summary

GivingThanks::constructor doesn't use the parameter _registry and instead uses msg.sender

to set the registration CharityRegistry(msg.sender).

Vulnerability Details + Recommendations

// see comments @audit
constructor(address _registry) ERC721("DonationReceipt", "DRC") {
registry = CharityRegistry(msg.sender); // @audit remove this line
// @audit above line should be replaced by the below line
registry = CharityRegistry(_registry); // @use this line
owner = msg.sender;
tokenCounter = 0;
}

Impact

Wrong address is verified as the registered charity.

Tools Used

Foundry test.

Manual review

Updates

Lead Judging Commences

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