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

buyPresent function does not work as intended

Summary

buyPresent function burns tokens that belong to presentReceiver

Vulnerability Details

A malicious user can call the function and will burn the victim's tokens.

i_santaToken.burn(presentReceiver);

Than he will receive the NFT.

Impact

presentReceiver will get his tokens burned but will not receive the NFT

Tools Used

Manual review

Recommendations

Change function to:

function buyPresent(address presentReceiver) external {
- i_santaToken.burn(presentReceiver);
+ i_santaToken.burn(msg.sender);
_mintAndIncrement();
+ _safeTransfer(msg.sender,presentReceiver,s_tokenCounter-1);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

buyPresent should use msg.sender

Current implementation allows a malicious actor to burn someone else's tokens as the burn function doesn't actually check for approvals.

buyPresent should send to presentReceiver

Support

FAQs

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