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
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 from
StrategyCmpDAIV2.withdrawForSwap()which ultimately uses
StrategyCmpDAIV2.deleverageToMin(). This transfers 19M DAI to pDAI.
pDAI.earn()3 times. This invokes a Compound deposit via
StrategyCmpDAIV2.deposit(), leading to the contract receiving cDAI.
StrategyCmpdDAIV2now 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.
ControllerV4.swapExactJarForJar()passing the Evil Jars, no amount and a
CurveProxyLogicas target with a crafted data which allowed an injection to call the equivalent
StrategyCmpDAIV2and a crafted signature which leads to withdrawal of cDAI and transferring them to
- 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.
Follow us on Social Media and subscribe to our free crypto newsletter!
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
In a long awaited event, Ethereum is finally nearing it's previous all time high (ATH) figure of $1448 (CoinGecko data) …
Decentralized Finance (DeFi) protocols have come a long way from a few scattered vaguely known projects to multi-billion giants. …
As Trump finally concedes to Biden’s presidential win, Biden begins to enact his policies and nominate the future leaders of …