Reproduced Exploit
DYAD H-01: base XP accrual uses 1e7 and pays 1/100 of the documented rate
DyadXPv2._computeXP builds adjustedAccrualRate as accrualRateModifier * 1e7. The review says the documented base scale is 1e9. A note whose totalXP is still 0 keeps the base modifier 1e18, so the product is 1e25 instead of 1e27. On 1 kerosene and a 1-second window the note is minted 10,000,000 XP.…
Loss
10,000,000 XP credited instead of 1,000,000,000. The depositor is paid 1/100 of the documented base accrual o…
Chain
Ethereum
Category
arithmetic
Date
Oct 2024
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
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.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 41688-h-01-users-will-get-1100-of-the-intended-accrual-rate-pashov. Standalone Foundry PoC and full write-up: 41688-h-01-users-will-get-1100-of-the-intended-accrual-rate-pashov_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/arithmetic/scaling · vuln/logic/reward-calculation
Key info#
| Field | Value |
|---|---|
| Loss | 10,000,000 XP credited instead of 1,000,000,000. The depositor is paid 1/100 of the documented base accrual on 1 kerosene for the 1-second window |
| Vulnerable contract | DyadXPv2._computeXP |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit at 0x15452ec016c4dc8c549e7fe6ff4b26324ea8b7a4 |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2024-10 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | accrual scale constant is 1e7 instead of the documented 1e9 |
TL;DR#
DyadXPv2._computeXP builds adjustedAccrualRate as accrualRateModifier * 1e7. The review says the documented base scale is 1e9. A note whose totalXP is still 0 keeps the base modifier 1e18, so the product is 1e25 instead of 1e27. On 1 kerosene and a 1-second window the note is minted 10,000,000 XP. The same formula with 1e9 mints 1,000,000,000 XP.
The vulnerable code#
uint256 accrualRateModifier = 1e18;
if (totalXP > 0) {
revert("base-rate note");
}
// @> VULN: documented base accrual scale is 1e9; 1e7 pays 1/100 of that XP
uint256 adjustedAccrualRate = accrualRateModifier * 1e7;
uint256 bonus = deposited;
if (dyadMinted + deposited != 0) {
uint256 ratio = divWadDown(dyadMinted, dyadMinted + deposited);
bonus += mulWadDown(deposited, ratio);
}
return lastUpdate.lastXP + (elapsed * adjustedAccrualRate * bonus) / 1e18;
With dyadMinted == 0 the wad ratio is 0 and bonus stays equal to the kerosene deposit. The only difference between the two credits is the scale constant.
Root cause#
The base accrual constant is two orders of magnitude below the value the documentation specifies. Every later XP read, including staking rewards that multiply by balanceOfNote, inherits that 1/100 credit.
Preconditions#
- The note has deposited 1 kerosene and has minted no DYAD, so the bonus equals the deposit.
totalXPis 0, which selects the base modifier1e18rather than1e18 / log10(totalXP).- The model clock is timestamp 1 and
lastActionis 0, soelapsedis 1. Any longer window scales both credits by the same factor and keeps the 100x gap.
Attack walkthrough#
- The note holder calls
accrue. No privileged role is required. - Elapsed time is
block.timestamp - lastAction= 1. - The modifier stays
1e18. adjustedAccrualRateis1e18 * 1e7.- The formula returns
1e25XP and mints that amount. - The fixed scale
1e9returns1e27XP for the same deposit and window.
Diagrams#
Impact#
The depositor's XP balance is 10,000,000 instead of 1,000,000,000. That is the yield the note is paid for this window. Rewards that multiply by the note's XP pay 1/100 of the documented amount.
Remediation#
Use the documented base scale:
- uint256 adjustedAccrualRate = accrualRateModifier * 1e7;
+ uint256 adjustedAccrualRate = accrualRateModifier * 1e9;
How to reproduce#
cd 41688-h-01-users-will-get-1100-of-the-intended-accrual-rate-pashov_exp
forge test -vv
test_baseAccrualPaysOneHundredth asserts 10,000,000 XP. test_control_scale1e9_doesNotHitTheBuggyCredit asserts 1,000,000,000 XP and that the fair credit is not the buggy number.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/41688-h-01-users-will-get-1100-of-the-intended-accrual-rate-pashov.md
- Pashov DYAD review, H-01: https://github.com/pashov/audits/blob/master/team/md/Dyad-security-review.md
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 41688-h-01-users-will-get-1100-of-the-intended-accrual-rate-pashov_exp (evm-hack-registry mirror).
- AuditVault finding: 41688-h-01-users-will-get-1100-of-the-intended-accrual-rate-pashov.
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.