# LiquidityProviders.sol The share price of the LP can be manipulated and making future liquidityProviders unable to removeLiquidity()

LP share price in Biconomy Hyphen can be manipulated to near-zero reserve, causing sharesToTokenAmount overflow in removeLiquidity and freezing later LPs' funds.

- Payout: Audit contest
- Severity: high
- Program: Biconomy
- Found by: WatchPug
- Disclosed: 2022-07-25
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2022-03-biconomy-findings/issues/139
- Library page: https://bugbountylibrary.com/r/c4%3A2022-03-biconomy%3AH-02
- Tags: domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:dos vuln:share-inflation

**Target:** LiquidityProviders.sol removeLiquidity / sharesToTokenAmount
**Root cause:** First-mint share price is not locked; an attacker can drain reserve to 1 wei while retaining huge totalSharesMinted, so sharesToTokenAmount multiplies shares by reserve and overflows for subsequent LPs.
**Steps:**
1. Alice addTokenLiquidity 1e8*1e18 XYZ on B-Chain -> totalSharesMinted=1e44
2. Alice sendFundsToUser and bridge 1e8*1e18 XYZ B-Chain->A-Chain
3. Alice depositErc20 and bridge 1e8*1e18 XYZ A-Chain->B-Chain
4. Alice removeLiquidity withdrawing 1e8*1e18-1 XYZ leaving totalReserve=1 wei, totalSharesMinted=1e26
5. Bob addTokenLiquidity 3.4e7*1e18 XYZ
6. Bob removeLiquidity reverts: overflow in sharesToTokenAmount(totalNFTShares, token)
**How found:** Code review of removeLiquidity and sharesToTokenAmount: noticed share price depends on totalReserve/totalSharesMinted with no minimum reserve lock on first mint, hypothesized reserve could be driven to 1 wei while shares stay huge, causing multiplication overflow.
**Exploitation:** Attacker seeds a large pool, bridges liquidity out and back to manipulate accounting, then withdraws nearly all reserve leaving 1 wei against 1e26 shares; any later LP's removeLiquidity overflows and reverts, locking their deposit.
**Insight:** In share-based LP contracts, check whether the first depositor can leave totalReserve at 1 wei while totalSharesMinted stays large; any sharesToTokenAmount = shares*reserve/divisor then overflows for later depositors, so look for missing minimum-liquidity lock or dead-share burn on initial mint.
