Moonbeam Network DelegateCall Vulnerability Pwning.eth
Notice: This page is a freshly imported case study from the original repository. The original content was in a different format, and may not have relevant information for all sections. Please help restructure the content by moving information from the 'About' section to other sections, and add any missing information or sources you can find. If you are new here, please read General Tutorial on Wikis or Anatomy of a Case Study for help getting started.
Notice: This page contains sources which are not attributed to any text. The unattributed sources follow the initial description. Please assist by visiting each source, reviewing the content, and placing that reference next to any text it can be used to support. Feel free to add any information that you come across which isn't present already. Sources which don't contain any relevant information can be removed. Broken links can be replaced with versions from the Internet Archive. See General Tutorial on Wikis, Anatomy of a Case Study, and/or Citing Your Sources Guide for additional information. Thanks for your help!
The Moonbeam network is a cross-chain smart contract platform that integrates functionality from various blockchains, including Ethereum, Cosmos, and Polkadot. It enables developers to create multi-chain instances of their applications with compatibility and cross-chain interoperability. A whitehat named pwning.eth discovered and reported a critical vulnerability in Moonbeam via Immunefi, demonstrating the potential for direct theft of native assets. The vulnerability, found within the Frontier Substrate pallet, could have impacted up to $100 million in funds. Moonbeam swiftly addressed the issue, preventing any user funds from being lost, and awarded pwning.eth a $1 million bounty for responsibly disclosing the bug, along with a $50,000 bonus from Moonwell.
This is a global/international case not involving a specific country.[1][2][3][4][5][6]
About Moonbeam Network
"The Moonbeam network is a smart contract platform for cross-chain connected applications that unites functionality from many blockchains including Ethereum, Cosmos, Polkadot, and more. It makes it possible for developers with Solidity or Vyper-based smart contracts to create multi-chain instances of their application that are able to communicate with each other. Moonbeam is able to unify access to users, assets, and data through: compatibility and cross-chain interoperability with many blockchains, an excellent development environment with unmatched tool support, and a modern proof-of-stake architecture built on Substrate."
"Moonbeam simplifies the developer experience by combining full Ethereum compatibility with the power of Polkadot, including scalability, cross-chain integrations, and on-chain governance."
"Moonbeam delivers complete Ethereum compatibility within a Polkadot parachain environment, so developers can continue to use the programming languages and tools they’ve grown used to — but within a fast-growing and scalable Layer 1 chain.
It is also compatible with the Substrate and Polkadot ecosystem, including block explorers, wallets, parachains, and more, allowing users the flexibility to choose the right tools and services for the job."
"Write your smart contracts in anything that compiles to Solidity bytecode, without needing to rewrite or reconfigure." "Leverage Ethereum’s broad development ecosystem by using the tools you love, like MetaMask, Hardhat, Waffle, Remix, and Truffle, in addition to Substrate-based APIs." "Built-in integrations for assets like DOT and ERC-20s and infrastructure services like Chainlink and TheGraph. Continual efforts to integrate with other Polkadot-native assets."
"On May 27th, whitehat pwning.eth submitted a missing call check critical vulnerability to the Moonbeam network via Immunefi, demonstrating the possibility of a direct theft of the native assets, such as Moonriver (MOVR) and Moonbeam (GLMR), which were deployed using pre-compiled contracts. The Moonbeam team estimated that the vulnerability could have impacted up to $100m in funds, which was prevented due to the whitehat’s swift disclosure.
The security vulnerability was found within Frontier — the Substrate pallet that provides core Ethereum compatibility features within the Polkadot ecosystem, which Moonbeam helped create."
"In Ethereum, there are three major types of contract calls: regular CALL, STATICCALL, and DELEGATECALL.
When contract A makes a CALL to contract B by calling foo(), the function execution relies on contract B’s storage, and the msg.sender is set to contract A.
This is because contract A called the function foo(), so that the msg.sender would be contract A’s address and msg.value would be the ETH sent along with that function call. Changes made to state during that function call can only affect contract B."
"However, when the same call is made using DELEGATECALL, the function foo() would be called on contract B but in the context of contract A. This means that the logic of contract B would be used, but any state changes made by the function foo() would affect the storage of contract A. msg.sender would point to the EOA who made the call in the first place. And what is important in the case of the Moonbeam bug, msg.value would point to the first call context, not the second. In other words, Ether is not sent along delegatecall. (See example 2)."
"[T]here was no logic present under the Moonbeam pre-compiled contract to determine if the incoming call is DELEGATECALL or a static CALL in EVM."
"[T]hanks to the whitehat’s work, no user funds were lost, and Moonbeam quickly released an upgrade that patched the vulnerability.
The whitehat was awarded $1 million for his find, the max critical bounty from Moonbeam’s bug bounty program on Immunefi. Moonwell added a $50k bonus as well, making pwning.eth’s total winnings $1,050,000."
"The third custom-designed whitehat card was minted to whitehat pwning.eth on September 19, 2022, to recogize his critical bug find in Moonbeam, for which he received a $1 million payment and an additional contribution of $50,000 from Moonwell. You can read more details about how he responsibly disclosed that bug here."
The whitehat card legend for the pwning.eth Moonbeam card, left to right:
Bow: Well-written PoC Lightning: Rare/complex type of exploit Impact of Attack: 7 Ease of Defense: 5"
This is a global/international case not involving a specific country.
The background of the exchange platform, service, or individuals involved, as it would have been seen or understood at the time of the events.
Include:
- Known history of when and how the service was started.
- What problems does the company or service claim to solve?
- What marketing materials were used by the firm or business?
- Audits performed, and excerpts that may have been included.
- Business registration documents shown (fake or legitimate).
- How were people recruited to participate?
- Public warnings and announcements prior to the event.
Don't Include:
- Any wording which directly states or implies that the business is/was illegitimate, or that a vulnerability existed.
- Anything that wasn't reasonably knowable at the time of the event.
There could be more than one section here. If the same platform is involved with multiple incidents, then it can be linked to a main article page.
The Reality
This sections is included if a case involved deception or information that was unknown at the time. Examples include:
- When the service was actually started (if different than the "official story").
- Who actually ran a service and their own personal history.
- How the service was structured behind the scenes. (For example, there was no "trading bot".)
- Details of what audits reported and how vulnerabilities were missed during auditing.
What Happened
The specific events of the loss and how it came about. What actually happened to cause the loss and some of the events leading up to it.
| Date | Event | Description |
|---|---|---|
| May 27th, 2022 | Vulnerability Report | The vulnerability was reported to the Immunify Bug Bounty program. |
| July 28th, 2022 5:23:34 AM MDT | Bugfix Review Published | Imumify first publishes a bugfix review for the vulnerability. |
| September 19th, 2022 3:35:23 AM MDT | Pwning.eth Trading Card NFT | Pwning.eth is issued a trading card NFT as recognition for his contribution by Immunefy. |
Technical Details
This section includes specific detailed technical analysis of any security breaches which happened. What specific software vulnerabilities contributed to the problem and how were they exploited?
Total Amount Lost
The total amount at risk has been estimated at $100,000,000 USD. No funds were lost.
How much was lost and how was it calculated? If there are conflicting reports, which are accurate and where does the discrepancy lie?
Immediate Reactions
How did the various parties involved (firm, platform, management, and/or affected individual(s)) deal with the events? Were services shut down? Were announcements made? Were groups formed?
Ultimate Outcome
What was the end result? Was any investigation done? Were any individuals prosecuted? Was there a lawsuit? Was any tracing done?
A bounty of $10,050,000 USD was paid for the discovery.
Total Amount Recovered
There do not appear to have been any funds recovered in this case.
What funds were recovered? What funds were reimbursed for those affected users?
Ongoing Developments
What parts of this case are still remaining to be concluded?
Individual Prevention Policies
No specific policies for individual prevention have yet been identified in this case.
For the full list of how to protect your funds as an individual, check our Prevention Policies for Individuals guide.
Platform Prevention Policies
Policies for platforms to take to prevent this situation have not yet been selected in this case.
For the full list of how to protect your funds as a financial service, check our Prevention Policies for Platforms guide.
Regulatory Prevention Policies
No specific regulatory policies have yet been identified in this case.
For the full list of regulatory policies that can prevent loss, check our Prevention Policies for Regulators guide.
References
- ↑ Immunefi - Whitehat Hall of Fame (Jan 10, 2023)
- ↑ https://opensea.io/assets/ethereum/0xdbe4e52b12790670f9f9152d775bab806a08795d/3 (Nov 15, 2023)
- ↑ Moonbeam Missing Call Check Bugfix Review (Nov 16, 2023)
- ↑ Moonbeam | Cross-Chain Connected Smart Contract Platform (Nov 16, 2023)
- ↑ Moonbeam Network - Solidity Smart Contracts on Polkadot (Nov 16, 2023)
- ↑ Ethereum Transaction Hash (Txhash) Details | Etherscan (Nov 16, 2023)