Skip to content
Smart contracts Write-up Advanced

Polygon PoS

A type confusion flaw in Heimdall's log parsing allowed a rogue validator to fake a stake update and inflate their voting power, potentially taking over the consensus layer and injecting fraudulent state-sync events to steal over $2B from the Polygon PoS bridge.

asymmetric.re

Published on asymmetric.re

In this blog post, we describe a vulnerability in Heimdall, the validator software of the Polygon Proof-of-Stake (PoS) blockchain. This flaw, if exploited, could have allowed a rogue or compromised validator to take over the Heimdall consensus layer and inject fraudulent events into the StakeSync mechanism, a critical…

The author, on asymmetric.re

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the UnpackLog function did not verify the event signature (first topic) before decoding, allowing a SignerChange event to be misinterpreted as a StakeUpdate event.

Impact

A rogue validator could take over Heimdall consensus and inject fake state-sync events, potentially stealing all tokens locked in the Polygon PoS bridge (roughly $2B at the time), though the attack requires significant resources and the smart contracts on Ethereum still track true voting power.

What the attacker needed

Be a validator or compromise one; spend $50k-$100k on address generation; wait for signer change cooldown

How it was found

  1. Bruteforce an Ethereum address with a suffix of 0000000000000XXX where the last three digits are larger than the validator's current nonce.
  2. Change the signing key of the validator to this address by invoking updateSigner and wait for the cooldown period.
  3. Increase the nonce of the validator until nonce+1 equals XXX by changing stake directly or through delegations.
  4. Perform a signer change to a new address under control and use the generated event to process a fake MsgStakeUpdate.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Heimdall is the validator software for Polygon's proof-of-stake chain. It checks events from Ethereum but failed to verify the event type, so a validator could pretend a different event was a stake increase. This let them gain huge voting power and fake deposits to steal bridge funds.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.