sandy - Steth::transferfrom
will transfer 1-2 wei less which will result in reverting of consequent functions because of not enough balance.
#239
Labels
Non-Reward
This issue will not receive a payout
Sponsor Disputed
The sponsor disputed this issue's validity
sandy
High
Steth::transferfrom
will transfer 1-2 wei less which will result in reverting of consequent functions because of not enough balance.Summary
Steth::transferfrom
will transfer 1-2 wei less which will result in reverting of consequent functions because of not enough balance.Vulnerability Detail
The protocol always assumes that the amount of tokens received is equal to the amount of tokens transferred. This is not the case for rebasing tokens, such as
stETH
, because internally they transfer shares which generally results in the received amount of tokens being lower than the requested one by a couple of wei because of rounding.The probability of this issue appearing is very high as mentioned here: lidofinance/core#442
In the
DepositWrapper
contract,deposit
function is used to deposit specified tokens into the vault. One of the tokens issteth
which is converted towsteth
before depositing.steth
is then converted towsteth
here using the sameamount
:The problem is if
amount - 1/2 wei
is passed to_stethToWsteth()
function, it will revert due to insufficient funds asDepositWrapper
contract doesn't hold anysteth
tokens.Impact
deposit()
function ofDepositWrapper
contract will revert resulting in all deposits reverting and contract functionalityDoS
. Thus, the high severity.Code Snippet
https://github.com/sherlock-audit/2024-06-mellow/blob/main/mellow-lrt/src/utils/DepositWrapper.sol#L56-L57
Tool used
Manual Review
Recommendation
Use the actual amount of tokens received instead of the amount specified as input. This can be done by implementing amount handling like for
Fee on transfer
tokens, which compares the balance before and after the transfer.Duplicate of #299
The text was updated successfully, but these errors were encountered: