-
Notifications
You must be signed in to change notification settings - Fork 3
dimah7 - Missing circuit breaker checks in getExpectedExchange()
for Chainlink's price feed
#80
Comments
getExpectedExchange()
for Chainlink's price feedgetExpectedExchange()
for Chainlink's price feed
@Hash01011122 This should not be a duplicate of #14, as it is specifically for circuit breakers and not for Sequencer downtime. This is a separate issue from that as the root cause is different. |
@Hash01011122 Based on Sherlock's duplication rules, this finding doesn't meet the criteria to be considered as duplicate of #14 , since fixing the root cause of #14 will not resolve this issue also |
Escalate Based on the above comments. |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
As it was correctly mentioned by Watsons on Discrod, minAnswer and maxAnswer are no longer used. Hence, this report should stay invalid. Since I'm planning to invalidate #14 as well, this rejection will be rejected as well cause all issues will be invalid. If #14 remains valid, these and other issues about min and max prices will be invalidated and escalation accepted. |
The escalation is based on how this issue is judged as a dup of #14 when in fact they don't have the same root cause. Either way i think since the escalation is solely on how the issue is wrongly duplicated, it's rejection or acceptance should lie solely on that, as they're clearly not duplicates. |
@WangSecurity I would like to add my perspective and would suggest that this issue should remain valid, rest is up to you to decide. There seems to be certain confusion around how The reason these are not used on most feeds are because most feeds would return the The If we check the aggregator, the address of the aggregator is 0x02f5E9e9dcc66ba6392f6904D5Fcf8625d9B19C9. If we check the Hence, the minimum price that it will return for ETH is $10, which is not completely unreasonable. So, the protocol should define the range of acceptable values as I mentioned the same thing in #163, but since I do not have escalation rights now, it seems that went unnoticed. |
Thank you for that input @Nilay27 for that insightful input. But I still believe these are sanity checks and recommendation, so this report and the duplicates of 80 should be low/info. Hence, remain invalid. @AuditorPraise thank you for that comment and it's a very good remark. The problem is that if #14 is invalidated after escalations, then based on Sherlock's rules of escalations, this escalation will be rejected cause it doesn't effect the reward distribution. |
Thanks for the feedback, @WangSecurity. I appreciate your input and will not dispute the logic. I submitted this issue because, until fairly recently, such issues were awarded medium severity on Sherlock. But it seems now we are moving away from such findings and categorizing them as low/info. |
Thank you for these references, but Historical Decisions are not sources of truth under Sherlock's Rules. And I of course don't say it's wrong, but see this a low/info severity. |
This issue can be invalidated |
Result: |
Escalations have been resolved successfully! Escalation status:
|
dimah7
medium
Missing circuit breaker checks in
getExpectedExchange()
for Chainlink's price feedSummary
The
OptimismRewardCollector::getExpectedExchange
function relies on Chainlink oracle to fetch the prices of OP/USD and ETH/USD. However Chainlink aggregators have a built in circuit breaker if the price of an asset goes outside of a predetermined price band. If an asset experiences a major drop or rise in value, the price feeds will continue to returnminAnswer/maxAnswer
instead of the actual price. A real-world example can be seen here. In our case wrongexpectedExchange
value will be returned, which is then subsequently used as an input parameter inclaimAndDonateRewards
function:As can be seen this will result in the collector receiving the wrong amount after the swap or the swap transaction reverting. Code snippet to
swapExactTokensForTokens
function hereVulnerability Detail
There isn't a check for the price to be in the preffered range, but only to not be zero or non-negative:
Similar issues can be seen here:
sherlock-audit/2023-02-blueberry-judging#18
https://solodit.xyz/issues/m-2-priceoracle-will-use-the-wrong-price-if-the-chainlink-registry-returns-price-outside-minmax-range-sherlock-none-iron-bank-git
https://solodit.xyz/issues/m-02-missing-check-for-the-maxmin-price-in-the-chainlinkoraclesol-contract-code4rena-moonwell-moonwell-git
https://solodit.xyz/issues/m-09-missing-circuit-breaker-checks-in-ethpercvx-for-chainlinks-price-feed-code4rena-asymmetry-finance-asymmetry-finance-git
Impact
Can result in the collector claiming different values than it should or cause the swap function to revert, because of insufficient output amount.
Code Snippet
https://github.com/sherlock-audit/2024-04-alchemix/blob/32e4902f77b05ea856cf52617c55c3450507281c/v2-foundry/src/utils/collectors/OptimismRewardCollector.sol#L91-L141
Tool used
Manual Review
Recommendation
Implement the proper check for each returned price:
Duplicate of #14
The text was updated successfully, but these errors were encountered: