GivingThanks

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

Unprotected Regiistry Update in `GivingThanks.sol`

Description: The GivingThanks::updateRegistry function has no access control, allowing anyone to change the registry address to any value.

function updateRegistry(address _registry) public {
registry = CharityRegistry(_registry);
}

Impact:

  • Complete system compromise possible

  • Attacker can redirect donations to unverified addresses

  • Loss of funds for donors

Proof of Concept:

function testRegistryHijack() public {
address attacker = address(0x1);
address maliciousRegistry = address(new FakeRegistry());
vm.prank(attacker);
givingThanks.updateRegistry(maliciousRegistry);
// Registry successfully changed to attacker's contract
assertEq(address(givingThanks.registry()), maliciousRegistry);
}

Recommended Mitigation:

modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function updateRegistry(address _registry) public onlyOwner {
require(_registry != address(0), "Invalid registry address");
registry = CharityRegistry(_registry);
emit RegistryUpdated(_registry);
}
Updates

Lead Judging Commences

n0kto Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-anyone-can-change-registry

Likelyhood: High, anyone can change it at anytime Impact: High, can bypass the verification process

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.