In LendingPool.sol
, the collateralization checks in both borrow()
and withdrawNFT()
functions incorrectly apply the liquidation threshold by multiplying it with the debt instead of the collateral. This backwards calculation makes the debt requirement artificially lower, allowing users to borrow more than the protocol intends and creating under collateralized positions.
The protocol aims to ensure that a user's debt never exceeds a certain percentage of their collateral value (defined by the liquidation threshold). However, the current implementation in LendingPool.sol
applies this threshold incorrectly.
In borrow()
:
In withdrawNFT()
:
The fundamental issue is that multiplying the debt by the threshold (which is less than 100%) makes the debt requirement smaller than it should be.
Intended Formula:
Current Incorrect Formula:
Critical. This vulnerability allows:
Users to borrow up to 125% of their collateral value (1/0.8) instead of the intended 80%
Creation of undercollateralized positions from the start
Potential bad debt that cannot be fully recovered through liquidation
Protocol insolvency risk
For example, with a $500,000 collateral deposit:
Users can borrow up to $625,000 (125% of collateral) instead of the intended $400,000 (80% of collateral).
This represents an excess borrowing of $225,000 (56.25% more).
If liquidated, the $500,000 collateral cannot cover the $625,000 debt.
Results in minimum $125,000 bad debt per position of this size.
Manual Review
Modify the collateralization checks to apply the threshold to the collateral value:
For borrow()
:
For withdrawNFT()
:
This ensures the protocol maintains its intended maximum loan-to-value ratio and prevents undercollateralized positions.
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.