The LendingPool::borrow function incorrectly checks the liquidation threshold against the debt amount instead of the collateral value, allowing users to borrow up to 125% of their collateral value.
The issue occurs in the borrow() function where the liquidation threshold check is implemented incorrectly:
The check applies the liquidation threshold (80%) to the debt amount instead of the collateral value. This inverts the intended relationship between collateral and debt.
For example, with a liquidation threshold of 80%:
Intended: Max debt = collateral * 80%
Current: collateral > debt * 80%
This means: collateral > debt * 0.8
Therefore: debt < collateral / 0.8
Result: debt can be up to 125% of collateral value
User deposits NFT worth 100 ETH
With 80% liquidation threshold:
Intended max borrow: 80 ETH
Actual max borrow: 125 ETH
User can borrow 56.25% more than intended (125 ETH vs 80 ETH)
User now has debt worth more than their collateral
Add the following test to the LendingPool.test.js file:
Users can borrow up to 125% of their collateral value
Protocol is undercollateralized from the start
Fix the threshold check to apply to collateral:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.