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

araj - stEth:transferFrom() transfers 1-2 wei less than the actual amount #41

Closed
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

araj

Medium

stEth:transferFrom() transfers 1-2 wei less than the actual amount

Summary

stEth:transferFrom() transfers 1-2 wei less than the actual amount due to rounding down. Read more

Vulnerability Detail

When a user deposits stEth using Vault::deposit(), it transfers the actualAmount from user to address(this) using safeTransferFrom()

           IERC20(tokens[i]).safeTransferFrom(
                msg.sender,
                address(this),
                amount
            );
            actualAmounts[i] = amount;

stETH uses shares for tracking balances and it is a known issue that due to rounding error, transferred shares may be 1-2 wei less than amount passed in transferFrom().

Now the problem is this actualAmount is directly passed to depositCallback(), as result this call will revert or not work as intended because there is 1-2 wei less stEth than actualAmount

        address callback = configurator.depositCallback();
        if (callback == address(0)) return (actualAmounts, lpAmount);
   @>     IDepositCallback(callback).depositCallback(actualAmounts, lpAmount);

Impact

Deposit can be DoS

Code Snippet

https://github.com/sherlock-audit/2024-06-mellow/blob/main/mellow-lrt/src/Vault.sol#L329C11-L334C39
https://github.com/sherlock-audit/2024-06-mellow/blob/main/mellow-lrt/src/Vault.sol#L340C7-L342C77

Tool used

Manual Review

Recommendation

Check balance before and after calling safeTransferFrom() for actual amount transfered

Duplicate of #299

@sherlock-admin3 sherlock-admin3 changed the title Zany Candy Worm - Deposit transaction reverts due to stEth transfer leaving 1-2 wei on the sender's account stEth:transferFrom() transfers 1-2 wei less than the actual amount 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 stEth:transferFrom() transfers 1-2 wei less than the actual amount Proper Sepia Toad - stEth:transferFrom() transfers 1-2 wei less than the actual amount 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 Proper Sepia Toad - stEth:transferFrom() transfers 1-2 wei less than the actual amount araj - stEth:transferFrom() transfers 1-2 wei less than the actual amount 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