Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

returning wrong information for AccumulatedETH in GiantMevAndFeesPool.sol #320

Closed
code423n4 opened this issue Nov 18, 2022 · 2 comments
Closed
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-160 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/GiantMevAndFeesPool.sol#L91

Vulnerability details

Impact

The function is not used internally from any other contract, but can/will be used from bots or endusers to check the balance.
As the return value is always wrong when _stakingFundsVaults.length > 1 it is not usable for consumers.

Proof of Concept

accumulated is overwritten for every loop.

File: contracts/liquid-staking/GiantMevAndFeesPool.sol
89:         uint256 accumulated;
90:         for (uint256 i; i < _stakingFundsVaults.length; ++i) {
91:             accumulated = StakingFundsVault(payable(_stakingFundsVaults[i])).batchPreviewAccumulatedETH(
92:                 address(this),
93:                 _lpTokens[i]
94:             );
95:         }

In the end accumulated is returned via

return _previewAccumulatedETH(_user, address(_lpTokenETH), _lpTokenETH.balanceOf(_user), _lpTokenETH.totalSupply(), accumulated);

Recommended Mitigation Steps

Remove function, so users or bots can't use it if it's not important, or fix the accumulated to sum up correctly.

accumulated +=

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Nov 18, 2022
code423n4 added a commit that referenced this issue Nov 18, 2022
@c4-judge
Copy link
Contributor

dmvt marked the issue as duplicate of #160

@c4-judge
Copy link
Contributor

dmvt marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-160 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants