In the latest DeFi hack, stablecoin stabilizing protocol Pickle Finance was exploited on 21-11-2020 06:37 PM (UTC) for nearly $20M. It is notable because analysts are terming it as the most complex DeFi exploit ever, as pDAI jar was hacked with skill-full mastery. The system was gamed using multiple flaws, including Jar swap and Jar convert logic in an extremely sophisticated code execution.
Following the attack, users were advised to withdraw funds from Pickle Jars and wait for the next updates. The team has now confirmed that the attack has been reverse engineered and relevant system modules have been patched to defend against this attack vector, in the future.
Banteg Reveals Details Of The Attack
Yearn.Finance developer Banteg was one of the white hat hackers assisting the team with the investigation and fixed. He has since then posted a detailed explanation of the attack. It is every evident that the hacker (s) had a deep understanding of the smart contract logic and execution. The following information was taken from the Github entry.
- Deploy two Evil Jars
- Get the amount available to withdraw from StrategyCmpdDaiV2
- Invoke
ControllerV4.swapExactJarForJar()
passing the Evil Jars and the amount retrieved in the previous step. -
ControllerV4.swapExactJarForJar()
doesn’t check the Jars and calls them, withdrawing fromStrategyCmpDAIV2
usingStrategyCmpDAIV2.withdrawForSwap()
which ultimately usesStrategyCmpDAIV2.deleverageToMin()
. This transfers 19M DAI to pDAI. - Call
pDAI.earn()
3 times. This invokes a Compound deposit viaStrategyCmpDAIV2.deposit()
, leading to the contract receiving cDAI.StrategyCmpdDAIV2
now has an equivalent of 19M in cDAI. - Deploy 3 more evil contracts, the first one being the equivalent of FakeUnderlying in our replicated exploit and the other two Evil Jars.
- Invoke
ControllerV4.swapExactJarForJar()
passing the Evil Jars, no amount and aCurveProxyLogic
as target with a crafted data which allowed an injection to call the equivalentFakeUnderlying
. -
ControllerV4
delegate callsCurveProxyLogic.add_liquidity()
passingStrategyCmpDAIV2
and a crafted signature which leads to withdrawal of cDAI and transferring them toControllerV4
. - The funds (in cDAI) are now in the Controller, it calls the
EvilJar.deposit()
which transfer the funds to the attacker smart contract. - The attacker smart contract redeems cDAI for DAI from Compound and transfers DAI to the attacker EOA.
Implications For DeFi Protocols Design And Security
DeFi protocols are generally famous for “move fast and break things” ethos. The developer teams in this space are known to experiment with code and deploy unaudited code without much protection. Lately, this has resulted in massive fund losses, no doubt largely borne by the users. Even if the code is audited even by multiple teams, there is no guarantee that it’s 100% secure.
DeFi teams need to apply a multi-disciplinary strategy, bringing together elements of finance, game theory, tokenomics, smart contract design and logic. They also need to make certain that going forward relevant safeguards are present to enforce limits and insurance has been acquired, in order to protect against such exploits.
It is super easy to buy Bitcoin. Just take a look at our exchange comparison!
Follow us on Social Media and subscribe to our free crypto newsletter!
@Telegram
@Instagram
@Twitter
@TikTok
@Facebook
Diskutiere mit uns!
This post may contain promotional links that help us fund the site. When you click on the links, we receive a commission - but the prices do not change for you! :)
Disclaimer: The authors of this website may have invested in crypto currencies themselves. They are not financial advisors and only express their opinions. Anyone considering investing in crypto currencies should be well informed about these high-risk assets.
Trading with financial products, especially with CFDs involves a high level of risk and is therefore not suitable for security-conscious investors. CFDs are complex instruments and carry a high risk of losing money quickly through leverage. Be aware that most private Investors lose money, if they decide to trade CFDs. Any type of trading and speculation in financial products that can produce an unusually high return is also associated with increased risk to lose money. Note that past gains are no guarantee of positive results in the future.
More from Blockchain
Ethereum Nears ATH As CME Futures Approach, Here’s What Follows!
In a long awaited event, Ethereum is finally nearing it's previous all time high (ATH) figure of $1448 (CoinGecko data) …
What Is DeFi? – A Beginner’s Guide To 5 Core DeFi Protocols
Decentralized Finance (DeFi) protocols have come a long way from a few scattered vaguely known projects to multi-billion giants. …
Biden to Nominate Ex-MIT Blockchain Professor, Gary Gensler as Chairman of SEC
As Trump finally concedes to Biden’s presidential win, Biden begins to enact his policies and nominate the future leaders of …