Arbs Exploit DeFi to Make $900k in Seconds; Provoke Soul-Searching in the Process

The bZx exploits over the long weekend in the US were the first major attacks in decentralized finance.

Hello Defiers! Today’s issue will be dedicated to the bZx exploits, the first major “attacks” in DeFi. You’ll see why attacks is in quotation marks. And also why questions on whether DeFi is sufficiently decentralized, and on the potential points of failure posed by price oracles, were raised as a result. There’s a lot to unpack.

Exploits Yield $900k and Raise Questions of “De” in DeFi

DeFi may supercharge finance, but it also supercharges financial attacks.

In the last four days, the bZx DeFi trading protocol was exploited twice; the first attack was executed over Valentine’s Day and yielded ~1,271 ETH, while the second one was just last night and made ~2,378 ETH. That’s about $320,000 and $600,000, respectively, with ETH at $250.

Simplifying greatly, both traders took out so-called flash loans, which require no collateral, used part of the funds to open long or short positions on an asset, and another portion of the borrowed funds to buy crypto in illiquid markets and push up prices in a way that benefited their long or short position.

These exploits used five DeFi protocols in the first case, four in the second. They were both done within a single Ethereum transaction of about 15 seconds each, and cost $8.21 in network fees in the first case, and $110 in the second case. No additional capital was needed.

Here’s How They Did It

Legos Have Two Faces

There are a few remarkable things to say about these attacks. The first is they highlight the sheer power of composable financial products, or so-called “money legos.” Traders were able to pull off these exploits because the system is so seamlessly interconnected.

A loan from one lending platform is used to open a 5x short on another trading platform. One exchange grabs liquidity from a second provider. Prices on one place impacts contracts in another. This can be used to make faster, cheaper, and more innovative financial products. But the increased complexity also increases potential attacks, and makes the system harder to protect. It will be a learning curve as builders shield from and prevent these attacks.

Blame Game

There’s plenty of blame going around. There’s the argument that flash loans and composability are dangerous tools, ripe for abuse.

In the case of the first exploit, there’s the issue of the bZx code bug which allowed the hacker to take out a 5x short position which became heavily undercollateralized after the trade was executed. The system shouldn’t have allowed it, but because of an error in the code’s logic, it did.

bZx uses market prices from decentralized exchange Kyber Network. Many, including Uniswap founder Hayden Adams in an interview, have pointed out that using current market prices, as opposed to solutions like time-weighted averages, is risky.

While bZx co-founders Kyle Kistner and Tom Bean said in an interview the system’s price source didn’t have an impact in the first exploit, a tweet from bZx’s account said oracle manipulation caused the second attack. They plan to implement Chainlink oracles as a supplement to Kyber’s price feed. To note, Ethereum creator Vitalik Buterin said today in a tweet Uniswap’s planned version 2 would have been resistant to these attacks.

And while it might seem obvious to blame the perpetrators, even that isn’t so clear. One take is that they simply knew how to use DeFi money legos in the right way and took advantage of a juicy arbitrage opportunity. Another take is that it was in fact an attack, as the trader exploited a bug in the bZx system, which allowed them to abuse the protocol.

Damage Control

The bZx team found a way to effectively “pause” some functionality on the protocol to mitigate the damage after both exploits. This is even as the system is designed so that state changes can only be pushed through after a 12-hour buffer, meant to alert users in case managers are manipulating the protocol maliciously.

But after the first exploit, they delisted whitelisted tokens on their oracle token registry, which stopped trading and borrowing, as this action wasn’t not protected by the timelock. Lending was not affected.

Additionally, to prevent any realized losses after the first exploit, bZx will use the collateral the attacker left in the protocol to continue servicing the defaulted loan —under bZx’s assumptions, the collateral could keep paying interest for over 200 years. The loan is undercollateralized though, and in most cases, it would be liquidated and losses would be realized, impacting lenders in the protocol. In this case, it hasn’t been liquidated thanks to a safeguard which allows governance to handle extraordinary situations where a margin call would deplete the system’s entire insurance fund.

“By the rules of the protocol, because their liabilities exceed their assets, their funds are fair game to confiscate without any moral ambiguity,” the bZx team said in a post last night.

bZx said it will also “delay the realization of the loss,” on the second attack. Details haven’t been disclosed yet.

bZx argues that, while they found a way to pause trading and decided to confiscate the attackers’ collateral, it was in the interest of their users. The team argues that a decentralized governance system, such as a DAO, would have made the same decision.

The “De” in DeFi

Critics say a DeFi platform which can be paused by its management team at will, isn’t decentralized at all. Litecoin founder Charlie Lee said, “most DeFi can be shut down by a centralized party, so it's just decentralization theatre.”

So, is DeFi fully decentralized today? The answer is no. DeFi teams have varying degrees of control over their platforms, with safeguards such as bZx’s time buffer and the requirement for more than one party to approve changes. A small number of projects have no ability to take unilateral control at all.

That said, users are still in far greater control of their funds and information than in traditional finance and centralized crypto exchanges. bZx could pause trading, but they couldn’t take complete control of the system. That’s a stark difference from centralized crypto exchanges, where users need to have completely trust management to not run off with their funds —which has happened.

Another difference is transparency. In DeFi, users can verify exactly where their funds are and how it can be used, as most platforms’ code is open. Its’ why analysts were able to dissect how the bZx hack happened minutes after it was done.

Granted, it’s also why traders were able to find the exploit in the first place. Still, more composability, transparency, with less third party intervention and control, will result in a net positive for the system. These are growing pains which ultimately make the system stronger.

The Defiant is a daily newsletter focusing on decentralized finance, a new financial system that’s being built on top of open blockchains. The space is evolving at breakneck speed and revolutionizing tech and money. Sign up to learn more and keep up on the latest, most interesting developments. Subscribers get full access at $10/month or $100/year, while free signups get only part of the content.

Click here to pay with DAI.There’s a limited amount of OG Memberships at 70 Dai per annual subscription ($100/yr normal price).

About the author: I’m Camila Russo, a financial journalist writing a book on Ethereum with Harper Collins. (Pre-order The Infinite Machine here). I was previously at Bloomberg News in New York, Madrid and Buenos Aires covering markets. I’ve extensively covered crypto and finance, and now I’m diving into DeFi, the intersection of the two.