Closed code423n4 closed 1 year ago
thereksfour marked the issue as primary issue
We have not seen this mitigation elsewhere and will be reaching out to chainlink to try to understand more about the issue.
pmckelvy1 (sponsor) disputed
from chainlink:
Hello @pmckelvy1 , there's no need to add this step as it would be redundant. If the answer falls outside the min/max values, the price feed won't update. All our feeds are set with a minimum value of 0 and a maximum value that's the highest possible number that can be generated. Please let me know if you've got any more questions.
all min/max values are set at 0/UINT_MAX, so this step would be unnecessary
According to the sponsor's reply, consider it invalid.
thereksfour marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/reserve-protocol/protocol/blob/9ee60f142f9f5c1fe8bc50eef915cf33124a534f/contracts/plugins/assets/OracleLib.sol#L14-L31
Vulnerability details
Impact
Chainlink aggregators have a built-in circuit breaker to prevent the price of an asset from deviating outside a predefined price range. This circuit breaker may cause the oracle to persistently return the
minPrice
instead of the actual asset price in the event of a significant price drop, as witnessed during the LUNA crash.Proof of Concept
The following library method is heavily used to extract linked aggregators and request round data from them. If an asset's price falls below the
minPrice
, the protocol continues to value the token at theminPrice
rather than its real value. For instance, if TokenA'sminPrice
is 1 USD and its price falls to $0.10, the aggregator continues to report 1 USD, rendering the related function calls to entail a value that is ten times the actual value.https://github.com/reserve-protocol/protocol/blob/9ee60f142f9f5c1fe8bc50eef915cf33124a534f/contracts/plugins/assets/OracleLib.sol#L14-L31
defaultThreshold
set at the constructor typically does not have a higher limit threshold; and, if there is one, it will be up toFIX_ONE
. Depending on the value assigned todefaultThreshold
, thisminAnswer
discrepancy could possibly have thepegPrice
still fall betweenpegBottom
andpegTop
, and hence dodging the marking of a collateralIFFY
status. Consequently, a larger than expected amount ofRToken
could be issued, fostering an imperceptibly unhealthy basket of collaterals.It's important to note that while Chainlink oracles form part of the OracleAggregator system and the use of a combination of oracles could potentially prevent such a situation, there's still a risk. Secondary oracles, such as
Band
, could potentially be exploited by a malicious user who can DDOS relayers to prevent price updates. Once the price becomes stale, the Chainlink oracle's price would be the sole reference, posing a significant risk.Tools Used
Manual
Recommended Mitigation Steps
As recommended by Chainlink,
OracleLib.price
should cross-check the returned answer against theminPrice/maxPrice
and revert if the answer is outside of these bounds:This ensures that a false price will not be returned if the underlying asset's value hits the
minPrice
.Assessed type
Oracle