Snow can allow reentrancy attacksThe 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 cause reentrancy vulnerability
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 contract will reenter the contract and transfer as many tokens as needed
Add the following testcase to the Snow.t.sol test suite:
Also add the following contract to the import list. This is the malicious reentrant contract:
Add reentrancy guards to the function. OpenZeppelin's reentrancy guard works by locking the function once it has been called, till the time the call has been fully executed. This means that once entered, nobody will be able to reenter the contract due to the locking mechanism
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.