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

Attacker can buy present with other user's tokens

Summary

buyPresent function doesn't burn senders token but present receiver's tokens.

Vulnerability Details

SantasList.sol

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

SantaToken.sol

function burn(address from) external {
if (msg.sender != i_santasList) {
revert SantaToken__NotSantasList();
}
_burn(from, 1e18);
}

buyPresent function doesn't burn msg.sender tokens. It burns presentReceiver tokens instead.

Impact

Attacker can mint ERC721 tokens to his account using other user's ERC20 tokens.

Tools Used

  • foundry

Recommendations

Change i_santaToken.burn call input.

- i_santaToken.burn(presentReceiver)
+ i_santaToken.burn(msg.sender)
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.

Support

FAQs

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