{"id":16571,"date":"2020-06-18T17:03:42","date_gmt":"2020-06-18T17:03:42","guid":{"rendered":"https:\/\/davidgerard.co.uk\/blockchain\/?p=16571"},"modified":"2020-10-02T10:58:23","modified_gmt":"2020-10-02T10:58:23","slug":"bancor-releases-smart-contract-security-hole-hacks-self-only-loses-a-few-hundred-thousand-dollars-of-user-funds","status":"publish","type":"post","link":"https:\/\/davidgerard.co.uk\/blockchain\/2020\/06\/18\/bancor-releases-smart-contract-security-hole-hacks-self-only-loses-a-few-hundred-thousand-dollars-of-user-funds\/","title":{"rendered":"Bancor releases smart contract security hole, hacks self, only loses a few hundred thousand dollars of user funds"},"content":{"rendered":"<p>Bancor is an ICO token from 2017 that I <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/icos-magic-beans-and-bubble-machines\/\">mentioned<\/a> in chapter 9 of <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/book\/\">the book.<\/a> They sold $144 million of tokens in one day when the crypto bubble was in full swing, and clogged the Ethereum network to unusability.<\/p>\n<p>Bancor has since developed into a DeFi (decentralised finance) platform \u2014 somewhere for traders to <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2020\/01\/05\/decentralised-finance-defi-in-practice-when-you-have-a-spare-eth-to-play-with\/\">kill each other at ridiculous risk in a zero-sum battle to the death,<\/a> with the promise of stupendous interest rates.<\/p>\n<p>Last week, Bancor was going to be <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2020\/06\/15\/news-quadriga-report-coinbase-vcs-want-to-dump-their-dead-altcoins-india-to-re-ban-cryptos-civil-is-dead\/\">listed on Coinbase<\/a> \u2014 with a huge pile of other zombie altcoins \u2014 and Michael Novogratz of Galaxy Digital was shilling Bancor. [<a href=\"https:\/\/twitter.com\/novogratz\/status\/1269645263955779591\"><i>Twitter<\/i><\/a>]<\/p>\n<p>This morning, Bancor was being drained by a hacker. [<a href=\"https:\/\/twitter.com\/Hex_Capital\/status\/1273470722342400003\"><i>Twitter<\/i><\/a>]<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2020\/06\/18\/bancor-releases-smart-contract-security-hole-hacks-self-only-loses-a-few-hundred-thousand-dollars-of-user-funds\/bancor-bnt-logo\/\" rel=\"attachment wp-att-17466\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2020\/06\/bancor-bnt-logo.png\" alt=\"\" width=\"250\" height=\"250\" class=\"aligncenter size-full wp-image-17466\" srcset=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2020\/06\/bancor-bnt-logo.png 420w, https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2020\/06\/bancor-bnt-logo-300x300.png 300w, https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2020\/06\/bancor-bnt-logo-150x150.png 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>The security hole<\/h3>\n<p>Bancor lets a user approve Bancor to spend their tokens for them, so as to execute a convoluted DeFi transaction.<\/p>\n<p>Version 0.6 of the Bancor smart contract, pushed 16 June, had an ill-authenticated <code>safeTransferFrom()<\/code> function \u2014 if the target has approved Bancor to spend their tokens, then a hacker can impersonate the Bancor contract to transfer the target&#8217;s assets to an arbitrary address. [<a href=\"https:\/\/twitter.com\/Bancor\/status\/1273512800737001472\"><i>Twitter<\/i><\/a>]<\/p>\n<p>Bancor say they conducted a white-hat attack on their own contract to move all user funds away. They&#8217;ve stated that all user funds are safe. [<a href=\"https:\/\/twitter.com\/defiprime\/status\/1273473231739994113\"><i>Twitter<\/i><\/a>]<\/p>\n<p>Current reports are that user funds were <i>not<\/i> all safe \u2014 such as $135,000 of Bancor that was transferred to non-Bancor addresses. 1inch found that an arbitrage bot was front-running Bancor&#8217;s &#8220;rescue&#8221; transactions. One such front-runner has said they will be returning the funds. [<a href=\"https:\/\/twitter.com\/Hex_Capital\/status\/1273481137415811072\"><i>Twitter<\/i><\/a><i>; <\/i><a href=\"https:\/\/medium.com\/@1inch.exchange\/bancor-network-hack-2020-3c71444fd59d\"><i>Medium<\/i><\/a><i>; <\/i><a href=\"https:\/\/etherscan.io\/address\/0x052ede4c2a04670be329db369c4563283391a3ea#comment-4675611198\"><i>Etherscan<\/i><\/a>]<\/p>\n<p>If you&#8217;re a user who approved Bancor, they strongly suggest that you go to their site and revoke your approval. [<a href=\"https:\/\/approved.zone\/\"><i>approved.zone<\/i><\/a>]<\/p>\n<h3>The &#8220;S&#8221; in DeFi stands for &#8220;Secure&#8221;<\/h3>\n<p>Emin G\u00fcn Sirer called out Bancor&#8217;s blitheringly incompetent smart contract coding in detail in 2017. &#8220;20. Bancor reimplemented math.&#8221; [<a href=\"https:\/\/hackingdistributed.com\/2017\/06\/19\/bancor-is-flawed\/\"><i>Hacking Distributed<\/i><\/a><i>, 2017<\/i>]<\/p>\n<p>Sirer doesn&#8217;t bother much with ICO code these days \u2014 he has a real project, Ava \u2014 but I asked him at the time how ICO code compared to code from his undergraduate students, and he said it was worse.<\/p>\n<p>Bancor was hacked for $23.5 million in tokens in 2018. They&#8217;d left an administrative back door open \u2014 and the attackers got in through that. [<em><a href=\"https:\/\/www.businessinsider.com\/bancor-hack-ethereum-2018-7?r=UK\">Business Insider<\/a>, 2018; <a href=\"https:\/\/twitter.com\/udiWertheimer\/status\/1016570314862493698\">Twitter<\/a><\/em>]<\/p>\n<p>Bancor also runs a US dollar stablecoin backed by Bancor tokens \u2014 the USDB. Nomics rates it D for transparency, and the last listed price I saw was 87 cents. [<a href=\"https:\/\/nomics.com\/assets\/usdb-usd-bancor\/markets\"><i>Nomics<\/i><\/a>]<\/p>\n<p>Smart contract coding is <em>hard.<\/em> If you do it to this standard, you should expect to get hacked over and over. <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2020\/04\/26\/the-dforce-and-hegic-defi-exploits-and-why-smart-contracts-are-bad\/\">DeFi is especially risky for this<\/a>\u00a0\u2014 as everyone rushes to be first to the market.<\/p>\n<p>Like all of DeFi, anyone who puts their money into this fully earns everything that happens to them.<\/p>\n<br><br><div align=\"center\"><p><a href=\"https:\/\/www.patreon.com\/bePatron?u=8420236\"><img src=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2021\/10\/become_a_patron_button.svg\" alt=\"Become a Patron!\" title=\"Become a Patron!\" width=217 height=51><\/a><br><p style=\"align:center;\" class=\"patreon-badge\"><i>Your subscriptions keep this site going. <a href=\"https:\/\/www.patreon.com\/bePatron?u=8420236\">Sign up today!<\/a><\/i><\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>&#8220;20. Bancor reimplemented math.&#8221;<\/p>\n","protected":false},"author":1,"featured_media":17469,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[147,1552,215,9,83],"class_list":["post-16571","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorised","tag-bancor","tag-defi","tag-emin-gun-sirer","tag-ico","tag-smart-contract"],"jetpack_featured_media_url":"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2020\/06\/bancor-bnt-logo-header.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/16571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/comments?post=16571"}],"version-history":[{"count":16,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/16571\/revisions"}],"predecessor-version":[{"id":17468,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/16571\/revisions\/17468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/media\/17469"}],"wp:attachment":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/media?parent=16571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/categories?post=16571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/tags?post=16571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}