# It is possible to manipulate WETH/LBR pair to claim reward of the users which shouldn't be claimed

EUSDMiningIncentives values staked LP via pair balanceOf, so a flash-swap can deflate the WETH/LBR pair and let an attacker claim another user's unclaimable rewards.

- Payout: Contest reward
- Severity: medium
- Program: Lybra Finance
- Credited: SpicyMeatball
- Disclosed: 2023-08-21
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2023-06-lybra-findings/issues/442
- Library page: https://bugbountylibrary.com/r/c4%3A2023-06-lybra%3AM-13
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic vuln:flash-loan vuln:oracle-manipulation vuln:reward-distribution

**Target:** EUSDMiningIncentives / StakingRewardsV2 staking contract on WETH/LBR Uniswap V2 pair
**Root cause:** stakedLBRLpValue computes LP value from ethlbrLpToken.balanceOf(pair) reserves rather than getReserves(), so a direct swap that drains the pair lowers the computed value and flips isOtherEarningsClaimable.
**Steps:**
1. Fork mainnet at block 17592869; target WETH/LBR pair 0x061883CD8a060eF5B8d83cDe362C3Fdbd8162EeE.
2. Alice mints EUSD and stakes LP so isOtherEarningsClaimable(alice)==false.
3. Attacker calls `v2Pair.swap(800 ether, 800000 ether, attacker, data)` to drain pair balances.
4. In uniswapV2Call, require `miner.isOtherEarningsClaimable(target)` now passes.
5. Call `purchaseOtherEarnings` to claim Alice's rewards.
6. Repay flash-swap amounts plus 0.3% fee from pre-funded WETH/LBR.
**How found:** Code reading: noticed stakedLBRLpValue derives total LP cost from balanceOf(pair) instead of getReserves(), making the claimability check manipulable by a direct pair swap.
**Exploitation:** Flash-swap both WETH and LBR out of the pair to shrink balanceOf-derived LP valuation below the threshold, claim the victim's accrued rewards inside the callback, then repay the swap plus fee; net profit is the stolen rewards minus swap fees.
**Insight:** When a contract prices LP tokens, check whether it reads balanceOf(pair) instead of getReserves(); balanceOf is flash-swappable within a single tx, so any threshold gated on it can be crossed atomically.
