Status DataClose notification

Overlayer Disclosed Report

Audit Report

Bridging into a non-hub OverlayerWrap deployment permanently locks user funds because `_credit()` underflows `totalBridgedOut` from zero

Target

Target is hidden

This information is not publicly available.

Vulnerability details

Impact summary

A user can initiate a normal public bridge from a hub OverlayerWrap deployment to a fresh non-hub OverlayerWrap deployment. The source-side send() burns the user’s tokens first and increments the source deployment’s totalBridgedOut. The queued packet then reaches the destination deployment’s real public lzReceive() path, but _credit() reverts because it decrements the destination-local totalBridgedOut from zero. Retrying the same packet under unchanged code and state fails again, and the user cannot recover through normal protocol actions. The bridged amount is therefore locked after the source-side debit has already persisted.

Affected components

  • contracts/overlayer/OverlayerWrapCore.sol:510-543
    • OverlayerWrapCore._debit()
    • OverlayerWrapCore._credit()
    • OverlayerWrapCore.totalBridgedOut
  • node_modules/@layerzerolabs/oft-evm/contracts/OFTCore.sol:175-221
    • public send()
    • internal _send() that debits before message dispatch
  • node_modules/@layerzerolabs/oft-evm/contracts/OFTCore.sol:266-297
    • destination _lzReceive() that calls _credit()
  • node_modules/@layerzerolabs/oapp-evm/contracts/oapp/OAppReceiver.sol:95-109
    • real public lzReceive() entrypoint

Root cause

OverlayerWrapCore._debit() always increments local totalBridgedOut, and OverlayerWrapCore._credit() always decrements local totalBridgedOut. Those mutations run on every deployment, including non-hub deployments. On a fresh non-hub deployment, local totalBridgedOut == 0. The first inbound credit into that deployment therefore executes totalBridgedOut -= amountReceivedLD against zero and reverts with arithmetic panic 0x11.

This is real-scenario

  • The confirmed reproduction uses the real public send() entrypoint inherited from OFTCore.
  • The failure occurs through the real public lzReceive() path, not through direct internal _credit() calls.
  • The endpoint harness preserves the relevant sequence: source send() debits first, queues a packet, and destination delivery later calls lzReceive() as the endpoint.
  • test/real/BridgeNonHubLock.real.ts includes a control path that successfully delivers public packets when the destination has matching positive totalBridgedOut, so the harness is capable of executing a valid path.
  • The same suite includes a contrivance-kill test showing that missing peer wiring reverts atomically before any lasting burn or totalBridgedOut update, so the confirmed lock is not caused by fake misconfiguration.

Preconditions

  • A hub OverlayerWrap deployment exists and has minted user balance available to bridge.
  • A non-hub OverlayerWrap deployment exists in the same OFT mesh and starts with local totalBridgedOut == 0.
  • Peers are wired normally so the destination packet can reach the destination deployment’s public lzReceive() path.
  • A user bridges from the hub deployment into that fresh non-hub deployment through the public send() flow.

Validation steps

Step-by-step reproduction

See FINAL_REPRO_STEPS.md for the exact command and full operator steps. In the confirmed flow, the user mints on the hub, calls the public send() entrypoint to the non-hub peer, the source burn and totalBridgedOut increment persist, and the queued destination packet then reverts with panic 0x11 when delivered through lzReceive().

Expected result

The source-side send should burn on the source deployment, the destination deployment should mint the bridged amount to the recipient, and the user should preserve the bridged value across the OFT mesh.

Actual result

The source-side burn succeeds and the queued packet is created. Destination delivery then reverts in _credit() before any destination mint occurs. Retrying the same packet fails again with the same panic. The user ends with no bridged tokens on either side for that transfer and cannot recover through normal protocol actions.

Evidence

The confirmed real-scenario suite is test/real/BridgeNonHubLock.real.ts.

  • TEST B proves the source-side debit persists before destination execution:
    • before send():
      • user hub balance: 20 OVA
      • user non-hub balance: 0 OVA
      • hub totalSupply(): 20 OVA
      • non-hub totalSupply(): 0 OVA
      • hub totalBridgedOut(): 0
      • non-hub totalBridgedOut(): 0
    • after successful source send() and before delivery:
      • user hub balance: 0 OVA
      • user non-hub balance: 0 OVA
      • hub totalSupply(): 0 OVA
      • non-hub totalSupply(): 0 OVA
      • hub totalBridgedOut(): 20 OVA
      • non-hub totalBridgedOut(): 0
      • destination packet exists: true
  • The same test then delivers the packet and asserts nonHubEndpoint.deliver(guid) reverts with panic 0x11.
  • After that failed delivery, the state is unchanged:
    • user balances remain 0 OVA on both deployments
    • hub totalSupply() remains 0 OVA
    • non-hub totalSupply() remains 0 OVA
    • hub totalBridgedOut() remains 20 OVA
    • non-hub totalBridgedOut() remains 0
    • destination packet still exists

Why retry does not fix it

TEST C retries the exact same failed destination packet through retryPayload(guid) without changing contract logic or storage. The retry reverts again with panic 0x11, the packet remains queued, and the hub still shows totalBridgedOut() == 20 OVA. Under unchanged vulnerable code and state, retry does not rescue the funds.

Why normal user recovery fails

TEST D exercises normal user-level actions after the failed receive:

  • source redeem() reverts because the bridged amount has already been burned on the hub deployment
  • the user’s source collateral balance does not increase after that failed redeem attempt
  • destination send() back to the hub reverts because the user never received any non-hub balance
  • retrying the queued packet still reverts with panic 0x11

No normal user-level recovery path succeeds in the confirmed scenario.

Suggested fix

Restrict totalBridgedOut accounting to the hub deployment only. A minimal fix is:

  • increment totalBridgedOut in _debit() only when block.chainid == hubChainId
  • decrement totalBridgedOut in _credit() only when block.chainid == hubChainId

Add regression tests that exercise:

  • a real public hub-to-non-hub send() into a fresh non-hub deployment
  • the retry path for the same failed packet
  • user recovery attempts after a failed destination receive

Code references

  • contracts/overlayer/OverlayerWrapCore.sol:510-543
  • node_modules/@layerzerolabs/oft-evm/contracts/OFTCore.sol:175-221
  • node_modules/@layerzerolabs/oft-evm/contracts/OFTCore.sol:266-297
  • node_modules/@layerzerolabs/oapp-evm/contracts/oapp/OAppReceiver.sol:95-109
  • contracts/test/LayerZeroEndpointHarness.sol:57-157
  • test/real/BridgeNonHubLock.real.ts:174-423

Attachments

Attachments are hidden

This information is not publicly available.

Comments are hidden

This information is not publicly available.