Reproduced Exploit
AXION: out-of-range BOOST makes the buyback burn past the peg
_unfarmBuyBurn sets the burn to totalLiquidity * (boostBalance - usdBalance) / (boostBalance + usdBalance), then multiplies by LIQUIDITY_COEFF / FACTOR (995000 / 1_000_000, from V3AMO and MasterAMO). On a V3 pool, single-sided BOOST increases balanceOf and liquidity() without moving the spot. The a…
Loss
Attacker nets 472.115258506922654752 USD. Spot is pushed from 0.9 to 14.972671758443269419
Chain
Ethereum
Category
logic
Date
Oct 2024
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 43530-h-1-boost-buyback-burns-incorrect-amount-of-liquidity-sherlo. Standalone Foundry PoC and full write-up: 43530-h-1-boost-buyback-burns-incorrect-amount-of-liquidity-sherlo_exp in the
evm-hack-registrymirror.
Vulnerability classes:
vuln/logic/price-calculation·vuln/oracle/price-manipulation
Key info#
| Field | Value |
|---|---|
| Loss | Attacker nets 472.115258506922654752 USD. Spot is pushed from 0.9 to 14.972671758443269419 |
| Vulnerable contract | V3Amo.unfarmBuyBurn |
| Attacker EOA | 0x1111111111111111111111111111111111111111 |
| Attack contract | Exploit |
| Attack tx | Exploit.run() |
| Chain / block / date | Ethereum model · block 0 · 2024-10 |
| Compiler | solc 0.8.27, cancun, via IR |
| Bug class | Liquidity to burn is computed from token balances on a V3 pool |
TL;DR#
_unfarmBuyBurn sets the burn to totalLiquidity * (boostBalance - usdBalance) / (boostBalance + usdBalance), then multiplies by LIQUIDITY_COEFF / FACTOR (995000 / 1_000_000, from V3AMO and MasterAMO). On a V3 pool, single-sided BOOST increases balanceOf and liquidity() without moving the spot. The active pool is 1,000 BOOST and 900 USD, spot 0.9. Adding 1,000 BOOST out of range makes the formula burn 754.827586206896551724 instead of 52.368421052631578946. The buyback prints a spot of 14.972671758443269419. Selling 100 BOOST that cost 90 USD returns 562.115258506922654752 USD. Net profit is 472.115258506922654752 USD. Sizing the burn from the active reserves stops at spot 1.002220911050889085.
Background#
Sherlock's October 2024 AXION contest, issue 114, in V3AMO._unfarmBuyBurn. The report says single-sided BOOST inflates the burn, the protocol buys BOOST with its own USD, and a buyer who holds BOOST can sell after the price is forced above the peg. The constants are the ones in the contest source. The pool here keeps active reserves separate from out-of-range BOOST so the spot can stay put while balanceOf changes, which is the V3 fact the formula ignores. The suggested fix is quoteSwap until the target price. The control uses the same formula on the active reserves only.
The vulnerable code#
uint256 totalLiquidity = pool.liquidity();
uint256 boostBalance = boost.balanceOf(address(pool));
uint256 usdBalance = usd.balanceOf(address(pool));
require(boostBalance > usdBalance, "PriceNotInRange");
lastLiquidity = (totalLiquidity * (boostBalance - usdBalance)) / (boostBalance + usdBalance); // @> VULN: balances count out-of-range BOOST, so the burn is not the distance to peg
lastLiquidity = (lastLiquidity * LIQUIDITY_COEFF) / FACTOR;
usdBalance in the contest source is toBoostAmount of the USD balance. Both tokens here have 18 decimals, so that scale is 1.
Root cause#
V3 balances are not the spot. Out-of-range BOOST is inside boost.balanceOf and inside liquidity(), and the formula treats that as a discount to the peg. The AMO then burns its in-range position and buys BOOST until the spot is far above 1.
Preconditions#
- The active spot is below the peg: 1,000 BOOST and 900 USD.
- Anyone can add BOOST-only liquidity. That add does not move the spot.
unfarmBuyBurnis public, as in the report.
Attack walkthrough#
- The pool is seeded at spot 0.9.
- The attacker adds 1,000 BOOST out of range. Spot is still 0.9.
boost.balanceOfis 2,000. unfarmBuyBurnreads those balances and schedules754.827586206896551724liquidity.- The buyback swaps the USD taken from the position back into BOOST. Spot becomes
14.972671758443269419. - The attacker sells 100 BOOST, bought earlier at 0.9, for
562.115258506922654752USD. - After paying the 90 USD cost,
472.115258506922654752USD remains. - The control burns
52.368421052631578946and stops at spot1.002220911050889085.
Diagrams#
Impact#
The AMO spends its USD to push BOOST from 0.9 through the peg to about 14.97. The attacker, who bought 100 BOOST at 0.9, receives 562.115258506922654752 USD and keeps 472.115258506922654752 after the 90 USD cost. That USD came out of the pool the AMO had just filled. The control does not pay that profit.
Remediation#
Size the burn with quoteSwap against the pool's spot, as issue 114 recommends. Do not derive it from balanceOf on a concentrated-liquidity pool.
How to reproduce#
cd 43530-h-1-boost-buyback-burns-incorrect-amount-of-liquidity-sherlo_exp
forge test -vv
test_exploit_side_boost_pushes_the_buyback_through_the_peg asserts the burn, the spot, the sale, and the net profit. test_control_active_reserves_stop_at_the_peg asserts a burn of 52368421052631578946 and a spot of 1002220911050889085.
Sources#
- AuditVault finding: https://github.com/Auditware/AuditVault/blob/main/findings/43530-h-1-boost-buyback-burns-incorrect-amount-of-liquidity-sherlo.md
- Sherlock issue 114: https://github.com/sherlock-audit/2024-10-axion-judging/issues/114
- Formula: https://github.com/sherlock-audit/2024-10-axion/blob/main/liquidity-amo/contracts/V3AMO.sol
LIQUIDITY_COEFF = 995000,FACTOR = 10 ** 6inV3AMOandMasterAMO
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 43530-h-1-boost-buyback-burns-incorrect-amount-of-liquidity-sherlo_exp (evm-hack-registry mirror).
- AuditVault finding: 43530-h-1-boost-buyback-burns-incorrect-amount-of-liquidity-sherlo.
Alerts & third-party analyses
These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.