Target is hidden
This information is not publicly available.
Two confirmed vulnerabilities were identified in the OverlayerWrapCore contract. One is Critical severity (permanent fund lockup via arithmetic underflow) and one is Medium severity (permissionless reserve drain). Both have been validated with reproducible Proof-of-Concept tests passing on both in-memory Hardhat and mainnet-forked localhost nodes.
_credit() Arithmetic Underflow (Permanent Cross-Chain Fund Lock)File: contracts/overlayer/OverlayerWrapCore.sol
// Line 537-544
function _credit(
address to_,
uint256 amountLD_,
uint32 srcEid_
) internal virtual override returns (uint256 amountReceivedLD) {
amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
totalBridgedOut -= amountReceivedLD; // <== LINE 543: UNDERFLOW
}
Related code — _debit() increments the counter:
contracts/overlayer/OverlayerWrapCore.sol
// Line 510-527
function _debit(
address from_,
uint256 amountLD_,
uint256 minAmountLD_,
uint32 dstEid_
) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {
(amountSentLD, amountReceivedLD) = super._debit(from_, amountLD_, minAmountLD_, dstEid_);
totalBridgedOut += amountSentLD; // Line 527
}
totalBridgedOut is a uint256 state variable that tracks tokens sent outbound via LayerZero bridges. The _credit() function, called when tokens arrive inbound from a remote chain, unconditionally subtracts the received amount:
totalBridgedOut -= amountReceivedLD;
Solidity has checked arithmetic by default. When totalBridgedOut is zero (fresh deploy) or smaller than amountReceivedLD (partial mismatch), this subtraction triggers Panic(0x11) — an irrecoverable revert.
send().lzReceive() → _credit()._credit() executes totalBridgedOut -= 10e18 but totalBridgedOut == 0 → Panic(0x11).This is not a one-time issue. It affects every incoming bridge transfer when:
cyber@cyber-VMware-Virtual-Platform:~/hackenproof/contracts$ npx hardhat test test/CriticalAuditPoC.ts --network hardhat 2>&1
Confirmed Vulnerability PoC — Overlayer Audit
CRITICAL: _credit underflow blocks all incoming bridge transfers
[PRE] totalBridgedOut: 0
[FAIL] _credit( 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 , 10.0 OW+ ) => REVERTED
[!] User's 10 OW+ remain PERMANENTLY LOCKED on source chain
✔ reverts with Panic(0x11) when totalBridgedOut == 0 and _credit is called
[PRE] totalBridgedOut after 5 OW+ debit: 5.0
[FAIL] _credit(alice, 10 OW+) reverts — only 5 was debited
[!] 10 OW+ permanently locked on source chain
✔ also reverts when totalBridgedOut > 0 but less than incoming amount
[OK] Exact debit-credit pair succeeds. totalBridgedOut back to 0
✔ succeeds only when credit exactly matches prior debit (happy path proof)
MEDIUM: permissionless supplyToBacking drains local reserves
[PRE] OverlayerWrap USDT reserves: 200.0
[PRE] Bob has COLLATERAL_MANAGER_ROLE? false
[POST] OverlayerWrap USDT reserves: 0.0
[!] Bob drained ALL 200 USDT reserves without any role
✔ unprivileged Bob forces ALL collateral from OverlayerWrap to backing
[ROUND 1] Bob drained 50 USDT from reserves
[ROUND 2] Bob drained 100 USDT from reserves
[!] Attacker can repeat indefinitely — no cost, no role needed
✔ griefing: Bob repeatedly drains reserves after each new mint
Replace the unchecked subtraction with safe handling that accounts for legitimate inbound-first scenarios:
function _credit(
address to_,
uint256 amountLD_,
uint32 srcEid_
) internal virtual override returns (uint256 amountReceivedLD) {
amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
if (amountReceivedLD <= totalBridgedOut) {
totalBridgedOut -= amountReceivedLD;
} else {
totalBridgedOut = 0;
}
}
Alternatively, if the protocol invariant requires strict debit-before-credit ordering, enforce it explicitly with a descriptive revert (not a raw Panic) and document the required operational flow.
supplyToBacking() Is Fully Permissionless (Griefing Reserve Drain)File: contracts/overlayer/OverlayerWrapCore.sol
// Line 238-276
function supplyToBacking(
uint256 amountCollateral_,
uint256 amountACollateral_
) external nonReentrant whenNotPaused { // <== NO ACCESS CONTROL
if (approvedCollateralSpender == address(0)) {
revert OverlayerWrapCoreInvalidZeroAddress();
}
uint256 collateralBal = IERC20(collateral.addr).balanceOf(address(this));
uint256 aCollateralBal = IERC20(aCollateral.addr).balanceOf(address(this));
uint256 amountToSupplyCollateral = amountCollateral_ == 0
? collateralBal // <== 0 means "send EVERYTHING"
: amountCollateral_;
uint256 amountToSupplyACollateral = amountACollateral_ == 0
? aCollateralBal // <== 0 means "send EVERYTHING"
: amountACollateral_;
// ... transfers all to backing
}
supplyToBacking() is an external function with only nonReentrant and whenNotPaused modifiers — no role-based access control. Any EOA or contract can call it.
Furthermore, passing (0, 0) as arguments triggers the "send all" code path, transferring the entire collateral and aCollateral balance from the OverlayerWrap contract to the backing contract.
OverlayerWrap contract for instant-redeem liquidity.overlayerWrap.supplyToBacking(0, 0).OverlayerWrap to the backing contract (Aave).OverlayerWrap has zero local reserves — instant redemptions may fail or be delayed.Add role-based access control to restrict supplyToBacking() to authorized callers:
function supplyToBacking(
uint256 amountCollateral_,
uint256 amountACollateral_
) external nonReentrant whenNotPaused onlyRole(COLLATERAL_MANAGER_ROLE) {
// ... existing logic
}
This ensures only addresses with COLLATERAL_MANAGER_ROLE can move reserves to the backing, matching the protocol's existing access control pattern used elsewhere.
| File | Purpose |
|---|---|
test/CriticalAuditPoC.ts |
Hardhat test — 5 test cases covering both bugs |
contracts/test/MockAuditHelpers.sol |
Mock contracts (MockAToken, MockAavePool, MockLzEndpoint) |
contracts/test/OverlayerWrapMock.sol |
Existing mock exposing internal _debit() / _credit() |
# On in-memory Hardhat network (no external node needed)
npx hardhat test test/CriticalAuditPoC.ts --network hardhat
# On external forked node (start `npx hardhat node` with mainnet fork first)
npx hardhat test test/CriticalAuditPoC.ts --network localhost
cyber@cyber-VMware-Virtual-Platform:~/hackenproof/contracts$ npx hardhat test test/CriticalAuditPoC.ts --network localhost
Confirmed Vulnerability PoC — Overlayer Audit
CRITICAL: _credit underflow blocks all incoming bridge transfers
[PRE] totalBridgedOut: 0
[FAIL] _credit( 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 , 10.0 OW+ ) => REVERTED
[!] User's 10 OW+ remain PERMANENTLY LOCKED on source chain
✔ reverts with Panic(0x11) when totalBridgedOut == 0 and _credit is called (7690033 gas)
[PRE] totalBridgedOut after 5 OW+ debit: 5.0
[FAIL] _credit(alice, 10 OW+) reverts — only 5 was debited
[!] 10 OW+ permanently locked on source chain
✔ also reverts when totalBridgedOut > 0 but less than incoming amount (327957 gas)
[OK] Exact debit-credit pair succeeds. totalBridgedOut back to 0
✔ succeeds only when credit exactly matches prior debit (happy path proof) (74002 gas)
MEDIUM: permissionless supplyToBacking drains local reserves
[PRE] OverlayerWrap USDT reserves: 200.0
[PRE] Bob has COLLATERAL_MANAGER_ROLE? false
[POST] OverlayerWrap USDT reserves: 0.0
[!] Bob drained ALL 200 USDT reserves without any role
✔ unprivileged Bob forces ALL collateral from OverlayerWrap to backing (14621923 gas)
[ROUND 1] Bob drained 50 USDT from reserves
[ROUND 2] Bob drained 100 USDT from reserves
[!] Attacker can repeat indefinitely — no cost, no role needed
✔ griefing: Bob repeatedly drains reserves after each new mint (415408 gas)
5 passing (42s)
cyber@cyber-VMware-Virtual-Platform:~/hackenproof/contracts$
eth_blockNumber
eth_sendTransaction
Contract call: <UnrecognizedContract>
Transaction: 0x0cc91d077d326046879bd8d44d9ca23d7b76baba75c989de4e68b729ea00978f
From: 0x90f79bf6eb2c4f870365e785982e1f101e93b906
To: 0x7ddba5379549fc746b28841d8b927ca0740072a7
Value: 0 ETH
Gas used: 180596 of 30000000
Block #24787548: 0xa595f3baa9d7347691545398f89bb9ab7c88e066a171e7fdac344718c7a5199c
eth_getTransactionByHash
eth_call
Contract call: <UnrecognizedContract>
From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
To: 0xb10c5f52415c38e3c5c722656ceeff40317aa5af
eth_blockNumber
eth_sendTransaction
Contract call: <UnrecognizedContract>
Transaction: 0x95f09a0cedc1624ca6e4956fc45cae371f316cbee9f4c3ad8155bc559e766f7a
From: 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc
To: 0x7ddba5379549fc746b28841d8b927ca0740072a7
Value: 0 ETH
Gas used: 118575 of 30000000
Block #24787549: 0xc22239ff3de19b8a3d95c543a6a94d646397ec3811d1738c0ce05d00ade1019d
eth_getTransactionByHash
eth_call
Contract call: <UnrecognizedContract>
From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
To: 0xb10c5f52415c38e3c5c722656ceeff40317aa5af
eth_blockNumber
eth_sendTransaction
Contract call: <UnrecognizedContract>
Transaction: 0x6e36ca3be770bcd64191d0d149efb9a6c69aac861a30be71c45ba87ac766f077
From: 0x90f79bf6eb2c4f870365e785982e1f101e93b906
To: 0x7ddba5379549fc746b28841d8b927ca0740072a7
Value: 0 ETH
Gas used: 116237 of 30000000
Block #24787550: 0x8ae0741a90a7c805e2ccd63307c886f7e30ddb1b2e48472c710cb1b0c7bf1bc0
eth_getTransactionByHash
eth_call
Contract call: <UnrecognizedContract>
From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
To: 0xb10c5f52415c38e3c5c722656ceeff40317aa5af
eth_getBlockByNumber (2)
eth_getTransactionReceipt
eth_getCode
Attachments are hidden
This information is not publicly available.
Comments are hidden
This information is not publicly available.