Reproduced Exploit
Roots — [H-01] Overwriting collateral breaks collateral gains logic
1. Alice accrues coll-A gains on stability-pool index 0 and leaves them unclaimed. 2. Coll A is sunset; coll C is enabled and reuses index 0. 3. Product sums for index 0 are zeroed; Alice's pending gain mapping is not. 4. Alice claims index 0 and is paid in coll-C tokens for her coll-A leftover, dr…
Chain
Other
Category
untagged
Date
Feb 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. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 55111-h-01-overwriting-collateral-breaks-collateral-gains-logic-pa. Standalone Foundry PoC and full write-up: 55111-h-01-overwriting-collateral-breaks-collateral-gains-logic-pa_exp in the
evm-hack-registrymirror.
Vulnerability classes: integer-bounds · underflow · fix-arithmetic · known-pattern
Reproduction: self-contained Foundry PoC with only
forge-std— no fork. output.txt · test/55111-…_exp.sol.
AuditVault taxonomy: lang/solidity · sector/cdp · severity/high · genome: integer-bounds · underflow · fix-arithmetic
Key info#
| Impact | HIGH — reusing a sunset collateral index pays old gains in the new token; other depositors cannot claim |
| Protocol | Roots — StabilityPool collateral enable / gains |
| Vulnerable code | Overwrite clears epochToScaleToSums but not collateralGainsByDepositor / depositSums |
| Bug class | Incomplete state wipe on index reuse |
| Finding | Pashov Audit Group — Roots security review 2025-02-09 · #55111 |
| Report | Roots-security-review_2025-02-09.md |
| Source | AuditVault |
| Fix | Do not overwrite sunset collaterals; add disable-after-expiry without reusing dirty indices |
| Compiler | ^0.8.24 (PoC) |
TL;DR#
- Alice accrues coll-A gains on stability-pool index 0 and leaves them unclaimed.
- Coll A is sunset; coll C is enabled and reuses index 0.
- Product sums for index 0 are zeroed; Alice's pending gain mapping is not.
- Alice claims index 0 and is paid in coll-C tokens for her coll-A leftover, draining the pool.
- Bob's coll-C claim reverts (
transfer amount exceeds balance).
Vulnerable code#
function _overwriteCollateral(uint256 index, MockCollateral coll) internal {
collateralTokens[index] = coll;
sunsetExpiry[index] = 0;
epochToScaleToSums[index][0][0] = 0; // @> VULN: only product sums cleared
// depositSums[*][index] and collateralGainsByDepositor[*][index] left dirty
}
Fix: never reuse sunset indices, or wipe all per-depositor gain state for the index before reuse.
Diagrams#
Impact#
Depositors of a new collateral can have their gains drained by leftover accounting from a previous collateral on the same index; claims may also DoS via underflow on sums - depSums.
Sources#
- AuditVault #55111
- Pashov Roots 2025-02-09
- Reduced StabilityPool overwrite path from the finding (sunset expiry reduced to immediate for offline PoC)
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 55111-h-01-overwriting-collateral-breaks-collateral-gains-logic-pa_exp (evm-hack-registry mirror).
- AuditVault finding: 55111-h-01-overwriting-collateral-breaks-collateral-gains-logic-pa.
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.