Status DataClose notification

Overlayer Disclosed Report

Audit Report

Cross-Chain Credit Underflow Can Lock Bridged User Funds

Target

Target is hidden

This information is not publicly available.

Vulnerability details

Summary

OverlayerWrapCore._credit() unconditionally decrements totalBridgedOut:

  • totalBridgedOut -= amountReceivedLD;

On a destination deployment with totalBridgedOut == 0, the first inbound bridge credit underflows and reverts (panic 0x11).

This can break the receive leg of bridging after source-side burn/debit already occurred.

Scoped Commit Verification

The vulnerable logic exists in the scoped commit

  • https://github.com/Overlayerfi/contracts/blob/519c9e92fd9d80d11e35e9868130f6334b88d676/contracts/overlayer/OverlayerWrapCore.sol#L537-L543
  • https://github.com/Overlayerfi/contracts/blob/519c9e92fd9d80d11e35e9868130f6334b88d676/contracts/overlayer/OverlayerWrapCore.sol#L520-L527
function _credit(
    address to_,
    uint256 amountLD_,
    uint32 srcEid_
) internal virtual override returns (uint256 amountReceivedLD) {
    amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
    totalBridgedOut -= amountReceivedLD;
}

Severity

Critical

Why this matches program criteria

  • High likelihood
    • No privileged role required.
    • Triggered by normal receive path conditions.
    • Reachable when destination totalBridgedOut is fresh/insufficient.
  • High impact
    • Source burn/debit can succeed while destination credit fails.
    • Cross-chain transfer liveness breaks and user funds can become locked in-flight.

Exploitability Conditions

  • Privileges needed: none.
  • Precondition: destination executes _credit() with amountReceivedLD > totalBridgedOut.
  • Most realistic case is first inbound transfer on a destination where totalBridgedOut == 0. (The precondition is attacker-achievable in practice: an unprivileged user can trigger it by sending to a destination where totalBridgedOut is still below the inbound amount (commonly 0 on fresh destination state).)

In-Scope Target

  • contracts/overlayer/OverlayerWrapCore.sol

Root Cause

totalBridgedOut accounting is chain-local but _credit() always subtracts from it. Inbound credits on destination chains are not guaranteed to have prior local outbound debits, so subtraction can underflow.

Impact

  1. User bridges from source chain.
  2. Source send() path burns/debits and updates source totalBridgedOut.
  3. Destination message delivery reaches _credit().
  4. Destination subtracts from zero (or insufficient) totalBridgedOut and reverts.
  5. Destination credit fails.

Validation steps

Proof of Concept (Real Endpoint Fork)

PoC Artifacts

  • findings/bridge-credit-underflow/test/CrossChainCreditUnderflow.realEndpoint.ts
  • hardhat.poc.real-endpoint.config.ts

What this PoC does (no mock endpoint)

  1. Uses real LayerZero Endpoint V2 address on a mainnet fork.
  2. Deploys two OverlayerWrapMock instances.
  3. Configures channel with setDelegate and setPeer on both sides.
  4. Executes actual OFT send() from source.
  5. Relays packet through endpoint flow (verify then lzReceive) with real endpoint state.
  6. Demonstrates destination revert with panic 0x11 in _credit().

Run

npm install --force
npx hardhat test --config hardhat.poc.real-endpoint.config.ts findings/bridge-credit-underflow/test/CrossChainCreditUnderflow.realEndpoint.ts

Optional RPC override:

MAINNET_RPC_URL=<your_mainnet_rpc> npx hardhat test --config hardhat.poc.real-endpoint.config.ts findings/bridge-credit-underflow/test/CrossChainCreditUnderflow.realEndpoint.ts

Execution notes:

  • Uses LayerZero Endpoint V2 0x1a44076050125825900e736c501f859c50fE728c on fork.
  • Uses root config hardhat.poc.real-endpoint.config.ts.
  • Single-fork constraint: both instances use the same endpoint EID; this does not affect the vulnerability because destination totalBridgedOut starts at zero regardless of EID.
  • After verify(), the PoC asserts inboundPayloadHash == payloadHash before lzReceive() to confirm relay correctness.

Observed Result

OverlayerWrap cross-chain credit accounting (real LZ endpoint)
  ✔ send() + relay on real endpoint reverts in destination _credit underflow

1 passing

Suggested Mitigation

  • Do not unconditionally decrement totalBridgedOut on every _credit().
  • Restrict this accounting to the intended chain/model (for example, hub-only accounting).
  • Add guard/invariant enforcement before subtraction.
  • Add tests for first inbound credit on fresh destination state and multi-chain debit/credit interleavings.

Attachments

Attachments are hidden

This information is not publicly available.

Comments are hidden

This information is not publicly available.