defirisk.co
rubric v1.7.0

ERC-4626 virtual-share offset (OZ ≥4.9)

A economic risk factor in the v1.7.0 rubric. Measured per protocol on a s cadence.

Methodology how we score#

What this measures
This factor evaluates whether ERC-4626 vaults in the protocol use OpenZeppelin version 4.9 or later, which introduced virtual shares and virtual assets to prevent first-depositor share inflation attacks. The check is performed via source inspection against the deployed bytecode. For non-ERC-4626 protocols, this factor is N/A. For ERC-4626 vaults using OZ below version 4.9, the factor triggers a review of whether an alternative inflation mitigation (such as a dead-shares burn on deployment) is present.

Why it matters
The ERC-4626 first-depositor inflation attack is a variant of the empty-cToken problem (RD-F-070) applied to yield-bearing vaults. When a vault has zero total supply, an attacker can donate assets directly to the vault contract before the first legitimate depositor, inflating the share price and causing the legitimate depositor's shares to be worth near-zero. OpenZeppelin 4.9 introduced virtual shares (a small constant added to both total supply and total assets) to make this attack economically non-viable. The bEarn exploit ($18M, 2021) demonstrated a related cross-token accounting vulnerability in a multi-layer vault architecture, illustrating the broader class of first-depositor attacks on vault share accounting.

Green / Yellow / Red
Green: all ERC-4626 vaults use OZ version 4.9 or later, or implement an equivalent virtual-share offset that prevents inflation attacks. Yellow: some vaults use earlier OZ versions but implement a dead-shares burn or equivalent mitigation; or all vaults use earlier versions with curator-verified compensating controls. Red: one or more live ERC-4626 vaults use OZ below version 4.9 with no virtual-share offset or dead-shares mitigation.

Common gray cases
Non-standard ERC-4626 implementations that do not use OpenZeppelin may have equivalent protections implemented differently; curator must verify the economic properties of the share accounting rather than the specific library version.

Notable historical examples
- bEarnFi ($18M, 2021): Multi-layer vault with cross-token accounting vulnerability; related share-inflation class.

Measurement what to look for#

Determine whether ERC-4626 vaults use OpenZeppelin ≥4.9 virtual-share offset pattern to prevent first-depositor share-inflation.

Data & output #

Data source
Source inspection for `_convertToShares` implementation + OpenZeppelin version in `package.json` on Etherscan-verified source
Output format
Green / Yellow / Red
Evidence artifact
Source excerpt of share calculation + OZ version string
Confidence signal
green = OZ ≥4.9 virtual offset or equivalent mitigation present; yellow = non-OZ custom mitigation; red = no virtual offset and no first-depositor protection; gray = protocol is not an ERC-4626 vault (N/A) or source unverified

Scored protocols 0 carry this factor#

No protocols have been scored for this factor yet.

Linked hacks 3 historical incidents#

relatedCurve LlamaLend: Empty-market donation attack on a freshly-listed lending market2026-03-02 · $240K · Empty-market donation attack on a freshly-listed lending market · _decimalsOffset() returning 0 + no virtual deposit; same ERC-4626 first-depositor config error as Venus
relatedVenus Protocol (zkSync Era deployment): Empty-market donation attack on a freshly-deployed market with no virtual liquidity / no `_decimalsOffset()` first-depositor protection2025-03-29 · $902K · Empty-market donation attack on a freshly-deployed market with no virtual liquidity / no `_decimalsOffset()` first-depositor protection · _decimalsOffset() returning 0 + no virtual deposit is the textbook ERC-4626 first-depositor configuration error
relatedbEarnFi (BvaultsBank): Logic bug — token denomination mismatch between vault and strategy layers2021-05-16 · $18M · Logic bug — token denomination mismatch between vault and strategy layers · ERC-4626 virtual-share offset [via cross-hack: Factor 11: Multi-Layer Vault/Strategy Architecture With Cross-Token Accounting]
rubric_version v1.7.0factor RD-F-074category 4carried 0critical no