Target is hidden
This information is not publicly available.
contracts/overlayer/OverlayerWrapCore.sol::_credit() unconditionally subtracts amountReceivedLD from totalBridgedOut.
function _credit(
address to_,
uint256 amountLD_,
uint32 srcEid_
) internal virtual override returns (uint256 amountReceivedLD) {
amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
totalBridgedOut -= amountReceivedLD;
}
totalBridgedOut is increased only on the source chain during _debit(). On a non-hub destination deployment that has never bridged tokens out before, totalBridgedOut == 0. The first inbound bridge message reaches super._credit(...), then immediately underflows on totalBridgedOut -= amountReceivedLD, which reverts the entire credit flow.
The vulnerable function is:
OverlayerWrapCore_credit(address,uint256,uint32)This is not a theoretical issue. The attached PoC simulates the following sequence:
_debit()._credit().satellite.totalBridgedOut == 0.The source-side burn has already occurred in step 2, so Alice's bridged funds are no longer usable on the destination chain.
totalBridgedOut is hub-chain-specific accounting, but _credit() updates it on every deployment instead of restricting that accounting to the hub deployment, or at least validating that the local counter is large enough before decrementing it.
_debit() in OverlayerWrapCore:function _debit(...) internal virtual override returns (...) {
(amountSentLD, amountReceivedLD) = super._debit(...);
totalBridgedOut += amountSentLD;
}
_credit() in OverlayerWrapCore:function _credit(...) internal virtual override returns (uint256 amountReceivedLD) {
amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
totalBridgedOut -= amountReceivedLD;
}
That subtraction assumes the current deployment previously increased the counter. That assumption is false for first-time destination credits and for any deployment that only receives bridged OW but has not previously bridged OW out.
Consider the following scenario:
OverlayerWrap.mint(...) flow and receives 10 OW._debit() burns 5 OW and increases hub.totalBridgedOut by 5 OW._credit(alice, 5e18, srcEid).super._credit(...) is followed by totalBridgedOut -= 5e18, but satellite.totalBridgedOut == 0, so the credit path reverts.In this situation, Alice has already lost 5 OW on the source chain, but the destination chain never credits her 5 OW. This creates a real lock of bridged user funds.
Impact summary:
totalBridgedOut is lower than the incoming credit amount_credit() pathtotalBridgedOut"Any user can trigger an inbound credit that reverts, causing bridged OW to become locked when the destination deployment's totalBridgedOut counter is lower than the credited amount."
Only update totalBridgedOut on the hub deployment, and never allow it to decrement below zero.
function _credit(
address to_,
uint256 amountLD_,
uint32 srcEid_
) internal virtual override returns (uint256 amountReceivedLD) {
amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
- totalBridgedOut -= amountReceivedLD;
+ if (block.chainid == hubChainId) {
+ if (amountReceivedLD > totalBridgedOut) revert OverlayerWrapCoreOverflow();
+ totalBridgedOut -= amountReceivedLD;
+ }
}
Alternatively, consider making totalBridgedOut a strictly hub-only accounting variable, because satellite deployments do not manage collateral backing and should not be required to maintain a non-zero bridge-out counter before they can accept inbound credits.
Create poc1.t.sol in audit-poc/poc1.t.sol, poc1.t.sol is in attachment.
forge test --match-path audit-poc/poc1.t.sol -vv
Ran 1 test for audit-poc/poc1.t.sol:Poc1BridgeCreditLockTest
[PASS] test_satelliteCreditUnderflowsAndLocksBridgedFunds() (gas: 122954)
Suite result: ok. 1 passed; 0 failed
Attachments are hidden
This information is not publicly available.
Comments are hidden
This information is not publicly available.