Status DataClose notification

Kinetic Disclosed Report

Audit Report

Interest rate manipulation in cToken markets where `borrowCap = 0` (i.e unlimited borrowing).

Target

https://github.com/kinetic-market/public-money-market-contracts

Vulnerability details

The borrow rate is significantly dependent on if(util > kink). For cToken markets with unlimited borrowing borrowCap = 0, an attacker could monitor for pending borrow transactions, use a flashloan to mint cTokens (supply liquidity by extension) and immediately borrow the liquidity supplied.

This causes the utilitization rate to sky-rocket and significantly exceed the kink value (util > kink) so that the else block in getBorrowRate is executed the next time accrueInterest is called.

At best, the market becomes unattractive to genuine borrowers (due to significantly greater borrow rates), and in the worst case scenario, the next actions that require a call to accrueInterest would revert due to the line: require(borrowRateMantissa <= borrowRateMaxMantissa, "borrow rate is absurdly high");.

Validation steps

Proof of Concept 1 Assume a cToken market (underlying is USDC for example) with unlimited borrowing (borrowCap = 0), a borrowRateMaxMantissa, 10 and a kink 5e17. The current market state parameters are as follows:

getCash() = 300USDC totalBorrows = 200USDC totalReserves = 0 jumpMultiplierPerTimestamp = 0 util = (200 * 1e18 / (200 + 300 - 0) = 4e17 (40%)

2 An attacker foresees an action that requires a call to accrueInterest (could be a borrow or otherwise), the attacker front-runs the said transaction, using a flashloan to mint cTokens (supplying liquidity - 14500USDC) and immediately borrows a relatively large amount - same 14500USDC (no borrowCap protection). The market state parameters at this point are as follows:

getCash() = 300USDC totalBorrows = 14700USDC totalReserves = 0 util = (14700 * 1e18 / (300 + 14700 - 0) = 98e16 (98%) util.sub(kink) returns 48e16 i.e 48% from (98% - 50%) For simplicity, let uint normalRate = kink.mul(multiplierPerTimestamp).div(1e18).add(baseRatePerTimestamp); returns mantissa, 5 and let jumpMultiplierPerTimestamp = 25. excessUtil.mul(jumpMultiplierPerTimestamp).div(1e18).add(normalRate); returns 12 ((48e16 * 25) / 1e18) + 5)

3 Any call to accrueInterest reverts due to the check require(borrowRateMantissa <= borrowRateMaxMantissa, "borrow rate is absurdly high"); and by extension all user actions would not be successful.

4 The attacker may then decide to leave the market calling redeem and repayBorrow in succession if he wishes and the cost incurred for the attack is insignificant.

Recommendation: Allow borrowRateMantissa = borrowRateMaxMantissa for the condition if(borrowRateMantissa > borrowRateMaxMantissa).

Comments are hidden

This information is not publicly available.