Skip to content

Case Study: Poly Network Cross-Chain Privilege Escalation

Fidelity Level: L2 (Fork-State Reproduction, Ethereum-side) Date: August 10, 2021 Loss: ~$611M (largest DeFi exploit at the time) Chains: Ethereum, BSC, Polygon

Overview

The Poly Network bridge was exploited on August 10, 2021 in what was then the largest DeFi hack in history. The attacker exploited a hash collision vulnerability in the EthCrossChainManager contract to call putCurEpochConPubKeyBytes on the EthCrossChainData contract, replacing the bridge keeper's public key with their own. This allowed them to authorize unauthorized cross-chain transfers across Ethereum, BSC, and Polygon.

The attacker ultimately returned most of the stolen funds, making the incident as notable for its unusual aftermath as for its technical sophistication.

Technical Details

Contracts

Contract Chain Address Role
EthCrossChainManager Ethereum 0x838bf9E95CB12Dd76a54C9f9D2E3082EAF928270 Cross-chain message verification
EthCrossChainData Ethereum 0xcF2afe102057bA5c16f899271045a0A37fCb10f2 Keeper public key storage
EthCrossChainManager (BSC) Verified at fork block BSC-side manager (address varies by deployment)
EthCrossChainData (BSC) Verified at fork block BSC-side data store (address varies by deployment)
EthCrossChainManager (Polygon) Verified at fork block Polygon-side manager (address varies by deployment)

Vulnerability

The EthCrossChainManager has a function verifyHeaderAndExecuteTx that processes cross-chain transactions by dispatching them via _executeCrossChainTx:

function _executeCrossChainTx(
    address _toAddress,
    bytes memory _data
) internal returns (bool) {
    // ... dispatch data to target contract
    (bool success, ) = _toAddress.call(_data);
    return success;
}

The vulnerability is a function selector hash collision: 1. verifyHeaderAndExecuteTx validates a Merkle proof and then calls _executeCrossChainTx 2. _executeCrossChainTx uses a low-level call to dispatch to any address with any data 3. The attacker found that the keccak256 hash of the legitimate function signature collides with the hash of putCurEpochConPubKeyBytes when routed through the dispatch logic 4. This allowed the attacker to replace the keeper public key by sending a crafted cross-chain message

With the keeper key replaced, the attacker could authorize any cross-chain transfer.

Fork Point

Chain Fork Block Notes
Ethereum 12,996,693 Block before exploit tx at 12,996,694
BSC 9,755,172 Requires paid archive RPC for full verification
Polygon 16,332,982 Requires paid archive RPC for full verification

Exploit Transactions

Chain Transaction
Ethereum 0x5a8b2152ec7d5538030b53347ac82e263c58fe7455695543055a2356f3ad4998
BSC 0x6522c7104d444458316c0211a7a00552b7b25841bc6db91a329d9136173a0ae2
Polygon 0x90435163fd6e4a64d1f2d65403e05a81e905d045d4e13da53408f654070a25fa

Attacker

0xA87fB85A93Ca072Cd4e5F0D4f178Bc831Df8a00B

Reproduction Approach

Ethereum-Side (In Scope)

The reproduction validates the core vulnerability mechanism on Ethereum:

  1. Forks Ethereum at block 12,996,693
  2. Verifies both EthCrossChainManager and EthCrossChainData contracts exist with non-empty code at the fork block
  3. Constructs a verifyHeaderAndExecuteTx call with a crafted proof that triggers the hash collision
  4. Demonstrates that putCurEpochConPubKeyBytes can be called on EthCrossChainData through the dispatch logic
  5. Verifies the keeper public key is replaced

BSC/Polygon (Informational Only)

BSC (block 9,755,172) and Polygon (block 16,332,982) archive state at these fork blocks requires paid RPC providers (free tiers don't serve state this old). The Ethereum-side reproduction proves the vulnerability mechanism exists ΓÇö the same pattern applies to the other chains.

Reproduction Steps

Prerequisites

  • Crucible installed
  • Ethereum archive RPC endpoint
  • For full multi-chain testing: BSC + Polygon archive RPC

Steps

# 1. Configure environment
cp .env.example .env
# Edit .env with RPC endpoints

# 2. Fork Ethereum
crucible fork --topology single

# 3. Run the experiment
crucible experiment run experiments/poly_network_replay.yaml --no-baseline

# 4. Verify determinism (run twice, diff)
crucible experiment run experiments/poly_network_replay.yaml --name run-a
crucible experiment run experiments/poly_network_replay.yaml --name run-b
crucible diff <run-a-id> <run-b-id>

Expected Results

Assertion Expected Description
keeper_replaced_via_putCurEpochConPubKeyBytes ✅ Pass Keeper key replaced via hash collision
privileged_call_succeeds ✅ Pass _executeCrossChainTx dispatch succeeded
protected_assets_move ✅ Pass Token transfer authorized

Determinism Note

Poly Network reproduction across 3 chains is non-deterministic ΓÇö BSC and Polygon archive RPCs at these fork blocks may return slightly different state per run, causing storage, gas, and balance diffs between runs. This is a known RPC provider limitation, not a code bug.

Limitations

  • BSC/Polygon are informational-only ΓÇö archive RPCs at exploit blocks require paid providers
  • No off-chain keeper extraction ΓÇö the attacker's key replacement is modeled via direct impersonation
  • Multi-chain relay not simulated ΓÇö cross-chain message relay from Ethereum to BSC/Polygon is not reproduced
  • 3-chain determinism not guaranteed ΓÇö archive RPC variability across providers causes non-deterministic diffs

References