# Juice staking: harvest reward logic drains ~54 ETH

Juice staking contract's harvest logic let an attacker stake 0.5 ETH, harvest inflated JUICE rewards one block later, and dump for ~54 ETH profit.

- Payout: Real-world hack
- Severity: high
- Program: Juice
- Analysis by: DeFiHackLabs
- Disclosed: 2024-03-09
- Write-up quality: 6/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2024-03/Juice_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20240309-juice
- Tags: domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:reward-distribution

**Target:** Juice staking contract (harvest/stake) on Ethereum mainnet
**Root cause:** Reward accrual in harvest() is not properly time-weighted/accounted, so a freshly staked position can claim outsized JUICE rewards after a single block.
**Steps:**
1. Fork mainnet at block 19395636.
2. Swap 0.5 ETH to JUICE via Uniswap V2 router.
3. `JUICE.approve(JuiceStaking, max)` then `JuiceStaking.stake(JUICE.balanceOf(this), 3000000000)`.
4. Advance one block (`vm.roll(block.number+1)`, `vm.warp(timestamp+12)`).
5. Call `JuiceStaking.harvest(0)` to claim rewards.
6. Approve router and swap all JUICE back to ETH via `swapExactTokensForETHSupportingFeeOnTransferTokens`.
**Exploitation:** Attacker flash-free funded 0.5 ETH, staked into Juice, waited a single block, harvested inflated JUICE rewards, and sold them into the JUICE/WETH Uniswap pool for ~54 ETH profit.
**Insight:** When auditing staking/reward contracts, check whether harvest() accrues rewards based on stake amount without a minimum time or properly checkpointed reward-per-share; a one-block stake+harvest can mint outsized rewards if accrual is naive.
