-
Notifications
You must be signed in to change notification settings - Fork 11
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
Possible arbitrage from Chainlink price discrepancy #584
Comments
raymondfam marked the issue as insufficient quality report |
raymondfam marked the issue as duplicate of #284 |
raymondfam marked the issue as not a duplicate |
raymondfam marked the issue as high quality report |
raymondfam marked the issue as primary issue |
gus-staderlabs (sponsor) disputed |
We appreciate the explanation at length you have here. We see the arbitrage as a feature rather than a bug in the system. The past 2 year data on the price discrepancy assures us that this is a minor vector that will not impact deposits or withdraws significantly. Moreover, the fact that minters earn nominally more and withdrawals earn nominally less balances the system. We also want to call out that price arbitrage is not a unique problem to our design. It is virtually present across every staking protocol and we encourage healthy arbitrage opportunity here. |
fatherGoose1 marked the issue as unsatisfactory: |
fatherGoose1 marked the issue as satisfactory |
fatherGoose1 marked the issue as selected for report |
This is valid. Depositors will be able to deposit the minimally-priced asset and steal value from the deposit pool. The deviation % and heartbeat are too large and this will open up arbitrage opportunities to the detriment of Kelp's users. When Kelp implements the withdrawal mechanism, we will have a better understanding of the profitability of such an attack. For example, if Kelp implements withdrawals without a staking delay, given the large amount of on-chain liquidity of the underlying assets, the pool may be able to be exploited for large amounts given even a 1% price discrepancy between the different LSTs. |
@fatherGoose1 Please take what is said in this comment into account as well: #584 (comment). This issue is NOT simply about an inaccurate price. There MUST be more than one underlying for this issue to appear. An incorrect price is NOT an issue in this way in a single asset vault. |
I would also suggest that the valid issues should at least explicitly describe how the funds are stolen or arbitraged, some duplicated ones mentioned here looks too general and just mention a lack of the oracle price check. |
Hey @fatherGoose1! Thanks for an additional analysis! I think, in order to prevent any sort of spray-and-pray findings, would be great to recheck all the duplicates of #584. First of all, it's clear that, #858, #828, #687 are 100% valid duplicates. #443, this one describes an idea of front-running an oracle that delivers the rebase. For instance, in Lido #869, is 100% correct, since describes the core idea, but lacks some details, therefore partial-50 is spot on! #284, as #443 are about the same story, also looking at the mitigation steps proposed, do not think that they are indeed 100% duplicates. So, partial-50 as for #443 seems fair. #894, lacks details, but it's correct, partial-50 seems fair. #609, has some similarities, but lacks details, partial-50 seems fair. #516, lacks details, but should be correct, partial-50 seems fair. #300, idk, but seems a valid dup. #191, lacks details, partial-50 is fair. #311, unfortunately, report do not mention any price feed discrepancy that could occur, so I believe it should be invalidated. Anyways, I would love to receive the feedback from @d3e4, @romeroadrian, @0xcats, just to provide a better context to the judge for further considerations. Thanks! |
@fatherGoose1 Again appreciate your explanation here. I have seen many mentioned the difference between #443 and this one #584, both result in a valid steal of funds but looks like most of wardens think the root cause for #443 (front run) is slightly different than the price deviation for #584, I'm wondering under current C4 rules are these two should be separated issues? Thanks! |
@Rassska Any issue not specifically based on there being more than one underlying cannot be considered a duplicate of this issue. Talking about an inaccurate price and handwaving about an impact from this is simply not good enough. So I disagree about #828 and #687. I also left comments there. The current duplicates can all be condensed to the following statements:
(1) is simply a fact about Chainlink and not in itself an issue. #894, #828, #678, #609 and #191 mention only (1) and should therefore be considered invalid/insufficient proof. #869 and #311 are just pure handwaving and do not mention anything substantial at all, and should therefore also be invalidated. #865, #687, #516 and #300 also mention (2). These should be considered invalid/insufficient proof, or perhaps partial duplicates of #443 and #284 which mention (3). #828 also hints at (3). The only correct duplicates of #584 are the ones mentioning (4). Only #858 does this. It bears reiterating: being minted more or less rsETH because of an inaccurate price is NOT an issue in itself. If there is only a single underlying asset this simply implies a conversion factor (like decimals, but not multiples of ten). The issue here critically depends on there being multiple underlying assets. |
@d3e4 have you read the project description or c4 rules of duplication? There isn't a single asset anyway when the project describes that there will be three underlying assets supported at launch that the eigenlayer supports. #311 issue is the out-of-blue issue here that describes nothing and should be invalidated. Post-judging QA is over and the judge already gave the verdict so will avoid any further discussion. |
Therefore this must be included in the argument. The issue depends on both the price deviation and the multiplicity of assets. Failure to mention either implies an invalid or inadequate argument. |
Lines of code
https://github.com/code-423n4/2023-11-kelp/blob/main/src/LRTDepositPool.sol#L109
Vulnerability details
Some theory needed:
As we can see, an acceptable deviation for rETH/ETH price feed is about
[-2% 2%]
, meaning that the nodes will not update an on-chain price, in case the boundaries are not reached within the 24h period. These deviations are significant enough to open an arbitrage opportunities which will impact an overall rsETH/ETH exchange rate badly.For a further analysis we have to look at the current LSD market distribution, which is represented here:
LRTDepositPool ratio
is an approximate ratio of deposited lsts based on the overall LSD market.An example of profitable arbitrage:
In order to find an absolute extrema, we have to first understand how rsETH/ETH price is calculted. Let's examine the following:
Q(amount)
- is eth backed by amount of provided LSTs.For a further calculation convenience, suppose
LRTDepositPool
has already some liquidity and it's distributed according to the LRTDepositPool ratio:Finally, let's consider all extremas of price feed deviations that are acceptable by chainlink nodes within a 24h period:
rsethAmountToMint
:rsETHPrice
or maximize Q(amount)
.rsETHPrice
:totalEthInPool
:totalEthInPool
comes from chainlink price feeds. Let's apply some of our acceptable price feed deviations to see, whether we can minimizetotalEthInPool
or not.rETH/ETH
deviates by+~2%
stETH/ETH
deviates by-~0.5%
cbETH/ETH
deviates by-~1%
'totalEthInPool
could be calculated as:Final words:
Proof on Concept
LRTOracleMock
:setUp()
:test_DepositAsset()
:Recommended Mitigation Steps
Short term:
Long term:
Assessed type
Math
The text was updated successfully, but these errors were encountered: