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

Arbitrary user can call `buyPresent` on behalf of token owner without validation

Summary

Anyone can call buyPresent even though they do not have santaTokens. There is mismatch between the protocol document and the implementation.

Vulnerability Details

In the documentation, it points out that the buyPresent function is only callable by anyone with SantaToken. However, there is no balance check in the function. Consider there are two users, A and B. A has santaToken and approve to the santasList contract, he/she is going to buy present for friends. B sees the chance and trigger buyPresent right before A executes the function. B can simply pass the address of A in the presentReceiver parameter and the token of A will be burnt and B will receive the NFT.

Impact

Unintended behavior for buyPresent function might lead to the loss of token for token owner.

Tools Used

Manual Review

Recommendations

  1. Check whether msg.sender in buyPresnet function has enough balance.

  2. burn the token of msg.sender, not the presentReceiver.

  3. allocating NFT for presentReceiver, not msg.sender.

Updates

Lead Judging Commences

inallhonesty Lead Judge almost 2 years 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.