Status DataClose notification

Overlayer Disclosed Report

Audit Report

Hub-to-Remote Bridge Credits Revert and Permanently Lock User Funds

Target

Target is hidden

This information is not publicly available.

Vulnerability details

Summary

OverlayerWrap is designed so that normal minting only happens on the hub chain. Remote chains are expected to receive supply through LayerZero bridge credits.

The issue is that totalBridgedOut is updated on every chain:

  • _debit() increases it
  • _credit() decreases it

That accounting only makes sense on the hub chain, where it is used by the backing logic to preserve the collateral invariant. On a fresh remote deployment, totalBridgedOut starts at 0, so the first inbound _credit() tries to execute:

totalBridgedOut -= amountReceivedLD;

and reverts with arithmetic underflow (panic 0x11).

Because LayerZero burns on the source side before minting on the destination side, the user's source-chain tokens are already gone when the destination credit fails. The result is a permanent loss of bridged user funds.

This is a deterministic protocol bug, not a theoretical edge case.

Why This Should Be Judged Critical

This issue matches the contest's stated critical criteria:

  • High likelihood
    • No privileged role is required.
    • No special market conditions are required.
    • No large capital requirement is required.
    • The failure path is standard user behavior: bridge from hub to a remote chain.
  • High impact
    • The bridged amount is burned on the source chain.
    • The destination mint never happens.
    • The funds are not temporarily delayed; they are stuck unless the protocol upgrades or manually intervenes.
    • The loss scales linearly with the amount bridged.

Most importantly, remote chains cannot mint supply locally, so the first inbound bridge is not optional bootstrap behavior. It is the only normal way for remote supply to appear.

Affected Code

Root Cause

The protocol uses totalBridgedOut as hub-side accounting so that backing logic can treat bridged-out supply as still part of the effective supply:

uint256 owTotalSupp = IOverlayerWrap(overlayerWrap).totalSupply() +
    IOverlayerWrap(overlayerWrap).totalBridgedOut();

That makes sense only on the hub chain, where collateral backing exists.

However, bridge accounting is applied globally:

function _debit(...) internal override returns (...) {
    (amountSentLD, amountReceivedLD) = super._debit(...);
    totalBridgedOut += amountSentLD;
}
function _credit(...) internal override returns (uint256 amountReceivedLD) {
    amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
    totalBridgedOut -= amountReceivedLD;
}

On a remote chain, totalBridgedOut is not meaningful. A newly deployed remote instance begins with totalBridgedOut == 0, so the first successful inbound bridge message attempts to subtract a non-zero amount from zero and always reverts.

Recommendation

Restrict totalBridgedOut accounting to the hub chain only.

Suggested fix:

  • In _debit(), increase totalBridgedOut only when block.chainid == hubChainId
  • In _credit(), decrease totalBridgedOut only when block.chainid == hubChainId
  • Add an explicit bounds check before decrementing so the contract reverts with a custom error instead of panic 0x11

Example shape:

if (block.chainid == hubChainId) {
    totalBridgedOut += amountSentLD;
}
if (block.chainid == hubChainId) {
    if (totalBridgedOut < amountReceivedLD) revert InvalidBridgeAccounting();
    totalBridgedOut -= amountReceivedLD;
}

Validation steps

Exploit / Failure Scenario

  1. A user mints OverlayerWrap on the hub chain.
  2. The user bridges part of their balance to a remote chain.
  3. On the hub chain, _debit() burns the user's balance and increments totalBridgedOut.
  4. LayerZero delivers the corresponding message to the remote chain.
  5. The remote chain executes _credit().
  6. _credit() mints through super._credit(...), then immediately tries to decrement totalBridgedOut.
  7. Since the remote chain starts with totalBridgedOut == 0, the subtraction underflows and reverts with panic 0x11.
  8. The destination mint is rolled back.
  9. The source-side burn has already happened, so the user is left with fewer tokens on the hub and none on the remote.

The message can be retried, but it will keep failing for the same reason because the remote state does not change.

Why Funds Are Permanently Locked

This point matters for judges: this is not "just a revert".

The source-side burn is part of the bridge debit path. The destination-side mint is a later step. When the destination step fails, the already-burned source balance is not automatically restored by this contract.

So the user ends up in the worst possible bridge state:

  • source tokens burned
  • destination tokens not minted
  • retry path still broken

That is a permanent lock of bridged user funds unless the team deploys a fix and performs recovery operations.

What the PoC Demonstrates

The PoC deploys two OverlayerWrapMock instances:

  • one representing the hub
  • one representing a fresh remote deployment

It then:

  1. Mints 20 OVA for a user on the hub.
  2. Calls testDebit() on the hub for 10 OVA.
  3. Confirms the user's hub balance drops from 20 to 10.
  4. Confirms hub.totalBridgedOut() == 10e18.
  5. Confirms remote.totalBridgedOut() == 0.
  6. Calls testCredit() on the remote for 10 OVA.
  7. Confirms the call reverts with panic 0x11.
  8. Confirms the user receives no remote tokens.

This proves the protocol can burn bridge funds on the source side while being unable to mint them on the destination side.

Run:

npx hardhat test test/OverlayerWrap.bridgeLockPoC.ts --config hardhat.config.audit.ts

Observed result:

Critical PoC: remote bridge credit permanently locks source funds
  ✔ burns on the source chain but always reverts on the first remote credit

1 passing (4s)

Attachments

Attachments are hidden

This information is not publicly available.

Comments are hidden

This information is not publicly available.