Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

AuditorPraise - Missing circuit breaker checks in optimismRewardCollector.getExpectedExchange() while querying prices #17

Closed
github-actions bot opened this issue Apr 22, 2024 · 8 comments
Labels
Escalation Resolved This issue's escalations have been approved/rejected Excluded Excluded by the judge without consulting the protocol or the senior Non-Reward This issue will not receive a payout

Comments

@github-actions
Copy link

github-actions bot commented Apr 22, 2024

AuditorPraise

medium

Missing circuit breaker checks in optimismRewardCollector.getExpectedExchange() while querying prices

Summary

see vulnerability detail.

Vulnerability Detail

optimismRewardCollector.getExpectedExchange() relies on chainlink oracle to get price

        (
            uint80 roundID,
            int256 opToUsd,
            ,
            uint256 updateTime,
            uint80 answeredInRound
        ) = IChainlinkOracle(opToUsdOracle).latestRoundData();
        
        require(
            opToUsd > 0, // @audit-issue min/max not 0
            "Chainlink Malfunction"
        );
       (
            uint80 roundIDEth,
            int256 ethToUsd,
            ,
            uint256 updateTimeEth,
            uint80 answeredInRoundEth
        ) = IChainlinkOracle(ethToUsdOracle).latestRoundData();
        
        require(
            ethToUsd > 0, // @audit-issue min/max not 0
            "Chainlink Malfunction"
        ); 

As seen from above, there is no check to ensure that returned answer does not go below or above a certain price.

Chainlink aggregators have a built in circuit breaker if the price of an asset goes outside of a predetermined price band. Therefore, if op & eth experiences a huge drop/rise in value, the op/Usd & eth/Usd price feed will continue to return minAnswer/maxAnswer instead of the actual price of op & eth.

This will be problematic because it could potentially lead to a scenario where the protocol interacts with the assets using incorrect price information.

Impact

Missing circuit breaker checks in optimismRewardCollector.getExpectedExchange() while querying prices allows protocol to use incorrect price information if op / eth experiences a huge drop/rise in value

Code Snippet

https://github.com/sherlock-audit/2024-04-alchemix/blob/main/v2-foundry/src/utils/collectors/OptimismRewardCollector.sol#L106

https://github.com/sherlock-audit/2024-04-alchemix/blob/main/v2-foundry/src/utils/collectors/OptimismRewardCollector.sol#L124

Tool used

Manual Review

Recommendation

Implement some sort of circuit breaker, so if the price goes below or above a threshold, it reverts the transaction; just as recommended by Chainlink here:: https://docs.chain.link/data-feeds/selecting-data-feeds#market-failures-resulting-from-extreme-events

@github-actions github-actions bot added the Excluded Excluded by the judge without consulting the protocol or the senior label Apr 22, 2024
@sherlock-admin4 sherlock-admin4 changed the title Fluffy Coral Mule - Missing circuit breaker checks in optimismRewardCollector.getExpectedExchange() while querying prices AuditorPraise - Missing circuit breaker checks in optimismRewardCollector.getExpectedExchange() while querying prices Apr 30, 2024
@sherlock-admin4 sherlock-admin4 added the Non-Reward This issue will not receive a payout label Apr 30, 2024
@ABDuullahi
Copy link

Escalate

This should be a dupp of issue 80

@sherlock-admin3
Copy link

Escalate

This should be a dupp of issue 80

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.

@sherlock-admin4 sherlock-admin4 added the Escalated This issue contains a pending escalation label Apr 30, 2024
@WangSecurity
Copy link
Collaborator

As it was correctly notified by Watsons on Discord, minAnswer and maxAnswer are no longer used on most of the Feeds, hence, this report should be invalid. If escalation on #14 is accepted and it's invalid, will reject the escalation here. If #14 is rejected, then this escalation will be accepted and de-duplicated.

@AuditorPraise
Copy link

As it was correctly notified by Watsons on Discord, minAnswer and maxAnswer are no longer used on most of the Feeds, hence, this report should be invalid. If escalation on #14 is accepted and it's invalid, will reject the escalation here. If #14 is rejected, then this escalation will be accepted and de-duplicated.

The escalation is around how this issue is missed as a dup of #80 when in fact they are clearly the same.

Either way i think since the escalation is solely on how the issue is missed out as a dup of #80 , it's rejection or acceptance should lie solely on that.

@WangSecurity
Copy link
Collaborator

@AuditorPraise thank you for that comment and remark. But under Sherlock's rules of escalations, if #14 will be invalid, then this escalation has to be rejected, since it doesn't effect the reward distribution

@Hash01011122
Copy link
Collaborator

Agreed with @WangSecurity, this can be invalidated

@Evert0x
Copy link

Evert0x commented May 6, 2024

Result:
Invalid
Unique

@sherlock-admin2 sherlock-admin2 removed the Escalated This issue contains a pending escalation label May 6, 2024
@sherlock-admin3 sherlock-admin3 added the Escalation Resolved This issue's escalations have been approved/rejected label May 6, 2024
@sherlock-admin4
Copy link
Contributor

Escalations have been resolved successfully!

Escalation status:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Escalation Resolved This issue's escalations have been approved/rejected Excluded Excluded by the judge without consulting the protocol or the senior Non-Reward This issue will not receive a payout
Projects
None yet
Development

No branches or pull requests

8 participants