The tillIn
function in TokenManager.sol
does not properly handle native tokens (ETH) when the accepted token is not the native token. This can lead to incorrect transfers and potential loss of funds.
Location: TokenManager.sol
The tillIn
function allows users to deposit tokens into the contract. If the token being deposited is not the native token (ETH), the function should not accept ETH along with the call. Currently, the function does not enforce this, allowing users to send ETH even when depositing ERC20 tokens.
The function does not check for the presence of msg.value
when the token being deposited is not the native token. This allows users to inadvertently send ETH with their transactions, potentially leading to lost funds.
This vulnerability can result in users accidentally sending ETH when it is not required, leading to loss of funds and incorrect contract behavior. This mismanagement of funds can disrupt the expected operation of the contract and cause financial losses for users.
Manual review
Add a Check for msg.value
:
Ensure that msg.value
is zero when the token being deposited is not the native token.
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.