Core Contracts

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

Wrong accounting during the burning of the Debt tokens.

Summary

Whenever a user repays their debt, the corresponding debt tokens are burned. However, there is incorrect accounting during the burning process, leading to discrepancies in total supply calculations. This miscalculation could result in future protocol failures.

Vulnerability Details

  • In the DebtToken::burn() function, the contract first calculates the scaled balance:

    uint256 userBalance = balanceOf(from);

    The balance is determined as (balance * reserve.usageIndex) / 1e27.

  • If amount > userBalance, the function caps amount to userBalance before proceeding:

    if(amount > userBalance){
    amount = userBalance;
    }
  • The scaled amount is then computed and used for burning:

    uint256 amountScaled = amount.rayDiv(index);
    if (amountScaled == 0) revert InvalidAmount();
    _burn(from, amount.toUint128());
  • The issue arises because balanceOf() considers the balanceIncrease amount, which represents accrued interest or changes in debt due to index adjustments. However, these additional balanceIncrease tokens are never explicitly minted. The contract then attempts to burn tokens that were never created, leading to incorrect supply calculations.

Impact

  • The protocol's total supply tracking becomes inconsistent, as it burns tokens that do not exist on-chain.

  • Future functionalities relying on accurate debt token supply (e.g., interest rate calculations, liquidation mechanics) may break.

  • Users could face unexpected accounting issues, affecting borrowing and repayment mechanisms.

Tools Used

  • Manual code review

Recommendations

  • First Mint those balanceIncrease amount of tokens then burn total amount of tokens

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 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 4 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.