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

Mitigation of M-12: Issue NOT mitigated #66

Open
code423n4 opened this issue May 8, 2023 · 1 comment
Open

Mitigation of M-12: Issue NOT mitigated #66

code423n4 opened this issue May 8, 2023 · 1 comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value MR-M-12 satisfactory satisfies C4 submission criteria; eligible for awards unmitigated

Comments

@code423n4
Copy link
Contributor

Mitigated issue

M-12: No slippage protection on stake() in SafEth.sol

There were issues with either a lack of slippage protection or a hard set slippage.
Slippage protection was missing in deposit() (for Reth.deposit() only if depositing in the Rocket Pool) and in Reth.withdraw(), as well as in stake() because of ethPerDerivative().
Slippage was hard set in Reth.deposit() (only if via Uniswap), SfrxEth.withdraw() and WstEth.withdraw().

Mitigation review

stake() and unstake() now takes a _minOut parameter which the amount of safETH or ETH returned is compared. This mitigates the issue with a lack of slippage protection to prevent the user from losing funds.

The hard slippage settable only by the owner remains in Reth.deposit() (for all deposits now), in SfrxEth.withdraw() and in WstEth.withdraw().

Reth.deposit() now only has one path to RocketSwapRouter, so this hard slippage always applies.

Furthermore, a hard slippage has now also been introduced in Reth.withdraw(). Therefore this is a new issue, reported under the title "Hard slippage in Reth.withdraw()".

Recommendation

Remove all slippage control from the derivatives and control slippage only in SafEth.stake() and SafEth.unstake() with the new _minOut.

Note that this enables an attacker to cause a stake distribution different from the one given by the weights. This would be achieved by manipulating two exchanges such that the sum returned from stake() is within the slippage tolerance but such that the individual slippage in each exchange is great, positive in one, negative in the other. However, I'm not sure how anyone could benefit from this. Maybe it could be exploited to target a pool to deplete it, leveraging Asymmetry to do so.
To prevent this a distribution slippage would be needed, which sets a slippage for each derivative individually (as is/was almost the case). These slippages would then also have to be provided by the user.

@c4-judge
Copy link
Contributor

Picodes marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label May 11, 2023
@liveactionllama liveactionllama changed the title Mitigation Confirmed for Mitigation of M-12: Issue NOT mitigated Mitigation of M-12: Issue NOT mitigated May 17, 2023
@liveactionllama liveactionllama added unmitigated 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value and removed mitigation-confirmed MR-Mitigation of M-12: Issue NOT mitigated labels May 17, 2023
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 MR-M-12 satisfactory satisfies C4 submission criteria; eligible for awards unmitigated
Projects
None yet
Development

No branches or pull requests

4 participants