GivingThanks

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

Incorrect Address Assignment in Constructor of `Giving Thanks Contract` Leading to Contract Misconfiguration

Summary

when initializing the registry variable, where msg.sender was mistakenly passed instead of the _registry parameter. This causes the registry variable to reference the wrong address, leading to potential failures when interacting with the intended CharityRegistry contract.

Vulnerability Details

In the constructor, an incorrect parameter (msg.sender) was assigned to the registry variable instead of the intended _registry address. This error can lead to the contract misinterpreting the address of the CharityRegistry contract, causing failures in any functions that depend on a valid registry reference.

Impact

If the incorrect address (msg.sender) is assigned to registry:

Calls to CharityRegistry via registry will not function as expected, potentially leading to contract failures, unintended behavior, or errors.
Contract interactions reliant on a valid registry address will fail, impacting the overall reliability and functionality of the contract.

Tools Used

Manual

Recommendations

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