Reproduced Exploit
Regnum Aurum: harvest books 0.1 yield on a 0.095 share position and takes 0.005 of principal
_harvestYield multiplies totalDeposits by the share-price increase. totalDeposits stores the 1e18 assets deposited, not the 0.95e18 shares received. A 0.1e18 price increase books 0.1e18 of yield. The shares earned 0.095e18. The extra 0.005e18 is depositor principal withdrawn to the lending pool.
Loss
The lending pool receives 0.1 asset. Fair yield is 0.095. Vault principal falls from 0.95 to 0.945
Chain
Ethereum
Category
logic
Date
Jun 2025
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
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.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 66503-h-02-harvestyield-incorrectly-uses-total-deposits-when-calc. Standalone Foundry PoC and full write-up: 66503-h-02-harvestyield-incorrectly-uses-total-deposits-when-calc_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/logic/reward-calculation·vuln/logic/state-update
Key info#
| Field | Value |
|---|---|
| Loss | The lending pool receives 0.1 asset. Fair yield is 0.095. Vault principal falls from 0.95 to 0.945 |
| Vulnerable contract | VaultYield.harvest |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2025-06 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | Yield is priced on assets deposited instead of shares minted |
TL;DR#
_harvestYield multiplies totalDeposits by the share-price increase. totalDeposits stores the 1e18 assets deposited, not the 0.95e18 shares received. A 0.1e18 price increase books 0.1e18 of yield. The shares earned 0.095e18. The extra 0.005e18 is depositor principal withdrawn to the lending pool.
The vulnerable code#
uint256 priceDifference = currentSharePrice - lastSharePrice;
// @> VULN: totalDeposits is assets deposited, not the shares that earn the price
uint256 totalYield = (totalDeposits * priceDifference) / 1e18;
The finding's numbers: 1e18 * 0.1e18 / 1e18 = 0.1e18, against 0.95e18 * 0.1e18 / 1e18 = 0.095e18.
Root cause#
The deposit path records assets in totalDeposits and mints fewer shares. Harvest then treats that asset figure as if it were the share balance.
Preconditions#
- 1 asset deposited, 0.95 shares minted,
lastSharePricerecorded as 1. - Vault assets later stand at 1.045, so the share price is 1.1.
Attack walkthrough#
- Read the share price. It is 1.1, so the difference from the recorded price is 0.1.
- Harvest books
1 * 0.1 = 0.1and transfers 0.1 to the lending pool. - Vault assets fall to 0.945. Principal at the old price was 0.95.
- The control stores 0.95 in
totalDeposits, books 0.095, and leaves 0.95 in the vault.
Diagrams#
Impact#
Depositors' principal is 0.005 asset smaller, and unclaimedRewards is overstated by that amount. The lending pool's reserve is the account that received the extra withdrawal.
Remediation#
Store the minted shares in totalDeposits, which is what the finding recommends. Yield is then shares * priceDifference / 1e18.
How to reproduce#
cd 66503-h-02-harvestyield-incorrectly-uses-total-deposits-when-calc_exp
forge test -vv
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/66503-h-02-harvestyield-incorrectly-uses-total-deposits-when-calc.md
- Pashov review: https://github.com/pashov/audits/blob/master/team/md/RegnumAurum-security-review_2025-06-26.md
- Reduced source:
test/66503-h-02-harvestyield-incorrectly-uses-total-deposits-when-calc.sol
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 66503-h-02-harvestyield-incorrectly-uses-total-deposits-when-calc_exp (evm-hack-registry mirror).
- AuditVault finding: 66503-h-02-harvestyield-incorrectly-uses-total-deposits-when-calc.
Alerts & third-party analyses
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.