The function buyPresent
with its current logic is used for getting a present for someone else's tokens. This doesn't seem as the correct behaviour, but we will observe how an attacker can take benefit of that function.
Let's consider the following scenario. Alice has santaTokens
and wants to give a present to her friend Bob. What she will do is approve the contract to spend her tokens and tell Bob to call buyPresent
and pass her address as a parameter. Bob agrees and Alice does her part of the job. However an attacker saw Alice's transaction and front-runs Bob's transaction. He calls buyPresent
with Alice's address and gets the NFT for himself. Alice now has lost her tokens and Bob received nothing.
Loss of tokens
Manual Review, Foundry
Added the following test case:
Test passes:
Change the logic of buyPresent
. Instead of burning presentReceiver
tokens, burn msg.sender
. Also pass presentReceiver
to _mintAndIncrement
.
Consider doing the following changes:
buyPresent
:
_mintAndIncrement()
:
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.