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.

Jul 2023Otheruntagged2 min read

Chain

Other

Category

untagged

Date

Jul 2023

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

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.

Loading fork state…

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


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#

ImpactHIGH — deposit while rewards pending mints inflated shares; harvest then withdraw steals pro-rata rewards
ProtocolTapioca DAO
Vulnerable codeGlpStrategy._currentBalance — free GLP only
Bug classIncomplete NAV / reward accounting
FindingCode4rena — Tapioca, 2023-07 · #27533 · reporter cergyk
Reportcode4rena.com/reports/2023-07-tapioca
SourceAuditVault
StatusConfirmed by Tapioca
Compiler^0.8.24 (PoC)

TL;DR#

  1. YieldBox prices shares from strategy.currentBalance().
  2. _currentBalance omits unclaimed rewards.
  3. Deposit → harvest → withdraw extracts older depositors' rewards.

The vulnerable code#

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

  1. Victim deposits 1000 GLP (all free balance).
  2. 1000 GLP-equivalent rewards accrue off-balance.
  3. Attacker deposits 1000 → gets 1000 shares (1:1 vs free only).
  4. Harvest; attacker withdraws → +500 profit (half of pending).

Diagrams#

sequenceDiagram participant Victim participant YB as YieldBox participant Strat as GlpStrategy participant Attacker Victim->>YB: deposit 1000 Note over Strat: pending rewards 1000 not in currentBalance Attacker->>YB: deposit 1000 gets equal shares Attacker->>Strat: harvest Attacker->>YB: withdraw all shares Note over Attacker: +500 from victim rewards

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#


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.