skills/vulnerability-patterns/erc4626-exchange-rate-manipulation/SKILL.md
ERC-4626 integrations are exploited by manipulating share price or conversion state to mint, borrow, or redeem at distorted rates.
npx skillsauth add apegurus/solidity-argus erc4626-exchange-rate-manipulationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This pattern targets vault systems that rely on ERC-4626 share/asset conversion, especially when those conversions are consumed by lending, collateral, or routing logic. Attackers manipulate the apparent exchange rate (or timing of its update) so victims mint too few shares, borrow against mispriced collateral, or absorb bad debt. The exploit usually combines one of: flash liquidity, share supply edge cases, stale accounting, rounding asymmetry, or permissive user-specified share parameters.
The core failure is trusting conversion outputs as if they were immutable and manipulation-resistant under adversarial flow ordering.
convertToShares/Assets and preview* into borrow limits, liquidation, and accounting updates.totalAssets or effective share supply.Require explicit user slippage bounds on both assets and shares. Add anti-manipulation checks that compare pre/post conversion expectations and reject large deltas within the same transaction context. Introduce bootstrap protections for first deposits (seed shares, dead shares, or guarded initialization). For lending integrations, gate collateral eligibility, cap concentration, and add oracle or TWAP defenses around vault share pricing. Finally, test conversion invariants under adversarial ordering and flash-capital assumptions.
testing
Specialist profile for mechanically applying the attack-vector deck and classifying vectors as skip, drop, or investigate.
tools
Specialist profile for libraries, helpers, base contracts, adapters, encoders, wrappers, and integration glue.
testing
Specialist profile for rounding, scale, decimal, downcast, and arithmetic accounting edge cases.
testing
Specialist profile for extracting conservation laws and state couplings, then searching for violating paths.