The SantasList contract's checkList function, intended to mark users as "Nice", "Extra Nice", or "Naughty", lacks proper access control. This issue allows any user, not just the designated "Santa", to mark others' status, potentially disrupting the intended game mechanics and fairness.
In the SantasList
contract, the checkList
function is critical for determining whether users are eligible for Christmas presents. However, this function is marked as external
without an onlySanta
modifier, allowing any external account to call it. As a result, any user can set the status of any other user, bypassing the intended control that should be exclusively held by "Santa".
This vulnerability undermines the integrity of the game logic in the SantasList
contract. Malicious users can mark themselves or others as "Nice" or "Extra Nice" without proper authorization, leading to unearned rewards. Conversely, they could also sabotage other users by marking them as "Naughty".
Exploit Test Case: A test case is created where a non-Santa user calls checkList
and successfully changes another user's status.
The non-Santa user (address user
) calls checkList
, marking their own status as "Nice".
Santa calls checkTwice
, confirming the status set by the non-Santa user.
The test case asserts that the status change has been accepted and reflected in the contract, demonstrating the vulnerability.
Foundry
Implement an onlySanta modifier to restrict the checkList function's access to the designated Santa account. This modifier should check if msg.sender is equal to the Santa's address and revert if not.
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.