Donation attacks
Introduction
This scenario illustrates a worst-case hypothetical attack on a lending protocol that relies on exchange-rate manipulation of ERC-4626 vaults. Specifically, it focuses on a protocol that lists an ERC-4626 share token as both collateral and a borrowable asset, and uses the vault's share-to-asset conversion to value those shares in terms of the underlying asset.
This scenario depends on the exact assumptions below. Exploring it helps identify mitigations that can reduce similar risks in other configurations.
The described sequence requires direct donations to change the share conversion consumed by lending valuation. EVK's internal cash accounting breaks that assumption for an EVK vault's own shares. It does not make every ERC-4626 collateral or oracle integration safe: external share vaults, oracle routes, recursive collateral paths, liquidity, and redeemability can introduce different risks.
Attack
Initial Setup
System Configuration:
- ERC-4626 Vault: Allows depositing ABC to receive wABC
- Lending Protocol: Uses the ABC/wABC exchange rate to value wABC
- Collateral & Borrowing Rules:
- wABC as Collateral to borrow USDC: 0.8 LTV (80% of wABC value can be borrowed)
- USDC as Collateral to borrow wABC: 0.8 LTV (80% of USDC value can be borrowed)
Required attack conditions
The numerical sequence previously shown here did not reconcile share supply, account balances, collateral, and debt. The mechanism is clearer when stated as the conditions an attacker would need:
- Manipulable share conversion: unsolicited underlying transfers must increase the share-to-asset conversion used by the lending protocol's valuation path.
- Useful market relationships: the affected share token must be accepted in collateral or borrowing relationships that let the attacker turn the manipulated valuation into extractable assets.
- Concentrated share supply: the attacker must be able to reduce effective outstanding share supply enough that a donation materially changes the conversion rate, while retaining or controlling shares that benefit from the change.
- Sufficient liquidity and limits: available liquidity, supply caps, borrow caps, LTVs, and liquidation constraints must permit the position and extraction path.
- Economic viability: assets extracted must exceed donations, financing costs, swap costs, transaction fees, liquidation losses, and any flash-loan fee.
If any required condition fails, this exact path fails. A complete assessment must trace the vault's actual accounting, share ownership, oracle route, connected markets, caps, liquidity, and every asset movement. ERC-4626 conformance alone neither proves nor disproves exposure.
Prevention Strategies
1. Prevent Exchange Rate Manipulation
The attack relies on manipulating the exchange rate within an ERC-4626 vault. Under the exact accounting assumption described here, internal balance tracking that excludes unsolicited transfers from the share conversion removes the required manipulable-conversion condition. Integrators must verify the actual vault accounting and oracle path rather than infer this property from ERC-4626 conformance.
2. Avoid Vulnerable Vaults as Collateral
For ERC-4626 vaults where the exchange rate can be altered by donations, a simple mitigation strategy is to:
- Avoid listing these vaults as collateral or
- Prevent them from being borrowable in the lending protocol
Under the example's assumptions, either measure removes one of the required collateral or borrow relationships. Other market relationships can create different paths.
3. Implement Supply and Borrow Caps
If vulnerable ERC-4626 vaults must be used as collateral and borrowing assets, additional safeguards can reduce the risk:
- Set conservative supply and borrow caps that do not exceed the total circulating supply of the vault's share tokens
- Caps can bound exposure and increase attack cost under the configured limits, but do not by themselves prove that an attack is unprofitable
4. Use a Wrapped Exchange Rate Oracle
A carefully designed wrapped exchange rate oracle can bound extreme or rapid reported exchange-rate changes:
- Cap exchange rate increases within a set threshold
- Limit the rate of change within a single block, potentially breaking this exact atomic sequence
- This can force a multi-block strategy and add market risk without proving the broader configuration safe
Important Note: Some existing wrapped exchange rate oracles may still be vulnerable to this type of attack. For example, certain price feeds from third-party oracle providers report the redemption price of an asset. However, this redemption price might internally use the ERC-4626 exchange rate, which can be manipulated through donation attacks.
Conclusion
This hypothetical attack demonstrates how exchange rate manipulation in ERC-4626 vaults can be exploited to target lending protocols that allow vulnerable vaults as both collateral and borrowable assets.
For an EVK vault's own shares, internal cash accounting breaks the direct-donation assumption used in this example. This is a mitigation of the described mechanism under its stated assumptions, not a guarantee for external ERC-4626 collateral, oracle routing, liquidity, redemption restrictions, caps, or recursive dependencies. Supply and borrow caps can bound exposure but do not establish unprofitability or safety.