Status DataClose notification

Overlayer Disclosed Report

Audit Report

Integer Underflow in _credit() Function Bricks All Inbound Cross-Chain Transfers on Spoke Chains

Target

Target is hidden

This information is not publicly available.

Vulnerability details

Vulnerability Details

The OverlayerWrapCore contract overrides LayerZero's OFT _debit() and _credit() functions to maintain cross-chain accounting using the storage variable totalBridgedOut.

This accounting is only valid on the hub chain. On any spoke (non-hub) chain:

  • totalBridgedOut is initialized to 0 and never increases (because _debit() can only run when the contract already holds tokens).
  • When an inbound cross-chain transfer arrives, _credit() executes:
totalBridgedOut -= amountReceivedLD;   // Underflow when totalBridgedOut == 0

Since the contract uses Solidity ^0.8.20, this causes an arithmetic underflow revert.

Result:
Every inbound bridge to any spoke chain fails. Tokens are burned on the source chain but never minted on the destination → permanent loss of user funds.

How to Reproduce (Step-by-Step)

  1. Deploy OverlayerWrap on the hub chain (with hubChainId set to the current chain ID).
  2. Deploy the exact same contract on a spoke chain (different chain ID, where block.chainid != hubChainId).
  3. Mint some OverlayerWrap tokens on the hub chain.
  4. Initiate a LayerZero OFT cross-chain transfer from hub → spoke.
  5. On the spoke chain, the _credit() hook is triggered → transaction reverts with underflow.

Validation steps

Validation Steps

Setup

  • Use Hardhat (local or forked network).
  • Deploy OverlayerWrap with hubChainId set to current chain ID (hub).

Deploy Spoke Contract

Deploy the same contract on a second network where block.chainid != hubChainId.

Trigger Inbound Transfer

Call the internal test helper (or simulate LayerZero inbound call):

await spoke.testCredit(user.address, ethers.parseEther("100"), 0);

Expected Behavior

  • Transaction reverts due to integer underflow.
  • No tokens are minted on the spoke chain.
  • totalBridgedOut remains 0.

Proof

  • POC provided

Note:

Please note i needed to modify and install extra packages outside the package.json to compile the project. But after compiling properly my POC works i have provided screenshot of it. Unfortunately i cant provide package.json in POC files bcz of the format not supported

Attachments

Attachments are hidden

This information is not publicly available.

Comments are hidden

This information is not publicly available.