The TokenManager::tillin function does not check that the depositor has sent ETH as well as an ERC20 amount.
While tilling in, users can deposit either native tokens or ERC20 tokens. For instance, makers can pay either in ETH or ERC20 token:
However the vulnerability exists in the tillin function:
The function does not check that the depositor has sent ETH together with an ERC20 amount. Assuming for example that the depositor has sent ETH and also specified the USDC token address, the TokenManager contract will pull the expected USDC amount from the user account and also receive ETH. The paid-in ETH unfortunately will never be credited to the user account.
While it is true that this vulnerability can be considered as user-input oriented, the protocol should take measure to prevent such accidental incidences now that we're aware of such possiblity. This vulnerability can be exploited where the tillin function is called, including:
createOffer
relistOffer
listOffer
createTaker
Consider this POC that shows that ETH sent together with an ERC20 token will be lost.
Depositors who sent ETH while also specifying an ERC20 address will lose thier ETH
Manual review
Consider checking that depositor has NOT sent ETH and also specified an ERC20 amount:
Invalid, these are by default, invalid based on codehawks [general guidelines](https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity#findings-that-may-be-invalid). The check implemented is simply a sufficiency check, it is users responsibility to only send an appropriate amount of native tokens where amount == msg.value when native token is intended to be used as collateral (which will subsequently be deposited as wrapped token). All excess ETH can be rescued using the `Rescuable.sol` contract. > Users sending ETH/native tokens > If contracts allow users to send tokens acc111identally.
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.