This repository has been archived by the owner on Nov 12, 2023. It is now read-only.
0xStalin - ChainlinkOracle will return a wrong price for the asset in case of market turbulence #63
Labels
Non-Reward
This issue will not receive a payout
0xStalin
medium
ChainlinkOracle will return a wrong price for the asset in case of market turbulence
Summary
Chainlink aggregators have implemented an automatic fail backup mechanism in case the price of an asset experiences a huge drop in value. The price of the oracle will continue to return the
minPrice
of the real price of the asset.In the event that any of the approved collaterals, or even USDC experiences market turbulences and its price drops hard, the users will be able to continue borrowing JUSD with assets priced wrongly. This is exactly what happened when LUNA crashed, affecting a couple of protocols.
Vulnerability Detail
ChainlinkFeedRegistry:latestRoundData()
pulls the associated aggregator and requests round data from it. ChainlinkAggregators haveminPrice
andmaxPrice
circuit breakers built into them. If the price of the asset drops below the minPrice, the protocol will continue to value the token at minPrice instead of its real value. This will allow users to take out huge amounts of bad debt and potentially bankrupt the protocol, or at least harming tremendously the solvency of the protocol reserves.Example:
As per Chainlink Risk Mitigation Guide Lines
Impact
In the event that an asset crashes, the protocol can be manipulated to give out bad loans at an inflated price
Code Snippet
https://github.com/sherlock-audit/2023-04-jojo/blob/main/JUSDV1/src/oracle/JOJOOracleAdaptor.sol#L26-L35
https://github.com/sherlock-audit/2023-04-jojo/blob/main/smart-contract-EVM/contracts/adaptor/chainlinkAdaptor.sol#L43-L55
Tool used
Manual Review
Recommendation
Consider implementing the same recomendation on the getMarkPrice():chainlinkAdaptor.sol
Additionally, consider checking if the sequencer is up on the L2. as per Chainlink Documentation, consider adding the below code snippet on the two Chainlink Oracles to validate Sequencer is up and prevent users from abusing in case the sequencer is not running and a bad price is being returned
Duplicate of #101
The text was updated successfully, but these errors were encountered: