Skip to content
DoS Audit finding Intermediate

The long payment path is sensitive to the long inventory in Escrow, and insufficient inventory can easily lead to business unavailability (DoS of long payments).

The LONG payment branch of payToVenue withdraws a platform subsidy from Escrow before collecting customer funds, but Escrow's LONG balance is only replenished by venue convenience fees. When the subsidy exceeds the venue's LONG deposit, the call reverts and the payment path becomes unusable.

s8olidity Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

57702 sc medium the long payment path is sensitive to the long inventory in escrow and insufficient inventory can easily lead to business unavailability dos of long payments

Description

Brief / Intro

The payToVenue LONG payment branch first withdraws LONG from Escrow (distributeLONGDiscount), a "platform subsidy", then collects LONG from customers, and then proceeds with pledging, currency conversion, or transfers according to the rules. However, the LONG in Escrow comes solely from the convenienceFeeLong received from the venue's top-up, with no other stable replenishment. Even with a high volume of actual business, a shortfall in LONGs could occur, causing payToVenue to revert during the distributeLONGDiscount phase, resulting in a business interruption due to insufficient funds causing the contract to not function properly.

Vulnerability Details

  • Source Analysis:
    • convenienceFeeAmount (fixed at $5) is converted to a LONG value and injected into Escrow.longDeposits only within venueDeposit.
    • In the payToVenue LONG branch, subsidyMinusFees is first calculated as platformSubsidyPercentage(amount) - processingFeePercentage(amount) and then withdrawn via escrow.distributeLONGDiscount(venue, this, subsidyMinusFees).
    • If subsidyMinusFees > longDeposits[venue], the call reverts (NotEnoughLONGs), preventing subsequent customer transfers and pledge/currency swaps.
    • This is a shortcoming caused by "business parameters + fund flow design", not a permission or front-running issue. It is more likely to be triggered during peak or large-value payments.

Impact Details

  • The contract cannot accept LONG payment paths as expected → business interruption.
  • Scope definition matches: Medium (Smart contract unable to operate due to lack of token funds).
  • Associated Risks: Frequent rollbacks block customer payments, also blocking downstream actions such as promotions and referral points redemption (complete rollback).

References

  • contracts/v2/platform/BelongCheckIn.sol:508 (distributeLONGDiscount withdraws subsidy LONG)
  • contracts/v2/periphery/Escrow.sol:105 (NotEnoughLONGs check)
  • contracts/v2/platform/BelongCheckIn.sol:396 (convenienceFeeLong is the only path to inject LONG)

Proof of Concept

{% code title="test/v2/platform/belong-long-liquidity.test.ts" %}

TS
import { ethers } from 'hardhat';
import { expect } from 'chai';
import EthCrypto from 'eth-crypto';
import {
  deployBelongCheckIn,
  deployEscrow,
  deployFactory,
  deployLONG,
  deployStaking,
  deployRoyaltiesReceiverV2Implementation,
  deployAccessTokenImplementation,
  deployCreditTokenImplementation,
  deployVestingWalletImplementation,
} from '../../../helpers/deployFixtures';
import { deploySignatureVerifier, deployHelper } from '../../../helpers/deployLibraries';
import { deployMockTransferValidatorV2, deployWETHMock } from '../../../helpers/deployMockFixtures';
import { BelongCheckIn, Factory, Escrow, LONG, Staking, CreditToken } from '../../../typechain-types';
import { BigNumber } from 'ethers';

