Submitted by serial-coder
The WiseLending protocol implements the OracleHelper::_compareMinMax() to detect the circuit-breaking events of Chainlink aggregators when an asset price goes outside of pre-determined min/max values. For instance, in case of a significant price drop (e.g., LUNA crash), the asset price reported by the Chainlink price feed will continue to be at the pre-determined minAnswer instead of the actual price.
The _compareMinMax()s objective is to prevent such a crash event that would allow a user to borrow other assets with the wrongly reported asset price. For more, refer to the case of Venus Protocol and Blizz Finance in the crash of LUNA.
However, the current implementation of the _compareMinMax() got an off-by-one bug that would prevent the function from detecting the mentioned Chainlink aggregators circuit-breaking events. In other words, the function will not revert the transaction if the flash crash event occurs as expected.
In the flash crash event, the Chainlink price feed will continue to return the _answer at the pre-determined minAnswer instead of the actual price.  In other words, the possible minimum value of the _answer would be minAnswer.
Since the _compareMinMax() does not include the case of _answer == minAnswer (also, _answer == maxAnswer), the function could not detect whether or not the crash event happens.
https://github.com/code-423n4/2024-02-wise-lending/blob/79186b243d8553e66358c05497e5ccfd9488b5e2/contracts/WiseOracleHub/OracleHelper.sol#L97
Add the cases _answer == minAnswer and _answer == maxAnswer like the snippet below:
Oracle
Trust (judge) decreased severity to Low
serial-coder (warden) commented:
Trust (judge) increased severity to Medium and commented:
00xSEV (warden) commented:
serial-coder (warden) commented:
Wise Lending commented:
