The SantasList::buyPresent()
and SantaToken::burn()
functions do not implement logic which would enforce the rules described in the natspec or the README. A malicious actor can burn a SANTA
token from any holder to mint themselves an NFT.
The SantasList::buyPresent()
does not contain logic that would ensure the requirements are met:
does not spend the required 2 SANTA for the NFT
spends only 1 SANTA, but from the presentReceiver
rather than the msg.sender
mints the NFT to the msg.sender
rather than presentReceiver
Additionally, the SantaToken::burn()
hard codes only 1 token for burning rather than providing the means to burn 2.
Adding the following test case to SantasListTest.t.sol
demonstrates this behavior.
The SantasList::buyPresent()
and SantaToken::burn()
functions as they are written allow a malicious actor to learn the addresses of all SANTA holders with a balance of 1 or more and then mint themselves an NFT for each 1 SANTA token they can find, potentially receiving a large quantity of NFT.
Manual Review and Foundry
Update the logic of the SantasList::buyPresent()
function to check that the msg.sender
has a balance of 2 or more SANTA tokens, burn 2 SANTA and mint the NFT to the presentReceiver
.
And the SantaToken::burn()
function to burn SantasList::PURCHASED_PRESENT_COST
SANTA tokens.
Current implementation allows a malicious actor to burn someone else's tokens as the burn function doesn't actually check for approvals.
This line indicates that the intended cost of presents for naughty people should be 2e18: https://github.com/Cyfrin/2023-11-Santas-List/blob/6627a6387adab89ae2ba2e82b38296723261c08a/src/SantasList.sol#L87 PURCHASE_PRESENT_COST should be implemented to enforce the cost of presents.
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.