Submitted by T1MOH, also found by devival, KupiaSec, kenta, RedTiger, and y51r
getBadCollateralRatio() will revert because of underflow, if vaultBadCollateralRatio[pool] and vaultSafeCollateralRatio[pool] are set to 0 (i.e. using default ratios 150% and 130% accordingly).
It blocks liquidation flow.
1e19 is decremented from value vaultSafeCollateralRatio[pool]:
However, vaultSafeCollateralRatio[pool] can be set to 0, which should mean 160%:
As a result, incorrect accounting block liquidation when using default values.
Also, I think this is similar issue, but different impact; therefore, described in this issue. BadCollateralRatio cant be set when SafeCollateralRatio is default, as newRatio must be less than 10%:
https://github.com/code-423n4/2023-06-lybra/blob/5d70170f2c68dbd3f7b8c0c8fd6b0b2218784ea6/contracts/lybra/configuration/LybraConfigurator.sol#L127
Manual Review
Instead of internal accessing variables, use functions getSafeCollateralRatio() and getBadCollateralRatio() in all the occurences because variables can be zero.
Invalid Validation
0xean (judge) decreased severity to Medium
LybraFinance confirmed
