This repository has been archived by the owner on Nov 24, 2024. It is now read-only.
EgisSecurity - Many cases stEth::transferFrom
will transfer 1-2 less way, which would result in revert in consequent functions, because of not enough balance
#63
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Won't Fix
The sponsor confirmed this issue will not be fixed
EgisSecurity
high
Many cases
stEth::transferFrom
will transfer 1-2 less way, which would result in revert in consequent functions, because of not enough balanceSummary
When user calls
depositStEth
, he passes_amount
param, which is set toIERC20(stETH).safeTransferFrom()
func and then the sam_amount
is passed down the chain:Vulnerability Detail
The probability of issue appearing is high and you can check in the following discussion. It has also been classified as a High severity on past contests:
lidofinance/core#442
stETH
is using shares for tracking balances and it is a known issue that due to rounding error, transferred shares may be 1-2 wei less than_amount
passed.This would revert on the following line as we have transferred
_amount - 1
and farming contract do not holdstEth
funds:The impact may be bigger if the staking contract is implemented by 3rd party protocol and expect this the function to be always fine.
Impact
Code Snippet
https://github.com/sherlock-audit/2024-05-sophon/blob/05059e53755f24ae9e3a3bb2996de15df0289a6c/farming-contracts/contracts/farm/SophonFarming.sol#L474-L478
Tool used
Manual Review
Recommendation
Use lido recommendation to utilize
transferShares
function, so the_amount
is realistic, or implement FoT approach, which compares the balance before and after the transfer.The text was updated successfully, but these errors were encountered: