Reproduced Exploit

Regnum Aurum: DebtToken.burn reverts a 50 interest payment and forces the full 100

burn computes amount - scaledBalanceIncrease before the branch that should accept a payment smaller than accrued interest. With 100 interest outstanding, a 50 payment underflows and reverts. Paying exactly 100 clears the interest. The fixed burn accepts 50 and leaves 50 of interest.

May 2025•Ethereum•arithmetic•3 min read

Loss

A 50-token interest payment reverts. The borrower must pay the full 100 accrued interest

Chain

Ethereum

Category

arithmetic

Date

May 2025

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 66174-h-12-underflow-forces-full-interest-payment-in-debt-token-pa. Standalone Foundry PoC and full write-up: 66174-h-12-underflow-forces-full-interest-payment-in-debt-token-pa_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/arithmetic/underflow · vuln/dos/griefing

Key info#

FieldValue
LossA 50-token interest payment reverts. The borrower must pay the full 100 accrued interest
Vulnerable contractDebtToken.burn
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2025-05
Compilersolc 0.8.27, cancun, via IR
Bug classUnchecked subtraction of accrued interest

TL;DR#

burn computes amount - scaledBalanceIncrease before the branch that should accept a payment smaller than accrued interest. With 100 interest outstanding, a 50 payment underflows and reverts. Paying exactly 100 clears the interest. The fixed burn accepts 50 and leaves 50 of interest.

The vulnerable code#

SOLIDITY
require(asset.transferFrom(msg.sender, address(this), amount), "pay");
// @> VULN: amount - accrued interest underflows when the payment is partial
uint256 amountAfterPaidInterest = amount - scaledBalanceIncrease;

The following else path, which would set scaledBalanceIncrease = scaledBalanceIncrease - amount, is unreachable whenever amount is smaller than the interest.

Root cause#

Solidity 0.8 reverts on the subtraction. The partial-interest branch is dead code.

Preconditions#

  • Principal is 1000. Accrued interest (scaledBalanceIncrease) is 100.
  • The caller tries to burn 50, which is less than the accrued interest.

Attack walkthrough#

  1. Approve 100 and call burn(50). The call reverts. Interest stays 100.
  2. Call burn(100). 100 - 100 is zero, so the remainder branch clears the interest.
  3. The debt token holds 100. Principal is still 1000.

Diagrams#

flowchart TD A["Principal 1000 and accrued interest 100"] --> B["Borrower calls burn with 50"] B --> C["VULN subtracts 100 from 50 and reverts"] C --> D["Interest is still 100"] D --> E["burn of 100 clears the interest"] E --> F["Borrower paid 100. The fixed burn would have taken 50"]

Impact#

The borrower cannot pay interest down partially. Clearing the 100 interest costs 100 tokens in one call. A checked branch takes 50 and leaves scaledBalanceIncrease at 50.

Remediation#

Compare amount with scaledBalanceIncrease before subtracting. If the payment is smaller, reduce the interest and burn no principal.

How to reproduce#

BASH
cd 66174-h-12-underflow-forces-full-interest-payment-in-debt-token-pa_exp
forge test -vv

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.