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

Using `_mintAndIncrement()` in SantasList.buyPresent sends tokens to msg.sender not to present reciever

Summary

The vulnerability in the buyPresent function is rooted in the misalignment of token transfers. The use of _mintAndIncrement() mistakenly sends tokens to the function invoker (msg.sender) instead of the intended recipient (presentReceiver).

Impact

The impact of this vulnerability is significant, as it introduces the risk of unauthorized token transfers and disrupts the expected behavior of the present purchase mechanism.

Tools Used

Manual Review

Recomendations

Using mintAndIncrement() in the function should be changed and be dynamic in the sense that it should accept a parameter of address to be minted to, say:

function buyPresent(address presentReceiver) external {
i_santaToken.burn(presentReceiver);
_mintAndIncrement(presentReciever);
}

So the original function could be tweaked to accept an address parameter or a new function that handles that could be created.

Updates

Lead Judging Commences

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

buyPresent should send to presentReceiver

Support

FAQs

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