Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Unauthorized access to checkList function

Summary

SantasList::checkList function can be called by anyone and change the s_theListCheckedOnce state.

Vulnerability Details

The function SantasList::checkList does not check if the caller is i_santa, this allows anyone to call the function and modify state.

Impact

Unauthorized update to s_theListCheckedOnce storage variable.

Forge test case

function testCanCallCheckListAsAnyUser() public {
address maliciousUser = makeAddr("maliciousUser");
address randomUser = makeAddr("randomUser");
vm.prank(maliciousUser);
santasList.checkList(randomUser, SantasList.Status.NAUGHTY);
assertEq(uint256(santasList.getNaughtyOrNiceOnce(randomUser)), uint256(SantasList.Status.NAUGHTY));
}

Tools Used

  • Foundry

Recommendations

Add onlySanta function modifier to checkList function

-function checkList(address person, Status status) external {
+function checkList(address person, Status status) external onlySanta{
s_theListCheckedOnce[person] = status;
emit CheckedOnce(person, status);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Access Control on checkList()

Anyone is able to call checkList() changing the status of a provided address. This is not intended functionality and is meant to be callable by only Santa.

Support

FAQs

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