Reproduced Exploit
Bonzo AToken: a 1 wei share takes the next 10 ether deposit
The AToken mint is shares = amount * supply / pool with no zero-share check and no initial dead shares. The attacker deposits 1 wei, donates 10 ether, and the victim's 10 ether deposit rounds to 0 shares. Withdrawing the 1 wei share pays the whole pool. Profit is the victim's 10 ether. The control…
Loss
10 ether of the next depositor's underlying
Chain
Ethereum
Category
untagged
Date
Undated
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: 51950-price-inflation-in-atoken-halborn-bonzo-finance-contracts-ma. Standalone Foundry PoC and full write-up: 51950-price-inflation-in-atoken-halborn-bonzo-finance-contracts-ma_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/arithmetic · vuln/defi
Reproduction: a self-contained Foundry PoC that compiles and runs offline with only
forge-std- no fork and no RPC. PoC: test/51950-price-inflation-in-atoken-halborn-bonzo-finance-contracts-ma_exp.sol.
Key info#
| Field | Value |
|---|---|
| Loss | 10 ether of the next depositor's underlying |
| Protocol | Bonzo Finance AToken |
| Bug class | First-deposit share inflation |
| Source | AuditVault finding |
| Report | Halborn, Bonzo Finance Contracts |
| Chain / block / date | Ethereum model · block 0 · 1970-01 |
| Compiler | solc 0.8.27, cancun, via IR |
TL;DR#
The AToken mint is shares = amount * supply / pool with no zero-share check and no initial dead shares. The attacker deposits 1 wei, donates 10 ether, and the victim's 10 ether deposit rounds to 0 shares. Withdrawing the 1 wei share pays the whole pool. Profit is the victim's 10 ether. The control reverts on a 0-share mint and the victim keeps the 10 ether.
The vulnerable code#
if (supply == 0) {
shares = amount;
} else {
// @> VULN: rounds to 0 when pool has been donated above the victim's deposit
shares = amount * supply / pool;
}
underlying.transferFrom(msg.sender, address(this), amount);
Root cause#
Share price is pool / supply. One share against a donated pool prices the next deposit below 1 share, and the division rounds down. The underlying is still transferred. Halborn's note is this first-deposit inflation of the AToken index / share balance, and the fix they give is require(_shares != 0) plus a dead initial mint.
Preconditions#
depositis permissionless. The pool has not been seeded with dead shares.- Attacker deposits 1 wei and then transfers 10 ether straight to the AToken.
- Victim deposits 10 ether.
Attack walkthrough#
- Deposit 1 wei into an empty pool and receive 1 share.
- Donate 10 ether so the pool balance moves without a mint.
- Victim deposits 10 ether. Shares compute to 0.
- The 10 ether is still transferred in.
- Burn the 1 share. It redeems the entire pool.
- The profit above seed plus donation is the victim's 10 ether.
Diagrams#
Impact#
The victim loses all 10 ether. The attacker net profit is 10 ether. With require(shares != 0) the victim's deposit reverts and their balance stays 10 ether.
Remediation#
Reject a mint of 0 shares, and seed the pool with dead shares (the note's 1,000-share initial mint to the zero address) so a donation cannot move the price that far.
How to reproduce#
cd 51950-price-inflation-in-atoken-halborn-bonzo-finance-contracts-ma_exp
forge test -vv
run() is the harm path. The control test uses the corrected comparison or guard and does not produce the loss number.
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 51950-price-inflation-in-atoken-halborn-bonzo-finance-contracts-ma_exp (evm-hack-registry mirror).
- AuditVault finding: 51950-price-inflation-in-atoken-halborn-bonzo-finance-contracts-ma.
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.