Severity depends on reachable impact and deployment context. Listed tools are review aids; their applicability depends on language, version and configuration.
An ERC-4626 inflation attack manipulates a vault's asset-to-share exchange rate so a later depositor receives too few shares. In the strongest first-deposit case, integer rounding can reduce the victim's result to zero, leaving the deposited assets for existing shareholders.
ERC-4626 standardizes tokenized-vault conversions but does not prescribe one complete economic defense. Many implementations derive total assets from the vault's live token balance.
In an empty vault, an attacker can deposit a small amount to become the first shareholder, then transfer assets directly to the vault without minting shares. This donation raises assets per share. If a victim's subsequent deposit is small relative to that manipulated rate, the share calculation rounds down. The attacker can later redeem its shares for part or all of the victim's deposit.
The attack depends on conversion math, rounding direction, initial supply, whether unsolicited transfers count as managed assets, and any minimum-share or slippage check. A balance-based totalAssets function is not automatically defective: donations may intentionally accrue to shareholders, and a sufficiently initialized vault may make manipulation uneconomic.
Trace deposit, mint, withdraw, redeem, preview, and conversion functions together. Confirm the previews use the rounding directions required by the standard and agree with execution under the same state. Identify virtual assets or shares, decimal offsets, seeded liquidity, internal accounting, entry fees, and any router-enforced minimum output.
Test an empty vault, one unit of supply, direct donations before and after a pending deposit, repeated small deposits, and a vault returning to near-empty state after redemptions. Fuzz attacker deposit, donation, victim deposit, decimals, and rounding boundaries. Measure attacker profit after accounting for the portion of the donation that cannot be recovered.
Assert that a deposit either mints at least the caller's minimum acceptable shares or reverts. Also test integrators: a safe vault can still expose users if a router accepts any share output.
OpenZeppelin's ERC-4626 security guide describes virtual assets, virtual shares, and a configurable decimal offset. These mechanisms capture part of a donation and increase share precision, changing the attack's economics. Choose the offset with the asset's decimals and integration behavior in mind.
Other designs include seeding non-redeemable minimum liquidity, excluding unsolicited transfers through internal accounting, and requiring minimum shares at the user-facing entry point. Do not mint dead shares to the zero address with a standard ERC-20 implementation, which normally rejects zero-address minting. Internal accounting also needs a deliberate policy for yield, losses, and token rebases.
A zero-share revert prevents total loss on that transaction but does not cap lesser rounding loss. Slippage protection and realistic minimum deposit rules remain useful.
Repository analysis can flag balance-based accounting, empty-vault branches, rounding, and missing minimum-output checks. It cannot establish live vault state, pending transaction order, token behavior, or economic profitability without deployment-specific simulation.
Does every ERC-4626 vault have this vulnerability?
No. Exposure depends on its conversion math, initialization, donation handling, and caller protections.
Do virtual shares make manipulation impossible?
No. They can make the classic attack uneconomic under modeled conditions. They do not replace slippage limits, integration review, or testing.
Firepan
Run a free scan — results in minutes, no credit card required.
Run Free Scan →Assess smart contract admin powers, upgrade authority, key custody, delays, caps, and the limits of source-only centralization analysis.
Review smart contract liveness failures caused by gas growth, external-call reverts, griefing, and unrecoverable state.
Review accounting assumptions for fee-on-transfer, rebasing, and other non-standard ERC-20 tokens, with test and mitigation guidance.
Understand transaction-ordering risk, sandwich attacks, the conditions that make them profitable, and practical review and mitigation techniques.
Learn how weak swap bounds expose users and vaults to adverse execution, how to review integrations, and where minimum outputs and deadlines fall short.