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

Buy Gift with other's money

Vulnerability Details

The function buyPresent burn the tokens of the presentReceiver instead the caller's tokens and mint the gift for the caller.
This means that anyone can steal other users' tokens to claim gift for himself

Impact

An attacker can claim gift burning other users' tokens.

Recommendations

Burn the token of the msg.sender and mint the token to the presentReceiver, modifying the function like this:

function buyPresent(address presentReceiver) external {
i_santaToken.burn(msg.sender);
_safeMint(presentReceiver, s_tokenCounter++);
}
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.