GivingThanks

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

Incorrect initialization of `registry` instance in constructor: `msg.sender` used instead of registry address

Summary

The constructor of GivingThanks accepts address of the registry but uses msg.sender to instantiate it.

Vulnerability Details

The instance of the CharityRegistryshould be initialized with the address of a registry contract. However, it is initialized with msg.sender in the constructor of GivingThanks.

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

Impact

This way, the registry instance is not created properly.

Tools Used

Manual

Recommendations

Initialize the registrywith the right address.

constructor(address _registry) ERC721("DonationReceipt", "DRC") {
- registry = CharityRegistry(msg.sender);
+ registry = CharityRegistry(_registry);
Updates

Lead Judging Commences

imdheeraj28 Submitter
8 months ago
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.