In brief

  • There is a potential exploit regarding the Dai stablecoin.
  • It involves the concept of flash loans.
  • It should get fixed tomorrow at noon.

A potential exploit in the decentralized finance (DeFi) ecosystem has been exposed and it won’t be fixed until noon on Friday. The reveal comes just days after two exploits used DeFi tools to take home $1 million.

Dominik Harz, a PhD candidate at Imperial College London, has posted a Medium post detailing the potential weakness. It’s focused on the concept of flash loans and the stablecoin Dai. While he has notified Maker—which runs Dai—the issue won’t go up for a vote until tomorrow. And in the meantime, $700 million is at risk.

“That attacker would be able to steal $700m worth of ETH collateral and be able to print new Dai at will,” Harz wrote. “This attack would spread throughout the whole DeFi space as Dai is used as backing collateral in other protocols.”

What is a flash loan?

A flash loan is a new—and risky—concept in DeFi. It’s essentially the act of lending out money, without asking for anything held as collateral in case the loan is defaulted upon. The only reason that they exist is that the loan gets paid back, in the same transaction. This is possible because on Ethereum—the blockchain platform in question—transactions can be made up of multiple components.

So, in the case of the first DeFi exploit the other day, the trader made one big transaction that triggered a bunch of actions across various DeFi protocols. Within the transaction, they made a flash loan, used the money for nefarious goals, profited $350 million, and returned the loan. The lender is safe because they know that—due to the power of the blockchain—if the money doesn’t come back, the transaction is (kind of) reversed so it never happened in the first place. Either way, they keep their money.

The $700 million attack vector

Now, here’s how Harz argues that flash loans could be used to exploit Maker.

MakerDAO is a decentralized governance system that runs the Dai stablecoin. Holders of the governance token MKR vote on how Dai should be programmed. But it’s possible to exploit the governance system.

“The basic idea is to accumulate enough MKR tokens to replace the existing governance contract with the attacker’s, malicious, governance contract,” Harz said. “The malicious governance contract is then able to give the attacker full control over the system and withdraw any collateral in the system as well as create arbitrary amounts of new Dai.”

However, when this attack vector was suggested before, the idea was to crowdfund the MKR tokens needed to carry it out. And that’s where flash loans come in. They make it much easier for an attacker to build up a large supply of MKR tokens—and use them to take over the system.

Not only can they use a flash loan to buy a large amount of MKR, but they can also use flash loans to manipulate the price of MKR—in the same way as the recent DeFi attacks. With a cheaper MKR price, it becomes much easier to snap up more coins.

Harz said that this strategy could be used in combination with a crowdsourcing strategy for maximum effect at a low cost. Maker is set to vote on a solution to stop flash loans from affecting the governance mechanism tomorrow—but the clock is ticking.