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

0xShoonya - Lido 1-2 wei transfer issue #298

Closed
sherlock-admin2 opened this issue Jun 27, 2024 · 0 comments
Closed

0xShoonya - Lido 1-2 wei transfer issue #298

sherlock-admin2 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-admin2
Copy link

sherlock-admin2 commented Jun 27, 2024

0xShoonya

High

Lido 1-2 wei transfer issue

Summary

Vulnerability Detail

When user calls deposit and token is steth, the amount param passed by the user is utilized in IERC20(steth).safeTransferFrom(sender, wrapper, amount) and transferred to the contract.

 if (token == steth) {
    IERC20(steth).safeTransferFrom(sender, wrapper, amount); 
    amount = _stethToWsteth(amount);

The vulnerability here is that 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, 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. This is a known high severity issue.

Wrapping to wsteth will revert, because the contract doesn't have enough stETH.

 function _stethToWsteth(uint256 amount) private returns (uint256) {
        IERC20(steth).safeIncreaseAllowance(wsteth, amount);
        IWSteth(wsteth).wrap(amount);steth- reverts
        return IERC20(wsteth).balanceOf(address(this));
    }

Impact

deposit()function will revert

Code Snippet

https://github.com/sherlock-audit/2024-06-mellow/blob/main/mellow-lrt/src/utils/DepositWrapper.sol#L42-L75

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.

Duplicate of #299

@sherlock-admin3 sherlock-admin3 changed the title Clumsy Clay Mole - ChainlinkOracle._validateAndGetPrice() doesn't correctly validate the returned price Lido 1-2 wei transfer issue 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 Lido 1-2 wei transfer issue Clumsy Blood Mantis - Lido 1-2 wei transfer issue 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 Clumsy Blood Mantis - Lido 1-2 wei transfer issue 0xShoonya - Lido 1-2 wei transfer issue 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