Closed sherlock-admin3 closed 3 months ago
Low/Info; There's no fund loss, and this less 1-2 wei problem do not always happen.
@z3s 1wei almost always happens funds loss due to spontaneous reverts and alot of user inconvenience not just little inconvenience
@z3s Aditionally here is an example of the same issue as a valid High from Sherlock contest 2 month ago: https://github.com/sherlock-audit/2024-05-sophon-judging/issues/63
Even sponsor has handled the issue in his deployment scripts: https://github.com/mellow-finance/mellow-lrt/blob/dev-symbiotic-deploy/scripts/mainnet/DeployScript.sol#L303-L305
This was marked as High in a recent contest https://github.com/sherlock-audit/2024-06-leveraged-vaults-judging/issues/43
hals
Medium
DepositWrapper.deposit()
: incorrect handling ofsteth
token transferSummary
DepositWrapper.deposit()
doesn't handle the transferredsteth
tokens correctly (as the amount transferred will be less by 1 to 2 wei) resulting in disabling the support of this token in thedeposit()
function.Vulnerability Detail
DepositWrapper.deposit()
function allows depositingwstETH
in vaults that have only one underlying token which is thewstETH
.This function enables users to provide any of
stETH
,wETH
or nativeETH
and then convert the provided nonwstETH
towstETH
token:where:
Impact
But this function doesn't handle
stETH
token conversion correctly, as theIERC20(steth).safeTransferFrom(sender, wrapper, amount);
will transfer 1-2 wei less than the transferredamount
, which would result in reverting the consequent_stethToWsteth()
that converts theamount
provided but not the actual received which is less by 1-2 wei (insufficient contract balance).This is due to a known rounding down issue in the
stETH
token contract that uses shares for tracking balances.So this will result in DoS of the
deposit()
function with this token, and would result in DoS of any other 3-rd party protocols interacting with this function directly.Code Snippet
https://github.com/sherlock-audit/2024-06-mellow/blob/26aa0445ec405a4ad637bddeeedec4efe1eba8d2/mellow-lrt/src/utils/DepositWrapper.sol#L55C9-L57C45
Tool used
Manual Review
Recommendation
Update
DepositWrapper.deposit()
function to account for the actual transferredwstETH
token: