Reproduced Exploit

Regnum Aurum: a 1-wei repayOnBehalf forces Alice to owe 1210 instead of 1200

Anyone can call repayOnBehalf. A 1-wei repayment writes all accrued interest into the borrower's raw principal and does not reduce the debt. Alice borrowed 1000 at usage index 1.0. After the index reaches 1.1 the dust call sets her raw balance to 1100. When the index reaches 1.2 she owes 1210. With…

May 2025•Ethereum•logic•3 min read

Loss

Alice pays 1210 RA. The fair debt is 1200 RA. The pool takes 10 RA extra plus the 1 wei

Chain

Ethereum

Category

logic

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: 66183-h-21-users-may-be-forced-to-pay-more-interest-pashov-audit-g. Standalone Foundry PoC and full write-up: 66183-h-21-users-may-be-forced-to-pay-more-interest-pashov-audit-g_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/state-update · vuln/logic/fee-calculation

Key info#

FieldValue
LossAlice pays 1210 RA. The fair debt is 1200 RA. The pool takes 10 RA extra plus the 1 wei
Vulnerable contractLendingPool.repayOnBehalf
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2025-05
Compilersolc 0.8.27, cancun, via IR
Bug classDust repayment capitalizes accrued interest into raw principal

TL;DR#

Anyone can call repayOnBehalf. A 1-wei repayment writes all accrued interest into the borrower's raw principal and does not reduce the debt. Alice borrowed 1000 at usage index 1.0. After the index reaches 1.1 the dust call sets her raw balance to 1100. When the index reaches 1.2 she owes 1210. With no dust repayment the same path bills 1200.

Background#

Pashov Audit Group's May 2025 Regnum Aurum review, H-21. Debt is raw + raw * (usageIndex - positionIndex) / 1e27. The finding's pasted calculateInsuranceFee block does not produce this arithmetic. The synthetic follows the published repayOnBehalf example.

The vulnerable code#

SOLIDITY
uint256 interest = (raw * (usageIndex - positionIndex[user])) / RAY;
// @> VULN: a 1-wei repay writes all accrued interest into raw principal
rawBalance[user] = raw + interest;
positionIndex[user] = usageIndex;

The 1 wei is pulled from the caller and is not subtracted from rawBalance. Debt before the call is 1100. Debt after the call is still 1100, now sitting entirely in principal.

Root cause#

A partial repayment replaces the scaled position with fully capitalized interest. Later index growth is charged on that larger raw balance.

Preconditions#

  • Alice's raw balance is 1000 and her position index is 1e27.
  • The usage index can move to 1.1e27, then to 1.2e27.
  • repayOnBehalf is callable by anyone for 1 wei.

Attack walkthrough#

  1. Accrue the index to 1.1e27. Pending interest is 100.
  2. Repay 1 wei on Alice's behalf. Raw principal becomes 1100. The debt is unchanged.
  3. Accrue the index to 1.2e27. Interest on 1100 is 110, so the debt is 1210.
  4. Alice repays 1210. The fair bill is 1200.

Diagrams#

flowchart TD A["Alice raw principal is 1000 at index 1.0"] --> B["Index moves to 1.1 and pending interest is 100"] B --> C["Attacker calls repayOnBehalf for 1 wei"] C --> D["VULN writes the 100 interest into raw principal"] D --> E["Index moves to 1.2"] E --> F["Alice owes 1210 and the fair debt is 1200"]

Impact#

Alice pays 10 RA more than the unmanipulated debt. The lending pool receives 1210 RA plus the attacker's 1 wei. A minimum repayment, or requiring the borrower's approval, leaves the raw principal at 1000 and the final debt at 1200.

Remediation#

Reject repayments below a minimum, or require the position owner to approve repayOnBehalf. Do not capitalize unpaid interest into raw principal on a dust payment.

How to reproduce#

BASH
cd 66183-h-21-users-may-be-forced-to-pay-more-interest-pashov-audit-g_exp
forge test -vv

test_exploit_dust_repay_forces_1210 asserts the 1210 bill. test_control_without_dust_repay_debt_is_1200 asserts the fair bill. test_control_minimum_repay_rejects_one_wei asserts a minimum-size guard.

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.