QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

Unfavorable asset re-balance in pool when chainlink oracle returns incorrect price during flash crashes

Chainlink price feeds have in-built minimum & maximum prices they will return; if during a flash crash, bridge compromise, or depegging event, an asset’s value falls below the price feed’s minimum price, the oracle price feed will continue to report the (now incorrect) minimum price.

This attack could cause the protocol to think that a certain asset in a pool is doing better than it actually is in real life. As a result, the ratio of the assets in pool rebalance would be less skewed than it should be to provide maximum value for the users.

Code

Following is a function in UpdateWeightRunner::_getOracleData where we only return data from oracle and not check for min/max values

function _getOracleData(OracleWrapper _oracle) private view returns (OracleData memory oracleResult) {
if (!approvedOracles[address(_oracle)]) return oracleResult; // Return empty timestamp if oracle is no longer approved, result will be discarded
(int216 data, uint40 timestamp) = _oracle.getData();
oracleResult.data = data;
oracleResult.timestamp = timestamp;
}

Mitigation:

Chainlink’s oracle feed [minAnswer, maxAnswer] values can be found by:

More examples: [1, 2]

Use the min and max values to then assume that

  • if an assets’s price is equal to (or less than) min answer then it’s performing very poorly

  • if an assets’s price is equal to (or more than) max answer then it’s performing better than we think.

Reference Article:

https://medium.com/cyfrin/chainlink-oracle-defi-attacks-93b6cb6541bf

Updates

Lead Judging Commences

n0kto Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

invalid_chainlink_min_max_no_check

LightChaser: ## [Low-25] Chainlink answer is not compared against min/max values

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.