The external function checkList()
is missing the onlySanta
modifier. This exposes a potential frontrunnable DoS opportunity for malicious actors.
As per the natspec @notice
comment, there should be a msg.sender
check using the onlySanta
modifier. This permits any address to change the Status
of any other address in the s_theListCheckedOnce
mapping.
With this public checkList()
access, a malicious actor may frontrun the i_santa
address's attempt to call checkTwice()
by changing the Status
of the person
's address value in the s_theListCheckedOnce[person]
mapping beforehand to a value different than that of the initial checkTwice()
call attempt. This would prevent the if
statement in checkTwice()
to be true at runtime, resulting in a revert SantasList__SecondCheckDoesntMatchFirst()
.
The calls may go like this.
Santa calls contract with params checkList(user1, EXTRA_NICE)
and txn is finalized.
Santa attempts to call contract with params checkTwice(user1, EXTRA_NICE)
.
Attacker frontruns txn2 with it's own contract call with params checkList(user1, NAUGHTY)
, slotting txn3 ahead of txn2.
Attacker txn finalizes, setting s_theListCheckedOnce[user1] == NAUGHTY
Santa's txn2 reverts since s_theListCheckedOnce[person] != EXTRA_NICE
Done in a forge test file, this demonstrates a non-santa's ability to frontrun a user.
Any (or all) users may be prevented from successfully being checked twice, and minting their tokens, potentially resulting in a denial of service.
Forge
Add the onlySanta
modifier to the external function 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.
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.