Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

L-5 Incomplete check inside setLiqRatio() allows defining liqRatio = maxLTV #563

Closed 0xdcota closed 1 year ago

0xdcota commented 1 year ago

Description

The comment on L122 of the borrowing vault mentions

* - Must check `maxLTV` Must < `liqRatio`.

However, one can set liqRatio = maxLTV using setLiqRatio

function setLiqRatio(uint256 liqRatio_) external onlyTimelock {
    if (liqRatio_ < maxLtv || liqRatio_ == 0) {
      revert BaseVault__setter_invalidInput();
    }
    liqRatio = liqRatio_;
    emit LiqRatioChanged(liqRatio);
}

Remediation to consider

Consider adding equality to the concerned check.

From if (liqRatio_ < maxLtv || liqRatio_ == 0)

To if (liqRatio_ <= maxLtv || liqRatio_ == 0)