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

# Function withdraw may be reverted due to hardcoded slippage during market turbulence conditions. #711

Closed
code423n4 opened this issue Mar 30, 2023 · 5 comments
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-150 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/WstEth.sol#L60

Vulnerability details

Function withdraw may be reverted due to hardcoded slippage during market turbulence conditions.

WstEth.sol has a hardcoded maxSlipage as 1%. It could revert the withdraw function during sudden price crashes.

Proof of Concept

35  maxSlippage = (1 * 10 ** 16); // 1%

https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/WstEth.sol#L35

60   uint256 minOut = (stEthBal * (10 ** 18 - maxSlippage)) / 10 ** 18;

https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/WstEth.sol#L60

Due to hard coded maxSlippage owner unable to define minOut so that its a constant (relative to the input parameter amount) , eventually Owner unable to perform the withdraw function during price crash conditions.

Tools Used

Manual Auditing

Recommended Mitigation Steps

Remove the hard coded maxSlippage & let owner to determine the maximum slippage he's willing to take with the current market condition as a
input parameter for the withdraw function.

@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 Mar 30, 2023
code423n4 added a commit that referenced this issue Mar 30, 2023
@c4-pre-sort
Copy link

0xSorryNotSorry marked the issue as duplicate of #814

@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #588

@c4-judge c4-judge added duplicate-588 satisfactory satisfies C4 submission criteria; eligible for awards and removed duplicate-814 labels Apr 23, 2023
@c4-judge
Copy link
Contributor

Picodes marked the issue as satisfactory

@c4-judge
Copy link
Contributor

Picodes marked the issue as not a duplicate

@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #150

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-150 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants