57452 sc high on chain quoter reliance and spot price based swaps enable pool manipulation and value extraction from protocol controlled conversions usdc long

  • Submitted on Oct 26th 2025 at 10:30:44 UTC by @jo13 for Audit Comp | Belongarrow-up-right

  • Report ID: #57452

  • Report Type: Smart Contract

  • Report severity: High

  • Target: https://github.com/immunefi-team/audit-comp-belong/blob/main/contracts/v2/platform/BelongCheckIn.sol

  • Impacts: Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield

triangle-exclamation

Description

Brief / Intro

The contract derives amountOutMinimum from Uniswap V3’s Quoter on-chain at execution time. Because the Quoter returns spot outputs based on current pool state, searchers can manipulate the pool just before inclusion and force a low quote. The swap then executes with a too-low amountOutMinimum, causing systematic execution loss on protocol-controlled conversions (USDC ↔ LONG) such as venue fee conversions, AutoConvert payments, and buyback/burn.

Vulnerability Details

  • In BelongCheckIn._swapExact, amountOutMinimum is computed on-chain from Quoter, which reflects manipulable spot state:

// BelongCheckIn.sol::_swapExact
uint256 amountOutMinimum = IV3Quoter(_paymentsInfo.swapV3Quoter)
    .quoteExactInput(path, amount)
    .amountOutMin(_paymentsInfo.slippageBps);
  • The swap then uses this min-out with deadline: block.timestamp:

  • There is no anchor price (TWAP/Chainlink) check, no minimum-liquidity check, and no volatility circuit breaker.

  • Affected flows:

    • venueDeposit_swapUSDCtoLONG (fees to LONG)

    • payToVenue (AutoConvert LONG→USDC)

    • distributePromoterPayments (USDC→LONG)

    • _handleRevenue buyback (USDC→LONG)

Attack path (summary)

1

Pre-trade the target pool to worsen the spot price.

2

Victim transaction calls Quoter on-chain and derives a too-low amountOutMinimum from the manipulated spot state.

3

Swap executes because actual execution price is above the artificially-low minimum, transferring value to the attacker.

4

Attacker back-runs to unwind and capture profit (sandwich/MEV).

Impact Details

  • Direct economic loss on each protocol-initiated swap when spot is manipulated (sandwich/MEV). For example, on a 5% adverse move, a $50k notional swap can lose ~$2.5k. Loss scales with swap size and frequency.

  • Severity: High. Routinely exploitable by MEV and persists until quoting is moved off-chain or bounded by an anchor.

References

  • Code: contracts/v2/platform/BelongCheckIn.sol (_swapExact, _swapUSDCtoLONG, _swapLONGtoUSDC)

  • Uniswap V3 Quoter docs (not recommended for on-chain production min-out derivation)

  • General MEV/sandwich references for spot-price manipulation around swaps

https://developer.metamask.io/

Proof of Concept

chevron-rightTest: Security: Quoter minOut manipulation (click to expand)hashtag

Add this to /home/jo/audit-comp-belong/test/v2/platform/belong-check-in-bsc-fork.test.ts and run: LEDGER_ADDRESS=0x0000000000000000000000000000000000000001 PK=0x1000000000000000000000000000000000000000000000000000000000000001 npx hardhat test test/v2/platform/belong-check-in-bsc-fork.test.ts --grep "Security: Quoter minOut manipulation"


If you want, I can propose specific remediations (e.g., using TWAP/Chainlink anchoring, off-chain quoting, adding min-liquidity checks, volatility circuit breakers, or delaying quoting) and example code patches for BelongCheckIn._swapExact. Which would you prefer?

Was this helpful?