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…

Undated•Ethereum•untagged•3 min read

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

evm-hack-analyzer

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.

Loading fork state…

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-registry mirror.


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#

FieldValue
Loss10 ether of the next depositor's underlying
ProtocolBonzo Finance AToken
Bug classFirst-deposit share inflation
SourceAuditVault finding
ReportHalborn, Bonzo Finance Contracts
Chain / block / dateEthereum model · block 0 · 1970-01
Compilersolc 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#

SOLIDITY
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#

  • deposit is 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#

  1. Deposit 1 wei into an empty pool and receive 1 share.
  2. Donate 10 ether so the pool balance moves without a mint.
  3. Victim deposits 10 ether. Shares compute to 0.
  4. The 10 ether is still transferred in.
  5. Burn the 1 share. It redeems the entire pool.
  6. The profit above seed plus donation is the victim's 10 ether.

Diagrams#

flowchart TD A["Deposit 1 wei, receive 1 share"] --> B["Donate 10 ether into the pool"] B --> C["VULN: victim deposit mints 0 shares"] C --> D["10 ether is pulled anyway"] D --> E["1 share withdraws the victim's 10 ether"]

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#

BASH
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

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

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.