📖 Check out this academic examination of a potential DeFi crisis written by researchers from the Imperial College London🇬🇧 arxiv.org/pdf/2002.08099…
20 page research paper too long? Here's a TLDR
- DeFi's complex and intertwined nature puts it at risk of meltdown
- flash loans could "allow an attacker to steal the Maker collateral within just two transactions and without the need to lock any tokens"
- damages could range from $145M to in excess of $246M
- Blockchain sought to remedy mistrust created by 2007-08 financial collapse
- DeFi requires large deposits to guard against 1) misbehavior and 2) black swan-like drops in asset value
- interconnected nature of DeFi creates "possibility of financial contagion."
- Formal modeling of DeFi protocols
- Stress-testing of DeFi
- Maker attack
- DeFi contagion
Note: the paper's results were shared in Feb 2020 with @MakerDAO team agreed with findings
Section 2 defines many concepts re: blockchains and DeFi
- price volatility
- liquidity constraints
- need for overcollateralization
- the ability of protocols like Maker to print MKR as last resort
- counterpart risks such as governance mechanisms
- at the start of the sell-off, it's possible to sell 30,000
ETH/day w/o having an impact on price
- the amount of protocol reserve asset is fixed at 1m units
- debt levels range from $100m to $400m,
seeking to approx reflect the levels of capital
escrowed in DeFi
- Regardless of liquidity, collateral margin does
not become negative for systems w/ $100M Debt
- At higher levels of debt, margin gets closer to 0
- And once over $400M debt the protocol becomes undercollateralized
- less reserve asset correlation bolsters margin
Vice versa, it also shows for a given liquidity parameter, the more system debt there is, the more quickly the margin will become negative."
Governance Security Module - a time delay before elected contracts take control (currently set to 0)
and
Emergency Shut Down - an action which halts Maker but requires a constant pool of 50k MKR tokens, worth +30M USD
- "An adversarial executive contract can steal the Maker collateral and mint new MKR tokens. Those can then be traded until the MKR price crashes and effectively destroy the Maker system"
- adversary will only execute the attack if they profit
1) Crowdfunding - A dark pool of MKR could be used bribed to facilitate the attack
2) Liquidity pools and flash loans - using undercollateralized flash protocols like @AaveAave potentially without having to lock up tokens
When a contract becomes the executive contract, the staked amount is distributed almost equally briefly between contracts, reducing the tokens required by more than 50%.
Inspecting the amount of MKR transferred between Jan 1, 2020 and Feb 8, 2020 the average was ~9k MKR per day, a rate at which researchers determine an attacker could accumulate enough MKR to perform such an attack in a timely manner.
Attackers would likely hide large accumulation by spreading the MKR across many addresses to avoid suspicion
#1: Attacker fills block #1 with necessary votes
#2: "In the second block, the attacker can finish voting for his malicious contract and execute the attack from the contract, which would leave only one block to react"
Flash loans make it so the attacker doesn't need to amass the 50k MKR
The attacker could perform the attack as detailed below within 2 transactions utilizing flash loans from @AaveAave
At the time, the attacker could have acquired the necessary 50k MKR tokens from three different DEXs (Uniswap, Kyber, and Switcheo) by borrowing 378,940 ETH from Aave's lending pool.
At that assumed linear rate, it would take ~1,663 days for the pool to be large enough to execute the attack without owning any tokens.
Also, if DEX liquidity increased, the attacker could acquire the ETH at cheaper rates and would need to borrow less.
With $20 worth of gas, "the attackers can take away
the currently 434,873 ETH in collateral in MakerDAO
plus the 145m DAI. This amounts to a net profit of
$263M" which could be split evenly among attackers.
The attacker pays gas and repays 378,940 ETH loan plus 0.35% interest
"by the end of the attack, the attacker
has around 55k ETH, 50k MKR, and 145m DAI. This
amounts to a net profit of $191M"
+The TX reverts if it's unprofitable
- both price drops and governance attacks can result in an debt assets becoming undercollateralized affecting other protocols
- Other assets can then become undercollateralized when their underlying collateral becomes undercollateralized
"A special sub-case occurs in
the governance attack scenario where the attacker can
additionally mint an unlimited supply of the debt asset
to buy up all the available liquidity of other assets."
As rational actors exit their over-collateralized positions, the effects spread across other DeFi lending protocols.
A larger enough DeFi crisis could spread across other blockchains and even centrally-back assets like USDT, assets which viewed as uncorrelated
Kudos to the researchers for such a thorough analysis!
Luckily, Maker's GSM now has a 24hr delay. 😅
It's important we recognize future risks and attempt to mitigate as a community.
Thanks for reading! And please retweet for reach!!