describe('BelongCheckIn: LONG path can DoS on low Escrow LONG', () => {
  it('payToVenue (LONG) reverts when Escrow.longDeposits is insufficient', async () => {
    const [owner, venue, customer] = await ethers.getSigners();

    const signatureVerifier = await deploySignatureVerifier();
    const helper = await deployHelper();

    // Deploy BelongCheckIn with dummy payments config
    const paymentsInfo = {
      slippageBps: BigNumber.from(0), // irrelevant for revert point
      swapPoolFees: 3000,
      swapV3Factory: owner.address,
      swapV3Router: owner.address,
      swapV3Quoter: owner.address,
      wNativeCurrency: owner.address,
      usdc: (await deployWETHMock()).address, // mock
      long: (await deployLONG(owner.address, owner.address, owner.address)).address,
      maxPriceFeedDelay: BigNumber.from(3600),
    };

    const belong: BelongCheckIn = await deployBelongCheckIn(
      signatureVerifier.address,
      helper.address,
      owner.address,
      paymentsInfo as any
    );
    const escrow: Escrow = await deployEscrow(belong.address);

    // Wire contracts: factory / staking / credit tokens (simplified just to hit the branch)
    const rrImpl = await deployRoyaltiesReceiverV2Implementation();
    const accessImpl = await deployAccessTokenImplementation(signatureVerifier.address);
    const creditImpl = await deployCreditTokenImplementation();
    const vestingImpl = await deployVestingWalletImplementation();
    const validator = await deployMockTransferValidatorV2();

    const factory: Factory = await deployFactory(
      owner.address,
      owner.address, // signer not used here
      signatureVerifier.address,
      validator.address,
      {
        accessToken: accessImpl.address,
        creditToken: creditImpl.address,
        royaltiesReceiver: rrImpl.address,
        vestingWallet: vestingImpl.address,
      }
    );

    const longToken: LONG = await ethers.getContractAt('LONG', paymentsInfo.long);
    const staking: Staking = await deployStaking(owner.address, owner.address, longToken.address);

    // Set contracts
    await belong.setContracts({
      factory: factory.address,
      escrow: escrow.address,
      staking: staking.address,
      venueToken: (await ethers.getContractAt('CreditToken', (await (await factory.getCreditTokenInstanceInfo('','')).creditToken).toString())).address, // not used
      promoterToken: (await ethers.getContractAt('CreditToken', (await (await factory.getCreditTokenInstanceInfo('','')).creditToken).toString())).address, // not used
      longPF: owner.address,
    } as any);

    const fees = {
      referralCreditsAmount: 3,
      affiliatePercentage: 0,
      longCustomerDiscountPercentage: 0,
      platformSubsidyPercentage: 300, // 3%
      processingFeePercentage: 100,   // 1%
      buybackBurnPercentage: 0,
    };
    await belong.setParameters(paymentsInfo as any, fees as any, [
      { promoterStakingInfo: { usdcPercentage: 0, longPercentage: 0 }, venueStakingInfo: { depositFeePercentage: 0, convenienceFeeAmount: 0 } },
      { promoterStakingInfo: { usdcPercentage: 0, longPercentage: 0 }, venueStakingInfo: { depositFeePercentage: 0, convenienceFeeAmount: 0 } },
      { promoterStakingInfo: { usdcPercentage: 0, longPercentage: 0 }, venueStakingInfo: { depositFeePercentage: 0, convenienceFeeAmount: 0 } },
      { promoterStakingInfo: { usdcPercentage: 0, longPercentage: 0 }, venueStakingInfo: { depositFeePercentage: 0, convenienceFeeAmount: 0 } },
      { promoterStakingInfo: { usdcPercentage: 0, longPercentage: 0 }, venueStakingInfo: { depositFeePercentage: 0, convenienceFeeAmount: 0 } },
    ] as any);


    const customerInfo = {
      paymentInUSDC: false,
      visitBountyAmount: 0,
      spendBountyPercentage: 0,
      customer: customer.address,
      venueToPayFor: venue.address,
      promoter: ethers.constants.AddressZero,
      amount: ethers.utils.parseEther('100'), 
      signature: '0x',
    };

    await longToken.connect(customer).approve(belong.address, customerInfo.amount);

    await expect(belong.payToVenue(customerInfo as any)).to.be.reverted;
  });
});

{% endcode %}

The original report as published on Immunefi, by s8olidity. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the subsidy is paid out of a pool that has no reliable replenishment beyond venue convenience fees, so the payout can exceed the pool balance and revert.

Impact

The LONG payment path could revert and block customer payments, which may also block downstream actions such as promotions and referral points redemption.

What the attacker needed

Escrow LONG balance below the subsidy amount; Customer pays with LONG

The fix

The contract should ensure the Escrow has enough LONG, for example by topping it up from another source or checking the balance before withdrawing the subsidy.

How it was found

  1. Deploy the BelongCheckIn contract with a mock LONG token and set the platform subsidy and processing fee percentages.
  2. Deploy and wire the Escrow contract without depositing any LONG into it.
  3. Have a customer approve the contract to spend LONG and call payToVenue with a LONG payment.
  4. Observe that the transaction reverts because the Escrow has insufficient LONG.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract holds a pool of a token called LONG to pay part of a customer's bill as a subsidy. That pool is only topped up by small fees from venues, so it can run dry. When it does, the payment function stops working and customers cannot pay with LONG.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by s8olidity

View all

3 more disclosed reports, best first.

More from Belong

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.