Snow can allow user to buy token for freeThe Snow::buySnow() calls external functions from i_weth contract. The safeTransferFrom() function is a function from OpenZeppelin's SafeErc20 interface and internally it calls the transferFrom() function of the ERC20 token contract.
A malicious contract inheriting from ERC20 contract but overriding the transferFrom() function can contain attacker's own logic and return true even if no tranfer has been performed
Likelihood:
Deployer of contract puts malicious contract address either deliberately or due to human errors
Impact:
User can call buySnow() once with the amount needed for buying, but then the safeTransferFrom() function does nothing
Add the following testcase to the Snow.t.sol test suite:
Also add the following contract to the import list. This is the malicious contract:
Check for the balance of the contract before and after the transfer has been done, and add the check to ensure that transfer has been done successfully
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.