{"id":163551,"date":"2023-09-27T08:46:27","date_gmt":"2023-09-27T03:16:27","guid":{"rendered":"https:\/\/dripp.zone\/news\/?p=163551"},"modified":"2023-09-27T08:46:27","modified_gmt":"2023-09-27T03:16:27","slug":"lessons-from-curve-finance-and-web3-being-prone-to-attacks-crypto-news","status":"publish","type":"post","link":"https:\/\/dripp.zone\/news\/lessons-from-curve-finance-and-web3-being-prone-to-attacks-crypto-news\/","title":{"rendered":"Lessons from Curve Finance and Web3 being prone to attacks &#8211; Crypto News"},"content":{"rendered":"<p><\/p>\n<div>\n<p>Curve Finance\u2019s <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.coindesk.com\/tech\/2023\/08\/09\/as-curve-averts-defi-death-spiral-fiasco-exposes-serious-risks\/\">recent near-death experience<\/a> (and its averted propagation) may seem like a blur in Web3\u2019s rear-view mirror, but it\u2019s actually something that keeps happening in the industry. It\u2019s not the first time that a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/forkast.news\/explainer-decentralized-finance-defi-guide\/\">decentralized finance<\/a> protocol \u2014 or any decentralized app for that matter \u2014 has been affected by an attack that is perfectly legal within its own code. More so, the crisis could\u2019ve been prevented if on-chain risk management existed.<\/p>\n<p>All of this points to a broader problem in Web3. That is the problem of <em>limited expressivity and resources<\/em> that exist in its development environments and how it affects security overall.<\/p>\n<h4 class=\"wp-block-heading\"><strong>Hack or exploit?<\/strong><\/h4>\n<p>When the Curve Finance attacker was able to retrieve US$61.7 million in assets from Curve Finance\u2019s <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/forkast.news\/what-are-smart-contracts-what-are-they-used-for\/\">smart contracts<\/a>, many <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/forkast.news\/defi-revenue-curve-finance-forkast-labs\/\">media outlets<\/a> and commentators called the event a \u201c<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/cointelegraph.com\/news\/curve-finance-vows-to-reimburse-users-after-hack\">hack<\/a>.\u201d But this was not a hack \u2014 it was an exploit. The difference here is key.\u00a0<\/p>\n<p>In this context, a hack would\u2019ve taken place if the attacker had somehow bypassed or broken an existing security measure. But the attack on Curve was an exploit. Nothing that happened that was out of the ordinary in terms of what the protocol\u2019s Vyper code allowed for. The looter simply took advantage of how the protocol\u2019s design worked.<\/p>\n<p>Who\u2019s to blame for this? No one. Curve\u2019s Vyper code, like most of the (Solidity) code that\u2019s used in Web3 applications, is severely limited in its ability to express complexity beyond relatively simple transaction logic.\u00a0<\/p>\n<p>This makes it hard for anyone to design security measures that would prevent this or any other attacks. More worryingly, it also makes it hard for anyone to properly design tools to prevent their spread across DeFi\u2019s vast and composable liquidity landscape.<\/p>\n<h4 class=\"wp-block-heading\">On-chain risk analysis<\/h4>\n<p>But it doesn\u2019t mean there was nothing Curve could do to prevent this attack and its spread across DeFi. A simple example of a solution would be on-chain risk analysis.\u00a0<\/p>\n<p>The generalized version of a problematic pattern that could be solved can be summarized in a hypothetical situation like this one:<\/p>\n<ul>\n<li>Bad actor Bob buys $5 million worth of the highly volatile $RISKY token via a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/coinmarketcap.com\/alexandria\/glossary\/flash-loan\">flashloan<\/a>.<\/li>\n<li>The value of $RISKY token is effectively pumped by Bob after the purchase.\u00a0<\/li>\n<li>Bob takes out a $100 million loan on Naive Finance backed by $RISKY.<\/li>\n<li>Naive Finance checks the price of $RISKY and confirms that Bob is \u201cgood\u201d for the money.<\/li>\n<li>Bob runs.<\/li>\n<li>When Naive Finance liquidates $RISKY it is only worth $5 million.<\/li>\n<\/ul>\n<p>(Another example of this general pattern can be found in the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/forkast.news\/headlines\/euler-finance-loses-nearly-us200-mln-in-exploit\/\">Euler hack<\/a> from March.)<\/p>\n<p>Traditionally, this problem is solved by risk analysis solutions that determine how good of a guarantee an asset can be. If they existed on-chain, Naive Finance could check statistical estimations based on the token\u2019s historical price before approving the loan. The protocol would\u2019ve seen through the pump and denied Bob the $100 million.<\/p>\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><\/figure>\n<p>DeFi is lacking this kind of on-chain risk analysis and management.<\/p>\n<p>Going back to Curve Finance, a spread could\u2019ve been prevented if Aave and Frax had an automated, on-chain limit on loan approvals when they pass a percentage of the collateral token\u2019s circulating supply. This would\u2019ve been a safer and less stress-inducing situation for everybody.<\/p>\n<h4 class=\"wp-block-heading\">Limited expressivity and resources<\/h4>\n<p>The real problem here is that current Web3 ecosystems can\u2019t support something like this on-chain risk analysis solution. They\u2019re limited by the kind of libraries and frameworks that are available in virtual machines like the Ethereum Virtual Machine. They\u2019re also limited in terms of the resources at their disposal.<\/p>\n<p>In order to develop something like this risk analysis and management solution, a decentralized app would need to count on coding libraries that have functions for <em>at least<\/em> basic mathematical concepts like logarithms and others.\u00a0<\/p>\n<p>This is not the case in Web3 because dApps don\u2019t have access to <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/numpy.org\/doc\/stable\/user\/whatisnumpy.html\">NumPy<\/a>, the math module in Python, for example. The typical toolbox isn\u2019t there and developers have to reinvent the wheel instead.<\/p>\n<p>Then we have another problem. Even if they had these libraries, they would be too expensive to code. Literally expensive. The Ethereum Virtual Machine is designed so that there\u2019s a price for every computation.\u00a0<\/p>\n<p>While there are valid reasons for this, such as preventing infinite loops and such, it also creates a resource limitation for dApps that might need to scale computationally without incurring unreasonable costs. One could easily see how a risk management solution would cost more to run than what it\u2019s able to save in funds.<\/p>\n<h4 class=\"wp-block-heading\">Focusing on the right problems<\/h4>\n<p>At a localized level, the spread of the Curve Finance impasse could\u2019ve been prevented with on-chain risk management. At a general level, this whole class of attacks could be prevented with more expressivity and resources in Web3.<\/p>\n<p>These are two aspects of blockchain scalability that have long been overlooked because they go beyond affording more shared block space for dApps. They actually involve the creation of development environments in Web3 that emulate those of Web2. They\u2019re about <em>computational scalability <\/em>and <em>programmability<\/em>, not just scaling the amount of data that is available on-chain.<\/p>\n<p>Perhaps if protocol developers at Curve, Aave or Frax had the ability to count on a better toolbox and more resources, these and future exploits could be avoided altogether. Maybe we could start with on-chain risk management.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Curve Finance\u2019s recent near-death experience (and its averted propagation) may seem like a blur in Web3\u2019s rear-view mirror, but it\u2019s actually something that keeps happening in the industry. It\u2019s not the first time that a decentralized finance protocol \u2014 or any decentralized app for that matter \u2014 has been affected by an attack that is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":163552,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[235,203,210,234,231,232,237,238,236,233],"class_list":["post-163551","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blockchain","tag-bitcoin","tag-crypto-currency","tag-elon-musk","tag-ethereum","tag-hyperledger","tag-ibm","tag-mining","tag-nodes","tag-spacex","tag-tesla"],"_links":{"self":[{"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/posts\/163551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/comments?post=163551"}],"version-history":[{"count":2,"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/posts\/163551\/revisions"}],"predecessor-version":[{"id":163554,"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/posts\/163551\/revisions\/163554"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/media\/163552"}],"wp:attachment":[{"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/media?parent=163551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/categories?post=163551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dripp.zone\/news\/wp-json\/wp\/v2\/tags?post=163551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}