You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issueWill FixThe sponsor confirmed this issue will be fixed
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 and eETH, 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 roundings: transferring 1e18eETH tokens from A to B, will result in B receiving 0.99e18eETH tokens.
Sophon deals with rebasing token transfers in 3 functions:
As an example the depositeEth() takes as input an amount of eETH to deposit, then:
Transfers amount of eETH from the caller to the contract itself
Wraps amount of eETH to weETH, which will attempt to transfer amount from the contract to the Etherfi protocol.
Step 2 will fail, because the contract doesn't have enough eETH. The issue lies in attempting to wrap amount of eETH in step 2 instead of wrapping the actual amount of tokens received.
This also applies to the other two functions listed above, depositSteth() and deposit() (if a stETH and/or eETH pool exists).
sherlock-admin3
changed the title
Happy Aegean Crab - depositSteth() and depositeEth() will revert
zzykxx - depositSteth() and depositeEth() will revert
Jun 1, 2024
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issueWill FixThe sponsor confirmed this issue will be fixed
zzykxx
medium
depositSteth()
anddepositeEth()
will revertSummary
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
andeETH
, 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 roundings: transferring1e18
eETH
tokens from A to B, will result in B receiving0.99e18
eETH
tokens.Sophon deals with rebasing token transfers in 3 functions:
As an example the depositeEth() takes as input an
amount
ofeETH
to deposit, then:amount
ofeETH
from the caller to the contract itselfamount
ofeETH
toweETH
, which will attempt to transferamount
from the contract to the Etherfi protocol.Step
2
will fail, because the contract doesn't have enougheETH
. The issue lies in attempting to wrapamount
ofeETH
in step2
instead of wrapping the actual amount of tokens received.This also applies to the other two functions listed above, depositSteth() and deposit() (if a
stETH
and/oreETH
pool exists).Impact
The functions depositSteth() and depositeEth() will revert.
Code Snippet
Tool used
Manual Review
Recommendation
In depositSteth(), depositeEth() and deposit() deposit the actual amount of tokens received instead of the amount specified as input.
Duplicate of #63
The text was updated successfully, but these errors were encountered: