Skip to main content

What Happened

Akshay Srivastav’s Compound V2 research explains how a very small initial share supply and a direct donation can raise the exchange rate so that a later deposit rounds down severely, potentially to zero shares. This is a vulnerability pattern, not one incident with a single loss total, and it is not a claim about every lending protocol. Original first-deposit research.

Attack Mechanism

A share-based market with a tiny initial supply can become sensitive to donations. The attacker supplies a minimal amount and receives the initial shares, then transfers assets directly to the market without minting more shares. Assets per share rises sharply. For a simplified pool with one indivisible share:
  1. The attacker deposits one asset unit and receives one share.
  2. A direct donation adds 1,000 asset units, so one share represents 1,001 units.
  3. A victim deposits 100 units. Integer division calculates floor(100 / 1001) = 0 shares.
  4. The attacker still owns the only share and can redeem the pool’s 1,101 units.
Real cTokens apply an exchange-rate scale and have their own decimals. Comparing an unscaled deposit amount directly with an exchange rate is therefore unsafe. The assertion checks the depositor’s actual share-balance increase across each mint(uint256) call instead. Atomic initialization and locked seed liquidity reduce the opportunity to own the entire initial share supply. A minimum total supply alone does not prove that a particular depositor received a fair result.

Assertion Example

What This Check Covers

This deliberately rejects a positive mint that returns without increasing shares, including cToken error-code returns. It catches zero-share outcomes, not every unfair nonzero exchange. Transfer-fee assets, routers that receive shares on another address, minimum-share slippage, empty-pool transitions, and initialization all need their own cases.