Categories: CryptoTrading

The $15m Eminence Defi Attack Explained

Early morning on Tuesday 29 September an arber/hacker found an exploit with the brand new Eminence (EMN) system that allowed them to do a flash loan and arb out $15m profit. In this post, I will go over exactly how they did it.

The arb was split over three identical transactions. We will just look at one which you can view on etherscan here.

Note: I will use attack and arb during this post rather than hack because it is not dissimilar to many other arbs that happen every day. What makes this one ‘worse’ is that it drained most of the pool leaving the victims with nothing.

The Logic

The way EMN works is that it is a Continuous Erc20 Token with an unlimited supply. You mint EMN by sending DAI to the smart contract and getting EMN in exchange. The more you buy the more expensive it gets as EMN calculates its price by an equation based on two inputs: the total supply in the world of EMN and the DAI it is holding.

Let’s go over that again. When you mint EMNS, it calculates the ratio of DAI it holds to the ratio of EMNS in the world to give you a price.

This concept works fine provided that the only way to increase or reduce the global supply of EMNS is through the buy or sell function directly within the main contract which also changes the balance of DAI. Unfortunately this is not the case with EMN.

You can also reduce the global supply of EMN by minting an eminence currency. In the transaction above the attacker used eAAVE. When you mint eAAVE you destroy EMN, reducing the global supply. But you don’t reduce the amount of DAI held by the EMN contract. Therefore falsely increasing the price of EMN.

The attacker did this:

Here is how it looks in etherscan:

The attacker repeated this transaction three times, netting over $15m.

On a slightly happier note he later returned $8m.

How The Arber Could Have Made More Money

The arb was actually sub-optimal because of the way they used flash loans. The attacker used Uniswap which charges a little over 0.3% of the total value borrowed in fees. In the transaction list, you can see that he paid back 15,045,255 DAI. 45,255 DAI more than he borrowed. Over the three transactions, the attacker spent over $135k on Uniswap fees.

DyDx is another place you could use for a flash loan and charges no fees. The attacker probably didn’t use it because it does not have $15m of DAI available and they would have had to borrow ETH, which would have added an extra step to using Compound to convert it to DAI. Maybe they were in a rush to do the arb worried someone else would find the vulnerability.

Sam Priestley

Disqus Comments Loading...
Share
Published by
Sam Priestley

Recent Posts

  • Crypto
  • Trading

MEV And The Evolution Of Frontrunning On Ethereum

The financial game Half-Rekt (NME) is a very interesting study for anyone interested in arbitrage or front running in the…

4 years ago
  • About Me
  • Income Reports

My Monthly Report – October 2020

Another two months since my last report and a lot has changed once again. September was the most profitable month…

4 years ago
  • About Me
  • Income Reports

My Monthly Report – August 2020

Another two months since my last report and perhaps the two busiest and most profitable months in my life. Which…

4 years ago
  • Crypto
  • How-To
  • Trading

How Crypto Flashloans & Flashswaps Work

The coolest innovation in the past year in crypto and defi are flash loans. Flash loans allow you to borrow…

4 years ago
  • About Me
  • Income Reports

My Monthly Report – June 2020

It has been another two months since my last report and a lot of time has happened since then. The…

4 years ago
  • Crypto
  • How-To
  • Trading

The Birth Of Yield Farming – COMP & BAL Farming Explained

In March I launched a proprietary fund to trade on cryptocurrency believing that the opportunities I found as a professional…

4 years ago