The tillIn
function in TokenManager.sol
does not properly handle cases where the sent ETH (msg.value
) exceeds the specified deposit amount (_amount
) for native token transactions. This can lead to unintended locking of user funds in the contract.
In the tillIn
function, when dealing with native token (ETH) deposits, the contract only checks if msg.value
is less than _amount
:
However, it does not handle cases where msg.value
is greater than _amount
. The excess ETH sent with the transaction will be trapped in the contract without being accounted for or refunded to the user.
Users may unintentionally lose funds by sending more ETH than intended.
The contract's ETH balance may become inconsistent with the recorded user balances.
There's no mechanism to recover or refund the excess ETH, leading to permanently locked funds.
Manual code review
Implement exact matching of msg.value
and _amount
for native token transactions:
Alternatively, if the contract should accept larger deposits, modify the function to use the full msg.value
:
Add a mechanism to refund any excess ETH
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.