Skip to content
THREATWIRE

DeFi Security · Vulnerability class

Accounting and share-price errors

Internal records of who owns what drift apart from the real token balance or from each other, so someone can redeem more than they put in.

The concept

Pooled vaults, ledgers and vesting contracts depend on invariants such as total shares equal the sum of positions. Direct token transfers, failed callbacks and stale counters can break them.

Defensive lessons

  • Write the invariant down and test it in every call order.
  • Update every record in the same place a quantity changes.
  • Treat direct token transfers as inputs.
  • Compare internal balances with real holdings, and pause automatically if they diverge.

Stored incidents