Target is hidden
This information is not publicly available.
OverlayerWrapCore._credit performs an unguarded totalBridgedOut -= amountReceivedLD under Solidity 0.8 checked arithmetic. The totalBridgedOut counter is only incremented by _debit (outbound OFT burn on the local chain) and decremented by _credit (inbound OFT mint on the local chain); there is no initializer, admin setter, rescue function, or migration routine that writes to it from any other path.
On any chain where block.chainid != hubChainId (i.e., every spoke-chain deployment), the protocol's own onlyHubChain modifier at OverlayerWrapCore.sol:358 and :377 forbids the local user-facing mint() and redeem() paths. A spoke therefore has no way to ever generate an outbound _debit before it has received an inbound _credit — spokes only exist to receive OVA from the hub.
As a consequence, on every freshly deployed spoke:
totalBridgedOut begins at 0._credit(to, amount, srcEid).super._credit(...) mints amount OVA to the recipient via OFT._credit → _mint.totalBridgedOut -= amountReceivedLD executes on a zero counter, triggers Solidity 0.8's checked-arithmetic underflow, and reverts with Panic(0x11)._debit already burned the user's OVA and credited totalBridgedOut on the hub. From the user's perspective the tokens are gone on the origin chain and will never land on the destination chain.There is no on-chain recovery path. OverlayerWrap is not upgradeable; totalBridgedOut has no admin setter; no rescue routine exists. Unbricking a spoke requires either deploying a new contract, treasury-funded out-of-band compensation, or a proxy upgrade that the protocol does not support.
100% of the cross-chain value that any user bridges to any fresh spoke is permanently locked until an off-protocol remediation is performed.
hubChainId constructor parameter and its onlyHubChain gating pattern make spoke deployment a documented operating mode.send() from the hub to a fresh spoke is sufficient. The victim's own transaction hands the spoke its first inbound message.contracts/overlayer/OverlayerWrapCore.sol:537–544:
/// @dev Mints tokens on the destination chain; this override decrements totalBridgedOut
/// to mirror the hub-side _debit increment. Used exclusively by LayerZero OFT delivery.
function _credit(
address to_,
uint256 amountLD_,
uint32 srcEid_
) internal virtual override returns (uint256 amountReceivedLD) {
amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
totalBridgedOut -= amountReceivedLD; // <-- UNGUARDED, underflows on any fresh spoke
}
super._credit routes through OFT._credit in @layerzerolabs/oft-evm/contracts/OFT.sol, which mints amountLD_ tokens to to_. The subtraction on the next line then executes unconditionally.
totalBridgedOut is always zero on a fresh spokeThe only writers of totalBridgedOut across the entire in-scope codebase are:
// contracts/overlayer/OverlayerWrapCore.sol:527 — _debit (outbound OFT send)
totalBridgedOut += amountSentLD;
// contracts/overlayer/OverlayerWrapCore.sol:543 — _credit (inbound OFT receive)
totalBridgedOut -= amountReceivedLD;
Grepping the tree at commit 519c9e9:
$ git grep -n totalBridgedOut contracts/
contracts/overlayer/OverlayerWrapCore.sol:63: uint256 public totalBridgedOut;
contracts/overlayer/OverlayerWrapCore.sol:527: totalBridgedOut += amountSentLD;
contracts/overlayer/OverlayerWrapCore.sol:543: totalBridgedOut -= amountReceivedLD;
contracts/overlayerbacking/AaveHandler.sol:241: (read only, in supply accounting)
No setter, no initializer assignment, no rescue function. The counter has exactly two writers and both live inside OFT delivery hooks.
contracts/overlayer/OverlayerWrapCore.sol:77–82:
modifier onlyHubChain(uint256 chainId_) {
if (chainId_ != hubChainId) {
revert OverlayerWrapCoreNotHubChainId();
}
_;
}
Applied at :358 (_managerMint) and :377 (_managerRedeem):
function _managerMint(Order memory order_)
internal
onlyHubChain(block.chainid)
belowMaxMintPerBlock(order_.overlayerWrapAmount)
{ ... }
function _managerRedeem(Order memory order_)
internal
onlyHubChain(block.chainid)
returns (uint256 checkedBurnAmount, uint256 actualCollateralAmount)
{ ... }
A spoke (where block.chainid != hubChainId) cannot locally mint — so it cannot hold OVA until someone bridges OVA in. It therefore cannot produce an outbound _debit to seed totalBridgedOut. The very first operation any spoke will ever see is an inbound _credit, which underflows.
Solidity ^0.8.20 applies checked arithmetic by default. uint256(0) - uint256(1) reverts with Panic(0x11) (arithmetic underflow). LayerZero's executor, which invokes lzReceive on the destination contract, cannot succeed on a reverting message — the executor treats it as undeliverable. The message sits in the queue; retries hit the exact same deterministic Panic. There is no probabilistic recovery.
Two Foundry tests, both passing against the real mainnet fork at block 22000000, demonstrate the bug end-to-end:
# audit-foundry/.env
MAINNET_RPC_URL=https://eth.drpc.org
FORK_BLOCK_NUMBER=22000000
# audit-foundry/foundry.toml excerpt
[profile.default]
evm_version = "shanghai"
fs_permissions = [{ access = "read", path = "../target-repo" }]
allow_paths = ["../target-repo"]
remappings = [
"@openzeppelin/=../target-repo/node_modules/@openzeppelin/",
"@aave/=../target-repo/node_modules/@aave/",
"@layerzerolabs/=../target-repo/node_modules/@layerzerolabs/",
"forge-std/=lib/forge-std/src/",
"overlayer/=../target-repo/contracts/",
]
audit-foundry/test/fork/D1_R2H1_Critical_Exploit.t.sol (attached verbatim). Key steps:
OverlayerWrapMock (which inherits OverlayerWrap and exposes the internal _debit / _credit hooks as external testDebit / testCredit for harness access — the hook bodies are unchanged from production).OverlayerWrapMock with hubChainId = 999. Because this fork's block.chainid == 1, this second instance is a spoke by construction.hub.mint(...) with 10,000 USDT collateral, receives 10,000 OVA on the hub.hub.testDebit(alice, 10,000e18, 10,000e18, 0) — this is the production OFT outbound path. Hub burns her 10,000 OVA; hub.totalBridgedOut becomes 10,000e18.spoke.testCredit(alice, 10,000e18, 1) — this invokes the exact same overridden _credit function that LayerZero's executor would call through OFTCore._lzReceive.alice holds 0 USDT, 0 hub OVA, 0 spoke OVA. 10,000 USDT of user capital is permanently locked.$ cd audit-foundry
$ source .env
$ forge test --fork-url "$MAINNET_RPC_URL" --fork-block-number "$FORK_BLOCK_NUMBER" \
--match-path test/fork/D1_R2H1_Critical_Exploit.t.sol -vv
Ran 3 tests for test/fork/D1_R2H1_Critical_Exploit.t.sol:D1_R2H1_CriticalExploit
[PASS] test_CRITICAL_R2H1_alice_loses_10000_USDT_permanently_on_first_spoke_receive() (gas: 260948)
Logs:
======================================================================
R2-H1 LIVE-FORK EXPLOIT -- permanent user-fund lockout
Fork: Ethereum mainnet @ block 22000000
Hub OverlayerWrap 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f
Spoke OverlayerWrap 0xc7183455a4C133Ae270771860664b6B7ec320bB1
Alice 0xEb9F452b269dA9ca2aab546018abF0A0615476ea
======================================================================
[STEP 1] Alice starts with 10000000000 USDT (6dp)
[STEP 1] Alice minted 10000000000000000000000 OVA on hub (18dp)
[STEP 2] Alice bridged 10000000000000000000000 OVA out of hub (testDebit)
[STEP 2] hub.balanceOf(alice) = 0
[STEP 2] hub.totalBridgedOut() = 10000000000000000000000
[STEP 3] Spoke.totalBridgedOut BEFORE delivery: 0
[STEP 3] REVERT confirmed: Panic(0x11) on first spoke inbound credit
======================================================================
LOSS QUANTIFICAT
Please follow POC section.
Attachments are hidden
This information is not publicly available.
Comments are hidden
This information is not publicly available.