The Really Stupid “Smart Contract” Bug Allowed Hackers To Steal $ 31 Million In Digital Currencies


Close-up photo of the manually operated touch screen.

Blockchain startup MonoX Finance said Wednesday that a hacker stole $ 31 million by exploiting a bug in the software that the service uses to write smart contracts.

The company uses a decentralized finance protocol known as MonoX that allows users to trade digital currency tokens without some of the requirements of traditional exchanges. “Project owners can list their tokens without the burden of capital requirements and focus on using funds to build the project instead of providing liquidity,” representatives of MonoX company say here. “It works by grouping deposited tokens into a virtual pair with vCASH, to provide a single token pool design.”

An accounting bug built into the company’s software allowed an attacker to inflate the price of the MONO token and then use it to withdraw all other deposited tokens, MonoX Finance revealed in a post. The loot amounted to $ 31 million in tokens on the Ethereum or Polygon blockchains, both of which are compatible with the MonoX protocol.

Specifically, the hack used the same token as tokenIn and tokenOut, which are methods of exchanging the value of one token for another. MonoX updates the prices after each exchange by calculating new prices for both tokens. When the exchange is complete, the price of tokenIn, that is, the token sent by the user, decreases and the price of tokenOut, or the token received by the user, increases.

Using the same token for tokenIn and tokenOut, the hacker greatly inflated the MONO token price because the tokenOut update overwritten the tokenIn price update. The hacker then traded the token for $ 31 million worth of tokens on the Ethereum and Polygon blockchains.

There is no practical reason to exchange a token for the same token, and therefore the trading software should never have allowed such transactions. Unfortunately it did, even though MonoX received three security audits this year.

The pitfalls of smart contracts

“These types of attacks are common in smart contracts because many developers do not do the field work to define the security properties of their code,” Dan Guido, an expert in obtaining smart contracts like the one hacked here. “They had audits, but if the audits only indicate that a smart person looked at the code for a certain period of time, then the results are of limited value. Smart contracts need verifiable evidence that they do what you intend and only what you intend. That means defined security properties and techniques used to evaluate them. “

The CEO of security consultancy Trail of Bits, Guido continued:

Most software requires vulnerability mitigation. We proactively look for vulnerabilities, recognize that they can be unsafe as we use them, and create systems to detect when they are exploited. Smart contracts require the elimination of vulnerabilities. Software verification techniques are widely used to provide demonstrable assurance that contracts are performing as intended. Most security issues in smart contracts arise when developers take the first approach to security, rather than the second. There are many large, complex, and highly valuable smart contracts and protocols that have prevented incidents, along with many that have been exploited instantly since launch.

Blockchain researcher Igor Igamberdiev took to Twitter to break down the composition of the drained chips. The tokens included $ 18.2 million in Wrapped Ethereum, $ 10.5 in MATIC tokens, and $ 2 million in WBTC. The loot also included smaller amounts of tokens for wrapped Bitcoin, Chainlink, Unit Protocol, Aavegotchi, and Immutable X.

Just the latest DeFi hack

MonoX is not the only decentralized finance protocol to have been the victim of a multi-million dollar hack. In October, Indexed Finance said lost about $ 16 million on a hack that took advantage of the way it rebalances the index clusters. Earlier this month, blockchain analytics firm Elliptic said so-called DeFi protocols have lost $ 12 billion to date due to theft and fraud. Losses in the first 10 or so months of this year reached $ 10.5 billion, up from $ 1.5 billion in 2020.

“The relative immaturity of the underlying technology has allowed hackers to steal user funds, while deep pools of liquidity have allowed criminals to launder proceeds of crimes such as ransomware and fraud,” states the Elliptic report. “This is part of a broader trend in the exploitation of decentralized technologies for illicit purposes, which Elliptic refers to as DeCrime.”

The MonoX post on Wednesday said that, on the final day, team members took the following steps:

  • I tried to contact the attacker to open a dialogue by sending a message through a transaction on ETH Mainnet
  • It stopped the contract and will implement a solution to undergo more rigorous testing. After putting together a suitable compensation plan, we will work on resuming the hiatus after our security partners have given the go-ahead.
  • Large exchanges were contacted to monitor and possibly stop any wallet addresses linked to the attack
  • Collaborate with our security advisors to advance the identification of the hacker and how to mitigate future risk
  • Cross-referenced Tornado Cash wallet interactions with wallets that also used our platform
  • Any metadata left by front-end interactions with our Dapp was searched
  • Detailed and mapped wallet addresses that could be considered ‘suspicious’ based on your interaction with our product. For example, withdrawing a large amount of liquidity before the exploit
  • Continuous monitoring of the wallet with the funds. So far, 100 ETH has been sent to Tornado Cash from the stolen funds. The rest is still there.
  • In addition, we will file a formal police report.

The publication said that MonoX Finance has insurance that will cover losses worth $ 1 million and that the company is now “working on distributions.”




arstechnica.com

Leave a Reply

Your email address will not be published.