Submitted by rbserver
Based on the current implementation, when the protocol wants to use Chainlink oracle data feed for getting a collateral tokens price, the fixed price for the token should not be set. When the fixed price is not set for the token, calling the Oracle contracts viewPrice or getPrice function will execute uint price = feeds[token].feed.latestAnswer(). As https://blog.openzeppelin.com/secure-smart-contract-guidelines-the-dangers-of-price-oracles/ mentions, it is possible that Chainlinks multisigs can immediately block access to price feeds at will. When this occurs, executing feeds[token].feed.latestAnswer() will revert so calling the viewPrice and getPrice functions also revert, which cause denial of service when calling functions like getCollateralValueInternal andgetWithdrawalLimitInternal. The getCollateralValueInternal andgetWithdrawalLimitInternal functions are the key elements to the core functionalities, such as borrowing, withdrawing, force-replenishing, and liquidating; with these functionalities facing DOS, the protocols usability becomes very limited.
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L78-L105
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L112-L144
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L344-L347
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L323-L327
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L353-L363
The following steps can occur for the described scenario.
VSCode
The Oracle contracts viewPrice and getPrice functions can be updated to refactor feeds[token].feed.latestAnswer() into try feeds[token].feed.latestAnswer() returns (int256 price) { ... } catch Error(string memory) { ... }. The logic for getting the collateral tokens price from the Chainlink oracle data feed should be placed in the try block while some fallback logic when the access to the Chainlink oracle data feed is denied should be placed in the catch block. If getting the fixed price for the collateral token is considered as a fallback logic, then setting the fixed price for the token should become mandatory, which is different from the current implementation. Otherwise, fallback logic for getting the tokens price from a fallback oracle is needed.
08xmt (Inverse) acknowledged, but disagreed with severity and commented:
0xean (judge) commented:
08xmt (Inverse) commented:
For this contest, 54 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by 0x1f8b received the top score from the judge.
The following wardens also submitted reports: JC, Deivitto, rbserver,
d3e4, cylzxje,
tnevler, c7e7eff,
adriro, brgltd,
horsefacts, c3phas,
cryptonue, delfin454000,
Aymen0909, Josiah,
ReyAdmirado, rotcivegaf,
cducrest, robee,
gogo, lukris02,
Waze, simon135,
enckrish, wagmi,
immeas, pedr02b2,
sakshamguruji, hansfriese,
ElKu, neumo,
shark, __141345__,
cryptostellar5, 0xSmartContract,
0xNazgul, trustindistrust,
Rolezn, oyc_109,
carlitox477, ch0bu,
Diana, B2,
evmwanderer, aphak5010,
rvierdiiev, chrisdior4,
Rahoz, Bnke0x0,
Dinesh11G, fatherOfBlocks,
RaymondFam, and leosathya.
