Reproduced Exploit
Tapioca DAO — GlpStrategy currentBalance ignores unclaimed rewards
1. YieldBox prices shares from strategy.currentBalance(). 2. _currentBalance omits unclaimed rewards. 3. Deposit → harvest → withdraw extracts older depositors' rewards.
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: 27533-h-43-accounted-balance-of-glpstrategy-does-not-match-withdra. Standalone Foundry PoC and full write-up: 27533-h-43-accounted-balance-of-glpstrategy-does-not-match-withdra_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/rounding-direction · vuln/reward-theft · vuln/reward-accounting
Reproduction: self-contained Foundry PoC with only
forge-std— no fork, no RPC. Full trace: output.txt. PoC: test/27533-h-43-accounted-balance-of-glpstrategy-does-not-match-withdra.sol.
Key info#
| Impact | HIGH — deposit while rewards pending mints inflated shares; harvest then withdraw steals pro-rata rewards |
| Protocol | Tapioca DAO |
| Vulnerable code | GlpStrategy._currentBalance — free GLP only |
| Bug class | Incomplete NAV / reward accounting |
| Finding | Code4rena — Tapioca, 2023-07 · #27533 · reporter cergyk |
| Report | code4rena.com/reports/2023-07-tapioca |
| Source | AuditVault |
| Status | Confirmed by Tapioca |
| Compiler | ^0.8.24 (PoC) |
TL;DR#
- YieldBox prices shares from
strategy.currentBalance(). _currentBalanceomits unclaimed rewards.- Deposit → harvest → withdraw extracts older depositors' rewards.
The vulnerable code#
function _currentBalance() internal view returns (uint256 amount) {
// @> VULN: ignores pending rewards
amount = IERC20(contractAddress).balanceOf(address(this));
}
Fix: include claimable reward value in currentBalance.
Root cause#
Share mint uses incomplete TVL, so late depositors buy cheap shares against pending yield.
Attack walkthrough#
- Victim deposits 1000 GLP (all free balance).
- 1000 GLP-equivalent rewards accrue off-balance.
- Attacker deposits 1000 → gets 1000 shares (1:1 vs free only).
- Harvest; attacker withdraws → +500 profit (half of pending).
Diagrams#
Impact#
Theft of unclaimed strategy rewards from prior depositors.
Taxonomy#
- genome: rounding-direction, reward-theft, variant, integer-bounds, reward-accounting
- sector: governance
- severity: high
- platform: code4rena
Sources#
- AuditVault finding #27533
- Code4rena report 2023-07-tapioca
- Reduced from GlpStrategy._currentBalance + YieldBox depositAsset share mint
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 27533-h-43-accounted-balance-of-glpstrategy-does-not-match-withdra_exp (evm-hack-registry mirror).
- AuditVault finding: 27533-h-43-accounted-balance-of-glpstrategy-does-not-match-withdra.
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.