An attacker can exploit the protocol by burning off other user's tokens and minting themselves NFTs for those tokens by calling the buyPresent function.
This vulnerability exists in the buyPresent function. The function takes an address parameter and then burns a token from that address and mints the caller of the function an NFT. The protocol provides 1e18 worth of Santa Token to EXTRA_NICE user's. This attack can only work on those users who have a balance of 1 or greater amount in SantaTokens.
The protocol allows attackers to mint themselves NFTs from the token balance of other users.
Attacker: The attacker will call the buyPresent function with the address of a user who holds 1 SantaToken in the protocol, then the protocol will burn the SantaToken of the user and mint the attacker with the NFT.
Victim: The victim will first collect their present for being EXTRA_NICE and then the victim will lose their SantaToken once the attack is performed.
The attacker can call this function on any number of addresses who have collected rewards for being EXTRA_NICE. The attacker will burn off the SantaTokens for all these addresses and for each token, the protocol will mint the attacker a NFT. The Attacker can gain as many NFTs as there are EXTRA_NICE users on the protocol. This disrupts the working of the protocol and makes it impossible for EXTRA_NICE users to purchase NFTs for their friends.
Manual Review, Foundry Test
Set up buyPresent function to burn the msg.sender's token instead of the receivers token. The receiver's address should be passed into the mint function. This will allow the msg.sender to burn their tokens and purchase a NFT for their friend(receiver's address).
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.