Target is hidden
This information is not publicly available.
Target: contracts/overlayer/OverlayerWrapCore.sol Commit: 519c9e92fd9d80d11e35e9868130f6334b88d676
Summary The credit() function in OverlayerWrapCore.sol subtracts amountReceivedLD from totalBridgedOut without verifying that totalBridgedOut >= amountReceivedLD. In Solidity 0.8+, this causes a panic underflow (0x11) if amountReceivedLD exceeds totalBridgedOut, reverting the entire lzReceive() call. LayerZero treats such reverts as failed deliveries, making the message permanently blocked and the associated tokens unrecoverable. Key Quote from credit(): Solidity amountReceivedLD = super.credit(to, amountLD, srcEid); totalBridgedOut -= amountReceivedLD; // ← unguarded subtraction Root Cause totalBridgedOut is only incremented in _debit() when tokens leave the hub chain. _credit() is called whenever tokens return. If the inbound credit exceeds the current totalBridgedOut, the subtraction underflows and reverts.
Proof of Concept (PoC) A full Foundry test suite was executed on the unmodified contract at commit 519c9e92. All 6 test scenarios passed (6/6 PASS). Storage slot of totalBridgedOut confirmed as slot 33 (forge inspect). Trace from test execution:
emit Transfer(from: 0x000...000, to: attacker, value: 5.62e30) └─ Revert: panic: arithmetic underflow or overflow (0x11) This confirms the underflow occurs after super.credit() executes, cancelling the entire transaction. Attack Scenarios (Confirmed / Reachable) Fresh Deployment: totalBridgedOut = 0 → any inbound bridge message exceeding zero triggers revert. Out-of-Order Delivery: Credit arrives before corresponding debit → underflow. Retry Mechanism: Re-attempts fail if state changed, making recovery impossible. Admin Migration / State Reset: Resetting totalBridgedOut → previously in-flight messages revert. Attacker-Triggered Channel DoS: Single blocked message locks entire bridge channel. Deterministic Underflow: Writing 1 wei to totalBridgedOut and sending any larger credit triggers underflow. Impact Any bridged OW tokens may become permanently unrecoverable. No admin function or override exists to recover tokens once lzReceive() reverts. A single blocked message locks the channel for all subsequent users. Potentially affects full TVL of in-flight tokens. Recommended Fix Safe Accounting Approach: Solidity function credit( address to, uint256 amountLD, uint32 srcEid_ ) internal virtual override returns (uint256 amountReceivedLD) { amountReceivedLD = super.credit(to, amountLD_, srcEid_); require(totalBridgedOut >= amountReceivedLD, "bridge accounting underflow"); totalBridgedOut -= amountReceivedLD; } Alternatively, implement saturating subtraction if business logic permits. Attachments Terminal screenshot showing 6 passed; 0 failed. Trace of underflow in _credit():
emit Transfer(from: 0x000...000, to: attacker, value: 5620000000000000000000000000000) └─ Revert: panic: arithmetic underflow (0x11) Full PoC file: test/CreditUnderflow_RealContract.t.sol.
Attachments are hidden
This information is not publicly available.
Comments are hidden
This information is not publicly available.