Incorrect LTV logic in the following functions of LendingPool
1. borrow - allows borrowing more than collateral value.
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L344-L346 2.
2.withdrawNFT - allows collateral value to fall below debt
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L302-L304
The standard practice is lending protocols is to allow borrowing within the safe range of 50-90% of the deposited collateral value (based on the volatility of the colateral supplied) for sustainablity of the protocol.
This value is applied on the collateral
to get the maximum amount an user can safely borrow
In the case of RAAC LendingPool,
liquidationThreshold = 8000 (basis points _ 80 %)
which means debt cannot exceed 80% of collateral value
In other words collateral should be at least 125% of debt.
i.e, maxBorrow = collateral * LTV / 100
by this logic the correct condition to maintain safe collateral ratio should be
This is where the issue lies.
notice the inversion of the logic in the following checks
inside borrow and withdrawNFT respectively
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L344-L346
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L302-L304
The above conditions effectively allows an user
to obtain significantly more debt than their collateral value.
An example test Scenario using borrow function
Due to the incorrect application of LTV logic in borrow function,
Bob borrows 1200 USD,
effectively borrowing more than his collateral value.
Bob is now heavily undercollateralized,
and the protocol ends up with a significant bad debt,
which can accumulate and collapse the entire protocol.
A similarly calculated attack can be executed using withdrawNFT as well.
Users could borrow and withdrawNFTs beyond the safe collateral ratio
resulting in collapse of the protocol due to significant bad debt.
Impact : High
Likelihood : High
Foundry, Manual Analysis
Modify the conditions in borrow and withdrawNFT functions as follows
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.