Reproduced Exploit
Buck Labs: Stale totalExcludedSupply (1
Chain
Other
Category
untagged
Date
Jan 1970
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: 64666-totalexcludedsupply-drifts-from-reality-spearbit-none-buck-l. The historical source/toolchain is unavailable; this entry is documentation only and claims no executable Forge PoC.
Vulnerability classes: vuln/locked-funds · vuln/reward-accounting
Reproduction: a faithful minimal reproduction of the vulnerable finding — the vulnerable function is reproduced verbatim (marked
@>) with faithful minimal doubles; local deploy, no fork.
Root cause#
Stale totalExcludedSupply (1,000,000e18) exceeds the shrunken totalSupply (100,000e18) after an excluded whale's tokens are burned through the hook, so configureEpoch()'s totalSupply()-totalExcludedSupply underflows and reverts permanently, freezing the 50,000e18 reward-USDC pool (rewards distribution can never be configured).
function _handleOutflow(address from, uint256 amount) internal {
AccountState storage s = accounts[from];
s.balance -= amount; // @> BUG: excluded-account outflow never decrements totalExcludedSupply -> drift, then underflow DoS
}
Why it's exploitable here#
Stale totalExcludedSupply (1,000,000e18) exceeds the shrunken totalSupply (100,000e18) after an excluded whale's tokens are burned through the hook, so configureEpoch()'s totalSupply()-totalExcludedSupply underflows and reverts permanently, freezing the 50,000e18 reward-USDC pool (rewards distribution can never be configured).
Attack path#
Marked-line walkthrough (Playground)#
The EVM Playground pins each step to the exact executed source line in 0x671d353a77…:
- L160 — Gate outflow hook to real holders: Setup: only runs the outflow bookkeeping for genuine holders, skipping mints (
from==0) and the token's own transfers. - L168 — Outflow hook on burn or transfer: The per-holder bookkeeping hook that fires whenever
fromsends or burns tokens, meant to keep the reward accounting in sync. - L170 — Cut balance, not excluded supply: Reduces the excluded holder's balance on burn but never decrements
totalExcludedSupply, leaving that aggregate stale abovetotalSupply. - L179 — Configure epoch reward distribution: Later computes
totalSupply() - totalExcludedSupply; once the stale excluded figure exceeds real supply this underflows and reverts forever. - L190 — Fixed rewards engine variant: Setup: the corrected
RewardsEngineFixedcontract used for comparison, which keeps excluded supply in sync on outflow. - L197 — Per-account state mapping: Setup: stores each account's balance and exclusion flag used by the reward bookkeeping.
- L202 — Token-only access modifier: Setup: restricts the outflow hook so only the token contract may invoke it.
PoC#
Registry (Foundry, local deploy — verbatim vulnerable source + harm-asserting test + negative control):
cd 64666-totalexcludedsupply-drifts-from-reality-spearbit-none-buck-l_exp
forge test -vvv
The browser Playground replays the same synthetic opcode-for-opcode and measures the harm: Stale totalExcludedSupply (1,000,000e18) exceeds the shrunken totalSupply (100,000e18) after an excluded whale's tokens are burned through t. Both gates are green (registry forge test PASS + Playground _verify-poc VERDICT: PASS).
Sources & further analysis#
Reproductions & code
- No executable Forge reproduction is claimed; the historical source/toolchain was unavailable for this finding.
- AuditVault finding: 64666-totalexcludedsupply-drifts-from-reality-spearbit-none-buck-l.
- Upstream DeFiHackLabs PoC directory: src/test.
Alerts & third-party analyses
- DeFiHackLabs incident explorer: [search "Buck Labs: Stale totalExcludedSupply (1"](https://defihacklabs.io/explorer/index.html?q=Buck%20Labs%3A%20Stale%20totalExcludedSupply%20(1).
- Web3Sec X hacked database: search.
- Rekt leaderboard: [search](https://rekt.news/?s=Buck%20Labs%3A%20Stale%20totalExcludedSupply%20(1).
- Solodit incident search: [search](https://solodit.xyz/issues?search=Buck%20Labs%3A%20Stale%20totalExcludedSupply%20(1).
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.