The SantaToken contract, part of the blockchain system implemented for Santa's List, contains a critical vulnerability in its burn function. The function burns only 1e18 tokens (1 SantaToken) instead of the required 2e18 tokens for purchasing an NFT. This discrepancy allows users to exploit the system, purchasing NFTs at half the intended cost.
The amount of tokens burned per transaction is hard-coded to 1e18 (1 SantaToken), irrespective of the intended cost of 2e18 tokens for an NFT purchase, as outlined in the project's README. This mismatch creates an exploitable loophole in the contract logic.
Below is a POC of how a user could exploit it:
Users can exploit this loophole to acquire NFTs at a 50% discount, potentially devaluing the NFTs and undermining the tokenomics of SantaTokens. Moreover, it could lead to a loss of trust in the system's fairness and security.
Manual
Foundry
Adjust the burn Function: Modify the burn function in the SantaToken contract to dynamically burn the correct amount of tokens (2e18) as intended for NFT purchases.
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.