Due to the wrong arguments passed in, the caller gets the NFT and the receiver that is passed in to the argument is the one buying for the caller instead. This could be abused and is not the intended functionality.
In buyPresent
, the wrong address is passed in to the argument to the burn
function. Instead of msg.sender
, which logically should bear the cost of the transaction as they are initiating the purchase for another user, the function erroneously charges the receiver address. This is further amplified as the burn
function does not require the receiver address to approve. The caller can call on any receiver that has enough tokens and he could receive a free NFT without spending any tokens.
Moreover, there is a discrepancy between the documented and actual token cost for purchasing a present. While the documentation states a cost of 2e18
tokens, the function in practice only burns 1e18
tokens.
Instead of burning the defined cost in SantasList.sol
, it only burns 1e18
, as seen here.
User can buy as many presents as possible without spending any of his own funds. The present cost is also incorrect as it only burns 1e18
from the user instead of the defined cost of 2e18
in the documentation.
Manual Review
Consider changing the address to msg.sender
and adding an address parameters to _mintAndIncrement()
.
Also consider adding an amount parameter to the burn
function in SantaToken
as it is not costing the correct amount as stated in the docs. Right now, it is only burning 1e18
which is not the defined amount as stated in the docs which is 2e18
.
Current implementation allows a malicious actor to burn someone else's tokens as the burn function doesn't actually check for approvals.
This line indicates that the intended cost of presents for naughty people should be 2e18: https://github.com/Cyfrin/2023-11-Santas-List/blob/6627a6387adab89ae2ba2e82b38296723261c08a/src/SantasList.sol#L87 PURCHASE_PRESENT_COST should be implemented to enforce the cost of presents.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.