The buyPresent function is intended to be callable only by users holding SantaTokens, as documented in the NatSpec. This ensures that only eligible users can initiate the present purchase flow.
Currently, the function does not verify that the caller owns any SantaTokens before execution. As a result, any address can call buyPresent, even without holding tokens, violating the documented requirement and enabling unauthorized use of the function.
Likelihood:
Every call to buyPresent can be executed by any address, regardless of token ownership.
No validation exists to restrict execution to SantaToken holders, so this occurs on every invocation by an unauthorized user.
Impact:
Users without tokens can mint NFTs without paying, bypassing the intended token payment requirement.
Unauthorized access can lead to unintended token burns, NFT misallocation, or disruption of the gift mechanism.
user2 without SantaTokens calls buyPresent, and the function executes successfully, allowing minting or token burn despite lacking the required tokens.
Add this function to your SantasListTest.t.sol file :
Add a check at the start of buyPresent to ensure the caller owns at least the required amount of SantaTokens before executing the function:
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.