Reproduced Exploit

Regnum DebtToken applies the borrow index twice and reports 400 instead of 300

The published example borrows 100 while usageIndex is 1, so the raw total is 100 and totalSupply reads 100. The index grows to 2 and that raw total reads 200, which is the grown debt. A second borrow of 100 is added straight onto the raw total. totalSupply multiplies the raw total by the index agai…

Jun 2025•Ethereum•arithmetic•2 min read

Loss

totalSupply reports 400 of debt. Scaled principal at the same index is 300. The extra debt is 100

Chain

Ethereum

Category

arithmetic

Date

Jun 2025

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack replays in your browser. Step through it by Solidity line or by opcode.

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: 66500-c-03-incorrect-debttoken-scaling-inflates-totals-miscalculat. Standalone Foundry PoC and full write-up: 66500-c-03-incorrect-debttoken-scaling-inflates-totals-miscalculat_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/arithmetic/index-scaling · vuln/defi/debt-accounting

Key info#

FieldValue
LosstotalSupply reports 400 of debt. Scaled principal at the same index is 300. The extra debt is 100
Vulnerable contractDebtToken.totalSupply
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit at 0x15452ec016c4dc8c549e7fe6ff4b26324ea8b7a4
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2025-06
Compilersolc 0.8.27, cancun, via IR
Bug classA new borrow is added to the raw total and the raw total is then multiplied by the index
flowchart TD A["Borrow 100 at index 1, then the index becomes 2"] --> B["Borrow another 100 and add it raw"] B --> C["VULN totalSupply multiplies raw 200 by index 2"] C --> D["The reported debt is 400"] B --> E["Control divides the new 100 by the index before adding it"] E --> F["The reported debt is 300"]

TL;DR#

The published example borrows 100 while usageIndex is 1, so the raw total is 100 and totalSupply reads 100. The index grows to 2 and that raw total reads 200, which is the grown debt. A second borrow of 100 is added straight onto the raw total. totalSupply multiplies the raw total by the index again: 200 * 2 = 400.

Scaled accounting divides the new borrow by the current index first. The second 100 is 50 of principal. Scaled total 150 times index 2 is 300. The quoted path overstates the debt by 100.

The vulnerable code#

SOLIDITY
function borrow(uint256 amount) external {
    raw += amount;
}

function totalSupply() public returns (uint256 supply) {
    supply = raw * idx / 1 ether; // @> VULN: the new 100 is multiplied by the index that already scaled the old debt
}

Impact#

Utilization and the rates that read total debt see 400 where the scaled debt is 300. The second borrow of 100 is counted as 200 the moment it is opened.

How to reproduce#

BASH
cd 66500-c-03-incorrect-debttoken-scaling-inflates-totals-miscalculat_exp
forge test -vv

test_exploit_second_borrow_is_doubled asserts totalSupply is 400. test_control_scales_the_second_borrow asserts 300.

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.