Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Valid

Trading wrong amount of santaToken for NFT

Summary

The function burn is burning the wrong amount of SantaToken

Vulnerability Details

The function burn implemented in SantaToken is used on buyPresent to trade tokens SantaToken for an NFT. The documentation says that an NFT is traded for 2e18 SantaToken, however, the burn function is burning only 1e18.

function burn(address from) external {
if (msg.sender != i_santasList) {
revert SantaToken__NotSantasList();
}
// audit-danger Burning wrong amount of tokens. 1 NFT should be traded for 2e18 santaToken
_burn(from, 1e18);
}

Impact

This vulnerability allows trading an NFT for a wrong number of SantaToken

Tools Used

Manual Analysis

Recommendation

Consider updating the burn implementation to burn 2e18 token instead of 1e18. Also, the test testBuyPresent should be adapted.

Updates

Lead Judging Commences

inallhonesty Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

Price is not enforced in buyPresent

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.