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

zhuying - depositing stETH will revert beacuse the amount transfered does not equal the amount received in many cases for stETH #54

Closed
sherlock-admin4 opened this issue Jun 27, 2024 · 0 comments
Labels
Non-Reward This issue will not receive a payout Sponsor Disputed The sponsor disputed this issue's validity

Comments

@sherlock-admin4
Copy link
Contributor

sherlock-admin4 commented Jun 27, 2024

zhuying

High

depositing stETH will revert beacuse the amount transfered does not equal the amount received in many cases for stETH

Summary

Depositing stETH will revert beacuse the amount transfered does not equal the amount received in many cases for stETH.

Vulnerability Detail

stETH balance calculation includes integer division, and there is a common case when the whole stETH balance can't be transferred from the account while leaving the last 1-2 wei on the sender's account.

The process of depositing stETH is as follows:

  1. Transfer stETH from depositor to deposit wrapper contract.
IERC20(steth).safeTransferFrom(sender, wrapper, amount);
  1. Wrap stETH to wstETH.
IWSteth(wsteth).wrap(amount);

Because the amount in step 2 is equal to the amount in step 1 and the actual amount in deposit wrapper contract is smaller than the wrap amount, depositing stETH will revert.

Impact

Depositing stETH will revert.

Code Snippet

https://github.com/sherlock-audit/2024-06-mellow/blob/main/mellow-lrt/src/utils/DepositWrapper.sol#L55-L57
https://github.com/sherlock-audit/2024-06-mellow/blob/main/mellow-lrt/src/utils/DepositWrapper.sol#L35-L39

Tool used

manual

Recommendation

The input of _stethToWsteth is set as IERC20(steth).balanceOf(address(this)).

Duplicate of #299

@sherlock-admin4 sherlock-admin4 changed the title Sparkly Inky Elk - stETH.transferFrom will transfer 1~2 wei less than the amount specified, leading to reverted transactions depositing stETH will revert beacuse the amount transfered does not equal the amount received in many cases for stETH Jun 28, 2024
@sherlock-admin3 sherlock-admin3 added the Sponsor Disputed The sponsor disputed this issue's validity label Jun 30, 2024
@github-actions github-actions bot changed the title depositing stETH will revert beacuse the amount transfered does not equal the amount received in many cases for stETH Genuine Cloud Sardine - depositing stETH will revert beacuse the amount transfered does not equal the amount received in many cases for stETH Jul 6, 2024
@github-actions github-actions bot closed this as completed Jul 6, 2024
@github-actions github-actions bot added the Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label label Jul 6, 2024
@sherlock-admin3 sherlock-admin3 changed the title Genuine Cloud Sardine - depositing stETH will revert beacuse the amount transfered does not equal the amount received in many cases for stETH zhuying - depositing stETH will revert beacuse the amount transfered does not equal the amount received in many cases for stETH Jul 15, 2024
@sherlock-admin3 sherlock-admin3 added Non-Reward This issue will not receive a payout and removed Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Non-Reward This issue will not receive a payout Sponsor Disputed The sponsor disputed this issue's validity
Projects
None yet
Development

No branches or pull requests

2 participants