  The Global Financial Crisis of 2008, caused by the accumulation of excessive
financial risk, inspired Satoshi Nakamoto to create Bitcoin. Now, more than ten
years later, Decentralized Finance (DeFi), a peer-to-peer financial paradigm
which leverages blockchain-based smart contracts to ensure its integrity and
security, contains over 702m USD of capital as of April 15th, 2020. As this
ecosystem develops, it is at risk of the very sort of financial meltdown it is
supposed to be preventing. In this paper we explore how design weaknesses and
price fluctuations in DeFi protocols could lead to a DeFi crisis. We focus on
DeFi lending protocols as they currently constitute most of the DeFi ecosystem
with a 76% market share by capital as of April 15th, 2020.
  First, we demonstrate the feasibility of attacking Maker's governance design
to take full control of the protocol, the largest DeFi protocol by market
share, which would have allowed the theft of 0.5bn USD of collateral and the
minting of an unlimited supply of DAI tokens. In doing so, we present a novel
strategy utilizing so-called flash loans that would have in principle allowed
the execution of the governance attack in just two transactions and without the
need to lock any assets. Approximately two weeks after we disclosed the attack
details, Maker modified the governance parameters mitigating the attack
vectors. Second, we turn to a central component of financial risk in DeFi
lending protocols. Inspired by stress-testing as performed by central banks, we
develop a stress-testing framework for a stylized DeFi lending protocol,
focusing our attention on the impact of a drying-up of liquidity on protocol
solvency. Based on our parameters, we find that with sufficiently illiquidity a
lending protocol with a total debt of 400m USD could become undercollateralized
within 19 days.
