Immunefi
Published in

Immunefi

Polygon Consensus Bypass Bugfix Review

Summary

Intro to the Consensus Mechanism

  • proof-of-work (PoW)
  • proof-of-stake (PoS)

Vulnerability Analysis:

  • validatorState.amount — The total number of tokens staked by the validators. In other words, it represents the total staking power.
  • validatorState.stakerCount — Represents the total number of stakers in the contract.

Steps to Reproduce

  1. Create a new validator using the stakeFor function.
  2. Call the buyVoucher function with a big delegated amount to buy the shares of the validators by staking tokens.
  1. Catch an available validator slot via an on-chain auction process which happens at regular intervals.
  2. Migrate staking tokens into that validator by calling a migrateDelegation function.
  3. Unstake the validator. (validatorState.amount is decreased again)
  4. Wait for a checkpoint (for this validator slot to open)

Vulnerability Fix

Acknowledgments

--

--

Immunefi is the premier bug bounty platform for smart contracts and DeFi projects, where security researchers review code, disclose vulnerabilities, get paid, and make crypto safer. Immunefi removes security risk through bug bounties and comprehensive security services.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Immunefi

Immunefi is the premier bug bounty platform for smart contracts, where hackers review code, disclose vulnerabilities, get paid, and make crypto safer.