Toutes les vulnérabilités
CRITICALWeb3exploited in the wild

WEB3-POLY-NETWORK-2021

Web3 · Ethereum · Poly Network

Résumé

On August 10, 2021, an attacker exploited Poly Network's cross-chain contracts to steal about $611 million across Ethereum, BSC, and Polygon, the largest DeFi theft at the time. No keeper private keys were stolen; instead the attacker abused an access-control flaw. The EthCrossChainManager contract's verifyHeaderAndExecuteTx dispatched cross-chain calls through _executeCrossChainTx, which made an arbitrary contract call with no allowlist on target or method. The EthCrossChainData contract, which stores the bridge keeper public keys, was owned by the Manager, and its putCurEpochConPubKeyBytes setter was onlyOwner. Because Solidity derives a function selector from the first four bytes of a keccak256 hash, the attacker brute-forced the method string f1121318093, whose selector collides with putCurEpochConPubKeyBytes (0x41973cd9), and had the Manager call it as owner, replacing the entire keeper set with their own key and signing arbitrary withdrawals. The attacker, framing it as a white-hat demonstration, returned nearly all funds over about 15 days, with only about $33 million in USDT (frozen by Tether) initially outstanding.

Comment l’éviter dans votre code

  • Allowlist permitted call targets in the dispatcher; forbid calls into keeper and privileged config contracts.
  • Never make the executing manager contract the owner of the keeper/consensus data contract; separate execution from ownership.
  • Place privileged setters like putCurEpochConPubKeyBytes behind multisig or timelock governance, not a single contract's onlyOwner.
  • Validate full function selectors against an allowlist instead of trusting four-byte selectors from attacker-controlled method strings.
  • Audit every cross-contract ownership edge; assert no untrusted-input path reaches an onlyOwner mutating function.

Références

Vulnérabilités liées

Tout Web3 →