Reproduced Exploit
Bonzo: withdrawing WHBAR to another address pays 100 ether twice
withdraw burns the caller's aToken and sends that underlying WHBAR to to. When the asset is WHBAR it then also unwraps amount from msg.sender's wallet and sends the HBAR to to. A 100 ether withdrawal to a different address delivers 100 WHBAR and 100 HBAR. The caller loses the extra 100 WHBAR. The f…
Loss
100 ether of the caller's wallet WHBAR, on top of the 100 ether aToken burn
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: 51947-incorrect-asset-handling-during-withdraw-halborn-bonzo-finan. Standalone Foundry PoC and full write-up: 51947-incorrect-asset-handling-during-withdraw-halborn-bonzo-finan_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/logic · vuln/defi
Reproduction: a self-contained Foundry PoC that compiles and runs offline with only
forge-std- no fork and no RPC. PoC: test/51947-incorrect-asset-handling-during-withdraw-halborn-bonzo-finan_exp.sol.
Key info#
| Field | Value |
|---|---|
| Loss | 100 ether of the caller's wallet WHBAR, on top of the 100 ether aToken burn |
| Protocol | Bonzo Finance LendingPool |
| Bug class | WHBAR withdraw pays the recipient twice |
| 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#
withdraw burns the caller's aToken and sends that underlying WHBAR to to. When the asset is WHBAR it then also unwraps amount from msg.sender's wallet and sends the HBAR to to. A 100 ether withdrawal to a different address delivers 100 WHBAR and 100 HBAR. The caller loses the extra 100 WHBAR. The fix unwraps once, from the pool's own reserve, and the caller's wallet balance stays 100 ether.
The vulnerable code#
aBalance[msg.sender] -= underlyingOut;
whbar.transfer(to, underlyingOut); // burn already paid `to`
// @> VULN: unwrap pulls a second `amount` from the caller and pays `to` again
whbar.transferFrom(msg.sender, address(this), second);
hbar.transfer(to, second);
Root cause#
The WHBAR branch assumes msg.sender and to are the same account. burn has already forwarded the underlying to to. The following IWHBAR.withdraw pulls a fresh amount from the caller. withdraw is callable by any supplier and to is a free parameter, so the double payment does not need a privileged role.
Preconditions#
- Caller has 100 ether of aWHBAR and 100 ether of wallet WHBAR, and has approved the pool.
- The pool holds 100 WHBAR of reserve and 100 HBAR of unwrap inventory.
tois an address other than the caller. Aave-stylewithdrawallows that.
Attack walkthrough#
- Burn 100 ether of aToken balance.
- Transfer 100 WHBAR of underlying to
to. - Pull another 100 WHBAR from the caller's wallet.
- Send 100 HBAR to the same
to. tonow holds 200 ether of value. The extra 100 is the caller's wallet WHBAR.
Diagrams#
Impact#
The recipient receives 100 WHBAR plus 100 HBAR. The caller loses 100 ether of wallet WHBAR that the withdrawal should not have touched. The control sends only the 100 HBAR and leaves the wallet WHBAR at 100 ether, so the extra 100 WHBAR is not paid.
Remediation#
Burn the underlying to the pool (or keep the reserve), then unwrap once to to. Do not transferFrom the caller's wallet WHBAR.
How to reproduce#
cd 51947-incorrect-asset-handling-during-withdraw-halborn-bonzo-finan_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: 51947-incorrect-asset-handling-during-withdraw-halborn-bonzo-finan_exp (evm-hack-registry mirror).
- AuditVault finding: 51947-incorrect-asset-handling-during-withdraw-halborn-bonzo-finan.
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.