Status DataClose notification

Overlayer Disclosed Report

Audit Report

Arithmetic Underflow in _credit() Permanently Locks All Bridged Tokens on Non-Hub Chains

Target

Target is hidden

This information is not publicly available.

Vulnerability details

The Vulnerability

OverlayerWrapCore overrides the LayerZero OFT _credit() hook and unconditionally decrements totalBridgedOut after every token receive:

// OverlayerWrapCore.sol line 543
function _credit(address to_, uint256 amountLD_, uint32 srcEid_)
    internal virtual override returns (uint256 amountReceivedLD)
{
    amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
    totalBridgedOut -= amountReceivedLD;  // underflows on non-hub chains
}

totalBridgedOut is initialised to 0 on every deployed chain. On the hub chain the invariant holds because _debit() increments it before any corresponding _credit() arrives. On non-hub chains, local minting is blocked by the onlyHubChain modifier, so _debit() never fires first, totalBridgedOut stays 0 forever. Any call to _credit() therefore executes 0 - amountReceivedLD, which Solidity 0.8 checked arithmetic converts into a revert (panic: 0x11). The revert rolls back super._credit()'s mint, so no tokens are ever delivered.

Steps to reproduce it

  1. Deploy OverlayerWrap on a non-hub chain (e.g. Arbitrum, hubChainId = 1).
  2. On the hub chain (Ethereum), a user calls the OFT send() to bridge any amount of OW tokens to the Arbitrum deployment.
  3. On the hub chain, _debit() fires: tokens are burned, totalBridgedOut on the hub increments correctly.
  4. LayerZero relays the message to Arbitrum and calls lzReceive() on the Arbitrum OverlayerWrap contract.
  5. Internally _credit(user, amount, ethEid) is called. super._credit() mints the tokens then totalBridgedOut -= amount evaluates as 0 - amount.
  6. Transaction reverts with panic: arithmetic underflow. The mint is rolled back.
  7. The user's tokens are burned on Ethereum and never appear on Arbitrum. There is no retry that can succeed because the contract code always reverts for any positive amount.

POC Tested

I shall attach the POC for reproducing.

forge test --match-test testExploit -vvvv

uploaded-image

Remediation

Guard the decrement with a hub-chain check:

Validation steps

Step 1: Locate the vulnerable line

Open contracts/overlayer/OverlayerWrapCore.sol at git commit 519c9e92fd9d80d11e35e9868130f6334b88d676. Navigate to the _credit() function (lines 537–544). Confirm the subtraction totalBridgedOut -= amountReceivedLD has no hub-chain guard.

Step 2: Confirm totalBridgedOut starts at zero on non-hub chains

Search the codebase for any initialisation of totalBridgedOut other than the implicit zero. There is none. Confirm that _debit() (the only incrementor) is only triggered by outbound OFT sends, meaning on a fresh non-hub deployment, totalBridgedOut is permanently 0 until tokens leave that chain. Since minting on non-hub chains is blocked by onlyHubChain, no tokens can ever exist there to send out first.

Step 3: Run the Foundry PoC

PoC_CreditUnderflow.t.sol

forge test --match-contract PoC_CreditUnderflow -vvvv Output as seen below: uploaded-image

testExploit proves the non-hub receive always reverts and tokens are destroyed. testHubChainWorksCorrectly proves the hub chain is unaffected, isolating the bug to the non-hub _credit path.

Step 4: Confirm there is no recovery path

Search for any function that can: (a) mint tokens on a non-hub chain without going through _credit, or (b) directly set totalBridgedOut to a non-zero value on a non-hub chain. Neither exists. The bug is deterministic and permanent for every non-hub deployment.

Attachments

Attachments are hidden

This information is not publicly available.

Comments are hidden

This information is not publicly available.