Open code423n4 opened 1 year ago
kirk-baird marked the issue as confirmed for report
kirk-baird marked the issue as satisfactory
The development team have scoped M-07 as a partial fix leaving part of the issue as wontfix. This is decided based on the low likelihood of attack and small gains by an attacker exploiting this issue.
This issue as well as #23 and #18 are tagged as unmitigated. This is not strictly accurate as the initial issue is only intended to be partially mitigated. However, there are some worthwhile comments from the wardens explaining the partial fix and some additional details. Thus, I'm going to leave the tag as unmitigated
rather than mitigated
.
Lines of code
https://github.com/code-423n4/2023-05-xeth/blob/add-xeth/src/AMO2.sol#L249-L284
Vulnerability details
Comments
The very first point that needs to be made, is that, according to the Mitigation Review details:
The MEV Protection rpc ensure the rebalance and defender won't be affected by the MEV attack any more. So under the circumstances, you can just skip the issue M-07 and the following detail.
Unmitigated
I don't really get the point of the mitigation commit. It seems like only split the maxSlippageBPS to upSlippage and downSlippage, but doesn't change anything about the slippage check caculation.
The issue is the fault in slippage calculation method, instead of slippage itself. I think I should provide the complete exploit to explain how the MEV attacker can get continuous arbitrages from rebalance.
As I mentioned in the issue https://github.com/code-423n4/2023-05-xeth-findings/issues/14 comments, it's similar to https://github.com/code-423n4/2023-05-xeth-findings/issues/35 . But it has a big difference that the https://github.com/code-423n4/2023-05-xeth-findings/issues/35 assumes a rogue defender as a starting point of attack, https://github.com/code-423n4/2023-05-xeth-findings/issues/14 doesn't need.
Proof of Concept
50 / (50 + 20) = 0.71 > 0.68
25/(25+9) = 0.735 <= 0.75
.I write a test file for the above process:
Parameter adjustment:
A
is 20. It amplifies price changes, but it's reasonable because the A of stETH/ETH pool is 30.test/AMO2_c4r.t.sol
run test:
logs:
As you can see, the attacker made a profit of 0.194 lp and the current
xEthPct = 0.754 > 0.75
. The rebalance up will be triggered again. And the attacker can repeat the arbitrage in the next round.Assessed type
MEV