The ZlpVault, which implements ERC4626, is susceptible to inflation attacks where an attacker can manipulate the share price by directly transferring tokens to the vault before legitimate deposits occur.
The vulnerability exists in the share price calculation mechanism:
While the contract includes a decimal offset to prevent zero-division and initial share manipulation, this protection is insufficient against donation-based attacks.
The vault's fundamental security issue lies in its share price calculation mechanism, which fails to protect against manipulation through direct token transfers. When calculating shares, the contract uses total assets without any safeguards against artificial inflation, making it susceptible to price manipulation despite having deposit caps in place. The absence of virtual shares or minimum deposit requirements further compounds this vulnerability, allowing attackers to manipulate the share price by inflating the asset balance before legitimate users deposit. This creates a scenario where the relationship between assets and shares can be distorted, leading to potential value extraction from subsequent depositors.
The decimal offset protection, while appearing secure at first glance, fails to address sophisticated donation attacks due to its limited scope. An attacker can bypass this protection by first establishing a minimal legitimate position in the vault, then manipulating the share price through direct token transfers.
This manipulation works because once shares are in circulation, the fixed decimal offset becomes insignificant compared to the potential magnitude of donated tokens. When the attacker artificially inflates the vault's total assets while maintaining a minimal share supply, the share price calculation becomes severely distorted, effectively diluting the value of any subsequent deposits. This exploit capitalizes on the static nature of the decimal offset, which loses its protective properties once the vault is active.
Attack Sequence:
Attacker transfers a minimal amount (e.g., 1 wei) of tokens to get initial shares
Attacker directly transfers a large amount of tokens to the vault
Share price becomes inflated due to increased total assets
When victims deposit, they receive disproportionately few shares
Attacker extracts value through their inflated share position
Implement minimum initial deposit requirement:
Add virtual shares to price calculations:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.