# First depositor attack possible through multiple attack paths because the deposit function does not check 0 shares received

gHYBR vault deposit mints zero shares when totalAssets is inflated, letting first depositor capture later depositors' funds via donation.

- Payout: Contest reward
- Severity: medium
- Program: Hybra Finance
- Credited: asui
- Disclosed: 2025-11-20
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2025-10-hybra-finance#m-03
- Library page: https://bugbountylibrary.com/r/c4%3A2025-10-hybra-finance%3AM-03
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:chained technique:source-review vuln:access-control vuln:accounting-error vuln:share-inflation

**Target:** GovernanceHYBR gHYBR vault deposit/share accounting
**Root cause:** deposit() does not require shares minted > 0, so when totalAssets is inflated relative to supply, a depositor's shares round down to zero and their assets are absorbed by existing shareholders.
**Steps:**
1. Alice deposits 2 wei HYBR via `gHybr.deposit(2, alice)` receiving 2 shares (1:1)
2. Alice transfers 1000e18 HYBR to gHYBR and calls `gHybr.receivePenaltyReward(1000e18)` (no access control) to inflate totalAssets
3. Bob calls `gHybr.deposit(100e18, bob)`; shares = 100e18 * 2 / 1000e18 rounds to 0
4. Bob receives 0 shares; Alice's 2 shares now redeem 1100e18 assets
**How found:** Code review of gHYBR deposit share math noting missing zero-share check, combined with spotting unauthenticated receivePenaltyReward and public votingEscrow deposit_for as donation vectors.
**Exploitation:** Attacker seeds minimal shares, inflates totalAssets via unauthenticated receivePenaltyReward donation (or deposit_for on votingEscrow, or multiSplit withdraw leaving 1:1 dust), then victim deposits and gets zero shares; attacker redeems entire pool.
**Insight:** When auditing vault/ERC4626-style share math, enumerate every external path that can raise totalAssets without minting shares (public donation functions, deposit_for on linked escrows, withdraw-splitting) — each is a first-depositor inflation vector even if the classic donation path is guarded.
