SantasList::buyPresent()
is subject to front-running attacks.
SantasList::buyPresent()
is subject to front-running attacks.
Also, there is a flaw in the logic of the function. It allows minting of a SantasList
ERC721 token to the msg.sender
while burn presentReceiver
ERC20 SantaToken. It should instead burn msg.sender
ERC20 SantaToken and mint SantasList
ERC721 token to the presentReceiver
.
All this allows a malicious user to receive a present instead of the recipient to whom the EXTRA_NICE
user intends to buy the present.
Place the code for the following test function in test/unit/SantasListTest.t.sol
.
In the terminal, run the following command:
forge test --mt test_FrontRunAttack_BuyPresent
A malicious user can buy a present at someone else's expense, even if they are not supposed to be the recipient of the present.
Manual review, Foundry
Change SantasList::buyPresent()
to burn msg.sender
's SantaToken and mint NFTs to the presentReceiver
.
Current implementation allows a malicious actor to burn someone else's tokens as the burn function doesn't actually check for approvals.
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.