# Liquidation wrongly uses assetAmount will lead to losses to lenders

Hyperlend's liquidation check uses principal assetAmount instead of repaymentAmount, so loans liquidate late and lenders eat interest plus liquidation fees.

- Payout: Contest reward
- Severity: medium
- Program: Hyperlend
- Credited: DeltaXV
- Disclosed: 2025-01-12
- Write-up quality: 6/10
- Original: https://cdn.cantina.xyz/reports/cantina_competition_hyperlend_november2024.pdf#3.2.1
- Library page: https://bugbountylibrary.com/r/cantina%3Ahyperlend_november2024%3A3.2.1
- Tags: domain:web3 impact:funds-loss kind:contest platform:cantina sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic vuln:liquidation

**Target:** LendingP2P.sol _isLoanLiquidatable liquidation check
**Root cause:** loanValueUsd is computed from _loan.assetAmount (principal) rather than _loan.repaymentAmount (principal + interest), so the liquidation threshold compares collateral against an understated debt.
**Steps:**
1. Deploy LendingP2P with mock ERC20 asset/collateral and mock Aggregators.
2. Create loan: assetAmount 32,000 USDC, repaymentAmount 35,200 USDC, collateral 20 ETH, liquidationThreshold 8000.
3. Borrower requests loan, lender fills it.
4. Drop ETH oracle to $1599.95 so collateral = $31,999.
5. Call `_isLoanLiquidatable(0)`; returns true because 32,000 > 31,999*0.8, though debt is 35,200.
6. Liquidation proceeds, lender loses 3,200 interest + 1% liquidator bonus + 0.2% protocol fee (~3,583 USDC).
**How found:** Code review of the liquidation value computation spotted assetAmount used where repaymentAmount (principal + interest) is the true debt, then quantified the shortfall with a Hardhat PoC.
**Exploitation:** No attacker action needed; whenever collateral value dips just below principal, liquidation fires while debt (principal+interest) exceeds collateral, and liquidator bonus/protocol fee are deducted from collateral, systematically shorting lenders.
**Insight:** In P2P lending contracts, audit every place debt is valued: liquidation thresholds, health factors, and LTV checks must use total repayment (principal + accrued interest), not the stored principal; grep for assetAmount vs repaymentAmount usage.
