The LendingPool contract allows users to borrow against their collateral value, but the current implementation permits borrowing amounts that could exceed the safe liquidation threshold. This creates potential insolvency risks for the protocol.
The key issues are
Validation check has reversed logic for comparing debt to collateral threshold
State updates occur after validation, creating potential race conditions
Scaling calculations happen in multiple steps rather than atomically
Imagine a home equity line of credit where the bank accidentally lets you borrow more than your house is worth. That's exactly what's happening.
When a user deposits their tokenized real estate (RAACNFT) as collateral, they should only be able to borrow up to 80% of its value, the liquidationThreshold. However,
Let's walk through how this plays out:
A user deposits a RAACNFT worth 100,000 USDC. The protocol's liquidationThreshold of 80% should limit their borrowing to 80,000 USDC. However, due to insufficient validation in the borrow function, they can make multiple smaller borrows that individually pass checks but collectively exceed this limit.
The core issue lies in how the LendingPool tracks debt accumulation:
This creates a real-world risk where users can accumulate debt beyond their collateral's safe threshold, potentially leaving the protocol with bad debt if house prices decline. It's like a credit card that doesn't track your total credit utilization across multiple purchases.
The LendingPool's borrow function allows borrowing that could push total debt above the safe threshold due to:
total debt (currentDebt + new borrow amount) must stay below the maxBorrow threshold, calculated as a percentage of collateral value.
Attack Flow
User deposits minimal collateral
Makes multiple borrow calls that individually pass validation
Total debt accumulates beyond the safe threshold
Protocol becomes exposed to liquidation risks
Root Cause The LendingPool's borrow validation focuses on individual transactions rather than maintaining invariants about total debt-to-collateral ratios across multiple borrows.
This could lead to under-collateralized positions, threatening protocol solvency if collateral prices decline or liquidations fail to execute efficiently.
Should validate that newTotalDebt <= collateralValue.percentMul(liquidationThreshold)
before any state changes.
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.