Sparrow_Jac - Protocol supports stETH
but doesn't consider its unique transfer logic which would lead to overvaluation of deposited assets
#241
Labels
Non-Reward
This issue will not receive a payout
Sponsor Disputed
The sponsor disputed this issue's validity
Sparrow_Jac
High
Protocol supports
stETH
but doesn't consider its unique transfer logic which would lead to overvaluation of deposited assetsSummary
The
StakingModule
contract handles staking operations by convertingweth
tostETH
andwstETH
. However, a subtle issue arises from the "1-2 wei corner case" withstETH
transfers, where the amount transferred can be slightly less than specified. This discrepancy can lead to overvaluation of deposited assets and flawed logic in subsequent operations.Vulnerability Detail
The core issue lies in the
_wethToWSteth
function, which does not account for the exact amount ofstETH
received after convertingweth
. Due to a known "1-2 wei corner case" instETH
transfers, the actual amount received can be less than expected, causing miscalculations in asset values. This leads to an overvaluation of depositedstETH
when passed into other functions that rely on exact amounts.For added context/ reference, take a look at:
stETH
balance getting lower on 1 or 2 wei due to rounding down integer math lidofinance/core#442Impact
This discrepancy can cause several issues:
Code Snippet
The current implementation of
_wethToWSteth
does not handle the exact amount ofstETH
received:https://github.com/sherlock-audit/2024-06-mellow/blob/main/mellow-lrt/src/modules/obol/StakingModule.sol#L77-L83
Tool used
Manual Review
Recommendation
To mitigate this issue, modify
_wethToWSteth
to check and use the exact amount of stETH received:Duplicate of #299
The text was updated successfully, but these errors were encountered: