|
| 1 | ++++ |
| 2 | +title = "Vasthavikamaina Token Exploit" |
| 3 | +date = 2025-07-15 |
| 4 | +authors = ["Vrishab"] |
| 5 | ++++ |
| 6 | + |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +This exploit leverages a critical vulnerability in the `addVasthavikamainaLiquidity` function to manipulate AMM pool economics and extract profit without bearing the debt burden. The system creates three different machines (pools), but one of them, named "CowrieBO" (uniPair2), is set up with very little starting money; only 0.05 ETH. This makes it very easy to manipulate. |
| 11 | + |
| 12 | +## The Vulnerability |
| 13 | + |
| 14 | +The `addVasthavikamainaLiquidity` function contains a fatal flaw: |
| 15 | + |
| 16 | +- It sends loans directly to Uniswap pairs - which are the AMM pools |
| 17 | +- The `msg.sender` only provides matching tokens proportionally |
| 18 | +- LP tokens are burned to `address(0)`, making the liquidity permanent |
| 19 | +- **Result**: Massive liquidity gets added at manipulated prices with zero debt for us |
| 20 | + |
| 21 | +## Attack Steps |
| 22 | + |
| 23 | +### 1. Initial Setup |
| 24 | + |
| 25 | +- Flash loan WETH from Balancer contract for capital, which must be repaid in the same transaction |
| 26 | +- Convert WETH to VSTETH via `cashIn()` |
| 27 | + |
| 28 | +### 2. Price Manipulation |
| 29 | + |
| 30 | +- Execute `buyQuote()` on target pool (preferably Pool 2 - CowrieBO) |
| 31 | +- This drains pool reserves and inflates lamboToken price |
| 32 | +- Small initial buy (0.05 ETH) means maximum price impact |
| 33 | + |
| 34 | +### 3. Liquidity Amplification (Core Exploit) |
| 35 | + |
| 36 | +```solidity |
| 37 | +factory.addVasthavikamainaLiquidity(VSTETH, lamboToken, 300 ether, 0); |
| 38 | +``` |
| 39 | + |
| 40 | +- Function calculates: `lamboTokensNeeded = (300 ETH * reserve1) / reserve0` |
| 41 | +- **300 ETH loan goes directly to the machine** (not to us) |
| 42 | +- We only transfer the calculated lamboTokens (which is very less due to the flaw) |
| 43 | +- Pool's K-value jumps from small amount to massive: `K = (reserve0 + 300e18) × (reserve1 + proportional_tokens)` |
| 44 | + |
| 45 | +### 4. Profit Extraction |
| 46 | + |
| 47 | +- Sell remaining lamboTokens back to the enhanced pool |
| 48 | +- The amplified liquidity provides much better exchange rates |
| 49 | +- Pool now has deep liquidity at the inflated price we set |
| 50 | + |
| 51 | +## Why This Works |
| 52 | + |
| 53 | +1. **Debt Isolation**: The 300 ETH debt belongs to the Uniswap pair, not us |
| 54 | +2. **K-Value Manipulation**: Adding massive liquidity at inflated prices creates favorable AMM constants |
| 55 | +3. **Permanent Enhancement**: Burned LP tokens mean the enhanced liquidity can't be withdrawn |
| 56 | +4. **Arbitrage Profit**: Selling back tokens yields more ETH than originally invested due to the deeper, manipulated pool |
| 57 | + |
| 58 | +## Economic Impact |
| 59 | + |
| 60 | +- Input: ~6.35 ETH (flash loan + small buys) |
| 61 | +- Output: >141.3 ETH profit |
| 62 | +- The exploit tricks the AMM into providing permanent liquidity at prices controlled by us |
| 63 | + |
| 64 | +## Target Pool |
| 65 | + |
| 66 | +**Pool 2 (CowrieBO)** is optimal because: |
| 67 | + |
| 68 | +- Minimal initial buy (0.05 ETH) |
| 69 | +- Lowest starting lamboToken price |
| 70 | +- Thereby maximum manipulation potential per ETH spent |
| 71 | + |
0 commit comments