# ERC4626Cloned deposit and mint logic differ on first deposit

ERC4626Cloned's deposit path mints 1:1 shares on first deposit while mint path hardcodes 10e18, letting an attacker mint a single share and manipulate the vault.

- Payout: Contest reward
- Severity: high
- Program: Astaria
- Credited: adriro
- Disclosed: 2023-05-22
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-01-astaria-findings/issues/588
- Library page: https://bugbountylibrary.com/r/c4%3A2023-01-astaria%3AH-02
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:share-inflation

**Target:** ERC4626Cloned vault contract (deposit/mint/previewDeposit/previewMint)
**Root cause:** previewMint returns a hardcoded 10e18 for the first deposit to prevent share inflation, but previewDeposit/convertToShares returns assets 1:1 when supply==0, so deposit() bypasses the intended initial-share floor.
**Steps:**
1. Deploy TestERC4626 vault with supply==0.
2. Call `vault.previewDeposit(25e18)` -> returns 25e18 shares; `vault.previewMint(25e18)` -> returns 10e18, showing mismatch.
3. Mint 1 wei of underlying, `token.approve(vault, max)`.
4. Call `vault.deposit(1, address(this))` -> mints 1 share, bypassing the 10e18 floor.
5. Attacker now holds a tiny share supply and can donate/backrun an initial depositor to inflate share price.
**How found:** Compared the two preview functions for the supply==0 branch and noticed previewMint hardcodes 10e18 while previewDeposit returns assets 1:1, then confirmed deposit() routes through convertToShares rather than the mint floor.
**Exploitation:** Attacker calls deposit() with 1 wei as the first depositor to obtain 1 share instead of the intended 10e18 shares, then donates assets to inflate the share price and front-run a victim's deposit, causing share rounding loss to the victim.
**Insight:** When a protocol adds a first-depositor guard in one entry point (mint), check every sibling entry point (deposit) that reaches the same share math; asymmetric guards are a classic inflation bypass.
