Reproduced Exploit
Tapioca DAO — BalancerStrategy _withdraw scales WETH as BPT
1. _withdraw converts desired WETH → BPT-like figure via getRate. 2. _vaultWithdraw encodes type-2 exact-tokens-out with that figure as minAmountsOut. 3. Vault pays only the scaled amount → require balance fails → withdraw DoS.
Chain
Other
Category
untagged
Date
Jul 2023
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: 27530-h-40-balancerstrategysol-withdraw-withdraws-insufficient-to. Standalone Foundry PoC and full write-up: 27530-h-40-balancerstrategysol-withdraw-withdraws-insufficient-to_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/wrong-condition · vuln/direct-drain · vuln/fot-slippage
Reproduction: self-contained Foundry PoC with only
forge-std— no fork, no RPC. Full trace: output.txt. PoC: test/27530-h-40-balancerstrategysol-withdraw-withdraws-insufficient-to.sol.
Key info#
| Impact | HIGH — full WETH withdraw reverts after under-exiting the Balancer pool (BalancerStrategy: not enough) |
| Protocol | Tapioca DAO |
| Vulnerable code | BalancerStrategy._withdraw scales amount by pricePerShare then uses it as type-2 exact tokens out |
| Bug class | Unit mismatch / wrong exit kind argument |
| Finding | Code4rena — Tapioca, 2023-07 · #27530 · reporter carrotsmuggler |
| Report | code4rena.com/reports/2023-07-tapioca |
| Source | AuditVault |
| Status | Confirmed (dup #51) |
| Compiler | ^0.8.24 (PoC) |
TL;DR#
_withdrawconverts desired WETH → BPT-like figure viagetRate._vaultWithdrawencodes type-2 exact-tokens-out with that figure as minAmountsOut.- Vault pays only the scaled amount → require balance fails → withdraw DoS.
The vulnerable code#
uint256 toWithdraw = (((amount - queued) * (10 ** decimals)) / pricePerShare);
// @> VULN: scaled value used as exact WETH out
_vaultWithdraw(toWithdraw);
Fix: pass unscaled WETH amount for exact-tokens-out, or convert correctly for exact-BPT-in.
Root cause#
Type-2 Balancer exits withdraw exactly minAmountsOut, not “at least this much after BPT math.” Scaling by pricePerShare underpays WETH.
Attack walkthrough#
- Strategy holds ample BPT, rate = 2e18.
- User requests 1000 WETH withdraw.
- Vault exits only 500 WETH →
not enoughrevert; BPT remains stuck for full exit.
Diagrams#
Impact#
Withdrawal liveness failure for Balancer strategy deposits — funds effectively frozen for full-size exits when idle buffer is insufficient.
Taxonomy#
- genome: wrong-condition, direct-drain, access-roles, fot-slippage
- sector: dex, governance, liquid-staking, vault
- severity: high
- platform: code4rena
Sources#
- AuditVault finding #27530
- Code4rena report 2023-07-tapioca
- Reduced from Tapioca BalancerStrategy._withdraw / _vaultWithdraw
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 27530-h-40-balancerstrategysol-withdraw-withdraws-insufficient-to_exp (evm-hack-registry mirror).
- AuditVault finding: 27530-h-40-balancerstrategysol-withdraw-withdraws-insufficient-to.
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.