Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Invalid

Parameter Order Mismatch in _repay() function

Vulnerability Details

The repayment process contains a critical mismatch between the DebtToken::burn() function return values and their handling in the LendingPool::_repay(). The return tuple order is inverted between scaled/unscaled amounts, leading to:

  1. Incorrect Asset Transfers

    Scaled amount (protocol's internal accounting units) used instead of actual asset amount

  2. Wrong Debt Balance Updates

    Scaled values treated as raw amounts, permanently corrupting user positions

  3. Protocol Insolvency Risk

    Mismatch between actual assets and accounting records

_repay()

Impact

  1. Permanent loss of repaid funds

  2. Users unable to reduce actual debt

  3. Protocol accounting becomes unreliable

  4. Liquidation mechanisms break completely

  5. Protocol insolvency within hours of exploitation

Proof of Concept

DebtToken::burn() Return Values :

// Returns: (amountBurned, newTotalSupply, scaledAmount, balanceIncrease)
return (amount, totalSupply(), amountScaled, balanceIncrease);

LendingPool::_repay() Incorrect Assignment :

// Expects: (amountBurned, newTotalSupply, amountScaled, balanceIncrease)
(uint256 amountScaled, uint256 newTotalSupply, uint256 amountBurned, uint256 balanceIncrease) = burn(...)

Example Scenario

  1. User repays 100 crvUSD (raw amount)2. Scaled amount = 100 / 1.1e27 = ~90.9e-273. DebtToken returns:

  • BurnedAmount = 100

  • scaledAmount = 90.9e-27

  1. LendingPool incorrectly:

  • Transfers 100 crvUSD (should transfer 90.9e-27)

  • Records debt reduction as 90.9e-27 (should reduce by 100)

Result:

  • Protocol loses 99.999...% of repaid amount

  • User debt remains nearly unchanged

  • Total supply becomes inconsistent

Recommendations

Fix Return Value Handling

// correct order
(uint256 amountBurned, uint256 newTotalSupply, uint256 amountScaled, uint256 balanceIncrease) = burn(...)
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

DebtToken::burn calculates balanceIncrease (interest) but never applies it, allowing borrowers to repay loans without paying accrued interest

Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

DebtToken::burn calculates balanceIncrease (interest) but never applies it, allowing borrowers to repay loans without paying accrued interest

Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!