Reproduced Exploit

StationX: cross-chain DAO fees are sent to the LayerZero deployer

createCrossChainERC20DAO reverts unless msg.sender is the LayerZero deployer, then stores that same msg.sender as ownerAddress. A later buy sends ownerShare (10 percent) to that address. The deployer has no receive(). The call fails, the result is ignored, and the 0.1 ETH fee from a 1 ETH buy remai…

Oct 2024•Ethereum•logic•3 min read

Loss

0.1 ETH of a 1 ETH buy stays in the factory. The DAO owner receives 0

Chain

Ethereum

Category

logic

Date

Oct 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 41382-c-01-the-layerzero-implementation-contract-is-the-receiver-o. Standalone Foundry PoC and full write-up: 41382-c-01-the-layerzero-implementation-contract-is-the-receiver-o_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/state-update · vuln/logic/fee-calculation

Key info#

FieldValue
Loss0.1 ETH of a 1 ETH buy stays in the factory. The DAO owner receives 0
Vulnerable contractFactory.createCrossChainERC20DAO
Attacker EOA0x1111111111111111111111111111111111111111 (the buyer)
Attack contractExploit
Attack txExploit.run() with 1 ETH
Chain / block / dateEthereum model · block 0 · 2024-10
Compilersolc 0.8.27, cancun
Bug classownerAddress is msg.sender, which the gate forces to be the LayerZero deployer

TL;DR#

createCrossChainERC20DAO reverts unless msg.sender is the LayerZero deployer, then stores that same msg.sender as ownerAddress. A later buy sends ownerShare (10 percent) to that address. The deployer has no receive(). The call fails, the result is ignored, and the 0.1 ETH fee from a 1 ETH buy remains in the factory. The DAO owner's received balance is 0. The other 0.9 ETH is booked as the raise.

The vulnerable code#

SOLIDITY
require(msg.sender == commLayer, "Caller not LZ Deployer");
address lzOwner = msg.sender; // @> VULN: ownerAddress is the LayerZero deployer, not the DAO creator
ccDetails[_daoAddress] = CrossChainDetails(1, false, lzOwner, false);
SOLIDITY
address feeTo = ccDetails[_daoAddress].ownerAddress; // @> VULN: owner fee is sent to the stored LayerZero deployer
DIFF
- address lzOwner = msg.sender;
+ address lzOwner = intendedOwner;

Root cause#

The only allowed caller is the deployer, and the fee owner is taken from msg.sender instead of an owner the DAO creator chooses. The fee call does not check success, so a deployer without receive() silently keeps the fee in the factory.

Preconditions#

  • A cross-chain DAO is created by the LayerZero deployer.
  • The real DAO owner is a contract that can receive ETH.
  • A buyer pays 1 ETH. Owner share is msg.value / 10.

Attack walkthrough#

  1. The deployer creates the DAO and passes the intended owner.
  2. msg.sender == commLayer passes.
  3. ownerAddress is set to the deployer.
  4. The buyer pays 1 ETH.
  5. 0.1 ETH is addressed to the deployer. The call fails and the value stays in the factory.
  6. The DAO owner's received counter is 0. The factory balance is 0.1 ETH.

Diagrams#

flowchart TD A["LayerZero deployer calls createCrossChainERC20DAO"] --> B["Gate requires msg.sender to be the deployer"] B --> C["VULN stores msg.sender as ownerAddress"] C --> D["Buyer pays 1 ETH. Owner share is 0.1 ETH"] D --> E["Fee call to the deployer fails because it has no receive"] E --> F["0.1 ETH stays in the factory. DAO owner receives 0"]

Impact#

The DAO owner loses the 0.1 ETH fee on this buy. The ETH is stuck in the factory because the failed call is ignored. The 0.9 ETH raise is delivered to the treasury, so the missing piece is specifically the owner fee.

How to reproduce#

BASH
cd 41382-c-01-the-layerzero-implementation-contract-is-the-receiver-o_exp
forge test -vv

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.