in

Ok here’s how the Poly Network hack actually worked. If I’m reading the contracts correctly, it’s pretty genius.

Poly has this contract called the “EthCrossChainManager”. It’s basically a privileged contract that has the right to trigger messages from another chain. It’s a pretty standard thing for cross-chain projects.

There’s this function verifyHeaderAndExecuteTx that anyone can call to execute a cross-chain transaction. Basically it (1) verifies that the block header is correct by checking signatures (seems the other chain was a poa sidechain or something) and then (2) checks that the transaction was included within that block with a Merkle proof. Here’s the code, it’s pretty simple

[https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/logic/EthCrossChainManager.sol#L127](https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/logic/EthCrossChainManager.sol#L127)

The basic mechanism used here is:

Deposit your assets into a “lock box” on one blockchain.

Some representation of those assets magically appear on the other blockchain.

The “lock box” will only ever release assets if it gets a message from a corresponding “lock box” on another blockchain basically asking it to “please give this user some funds”.

The “lock box” authenticates this message from the other blockchain by checking that it’s been signed by a group of people that Poly called “bookkeepers”.

The hacker figured out how to override the list of bookkeepers so that the hacker was now the /only/ bookkeeper.

This made it possible for the attacker to forge messages from the “lock box” on the other chain. The “lock box” on Ethereum suddenly got a message that said “please give the hacker all of the money”. It checked the signature attached to that message and it matched the bookkeeper!

But of course it matched the bookkeeper, the bookkeeper was the hacker now!

Src: [https://twitter.com/kelvinfichter/status/1425217046636371969](https://twitter.com/kelvinfichter/status/1425217046636371969)

What do you think?

10 Points
Upvote Downvote

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

8 Comments

🏈 [GLB] | Next-Gen Betting Utility Token – Newly launched and low mcap | LQ Lock + Dev Lock – Join the future of betting through crypto 🥇

Tilray (TLRY) DD