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
ethToeETH() returns the amount of shares minted instead of the amount of tokens received
Summary
The function _ethTOeEth(), used to convert ETH into eETH, incorrectly returns the amount of shares minted instead of the amount of tokens received. This results in the protocol staking less eETH than it should, with the remaining part being stuck in the contract.
Vulnerability Detail
The function _ethTOeEth() deposits ETH in the EtherFi protocol in exchange for eETH tokens:
function _ethTOeEth(uint256_amount) internalreturns (uint256) {
returnIeETHLiquidityPool(eETHLiquidityPool).deposit{value: _amount}(address(this)); //@5 this returns `shares` but should return `balance`
}
The value returned by the deposit() function is the amount of shares received as it can be seen from the implementation:
This is an issue because both depositWeth() and depositEth() expect the return value of _ethTOeEth() to represent the amount of eETH received instead of the amount of shares received.
The amount returned by _ethTOeEth() will be lower than the amount of eETH received (because shares are worth more), which results in the caller depositing less eETH than expected with the remaining unstaked eETH being stuck in the contract.
_ethTOeEth() deposits 1 ETH in Etherfi which returns the amount of shares deposited, 962364978556513677.
depositEth() stakes 962364978556513677eETH in the Sophon protocol.
The remaining 1e18 - 962364978556513677 is stuck in the contract.
Alice wanted to stake 1 ETH, but only ~0.9623ETH got staked.
Impact
At the current valuation of EtherFi shares about 3.7% of funds deposited in the weETH pool via either depositEth() or depositWeth() will not be staked and will be stuck in the contract.
Code Snippet
Tool used
Manual Review
Recommendation
In _ethTOeEth() return the balance received instead of the amount of shares:
1 comment(s) were left on this issue during the judging contest.
0xmystery commented:
valid because it's the shares that matter
sherlock-admin3
changed the title
Happy Aegean Crab - ethToeETH() returns the amount of shares minted instead of the amount of tokens received
zzykxx - ethToeETH() returns the amount of shares minted instead of the amount of tokens received
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
high
ethToeETH()
returns the amount of shares minted instead of the amount of tokens receivedSummary
The function _ethTOeEth(), used to convert
ETH
intoeETH
, incorrectly returns the amount of shares minted instead of the amount of tokens received. This results in the protocol staking lesseETH
than it should, with the remaining part being stuck in the contract.Vulnerability Detail
The function _ethTOeEth() deposits
ETH
in the EtherFi protocol in exchange foreETH
tokens:The value returned by the
deposit()
function is the amount of shares received as it can be seen from the implementation:This is an issue because both depositWeth() and depositEth() expect the return value of _ethTOeEth() to represent the amount of
eETH
received instead of the amount of shares received.The amount returned by _ethTOeEth() will be lower than the amount of
eETH
received (because shares are worth more), which results in the caller depositing lesseETH
than expected with the remaining unstakedeETH
being stuck in the contract.POC
Alice wants to deposit
1ETH
:1 ETH
1 ETH
in Etherfi which returns the amount of shares deposited,962364978556513677
.962364978556513677
eETH
in the Sophon protocol.1e18 - 962364978556513677
is stuck in the contract.Alice wanted to stake
1 ETH
, but only~0.9623ETH
got staked.Impact
At the current valuation of EtherFi shares about 3.7% of funds deposited in the
weETH
pool via either depositEth() or depositWeth() will not be staked and will be stuck in the contract.Code Snippet
Tool used
Manual Review
Recommendation
In _ethTOeEth() return the balance received instead of the amount of shares:
Duplicate of #4
The text was updated successfully, but these errors were encountered: