{"id":453,"date":"2023-01-30T14:23:16","date_gmt":"2023-01-30T12:23:16","guid":{"rendered":"https:\/\/ackeeblockchain.com\/blog\/?p=453"},"modified":"2023-01-30T14:23:16","modified_gmt":"2023-01-30T12:23:16","slug":"2022-solana-hacks-explained-crema-finance","status":"publish","type":"post","link":"https:\/\/ackee.xyz\/blog\/2022-solana-hacks-explained-crema-finance\/","title":{"rendered":"2022 Solana Hacks Explained: Crema Finance"},"content":{"rendered":"<p><span style=\"font-weight: 400;\"><a href=\"https:\/\/www.crema.finance\/\"><strong>Crema Finance<\/strong><\/a> is a <strong>liquidity pool based<\/strong> on CLMM (Concentrated Liquidity Market Maker) that <strong>allows<\/strong> liquidity providers to <strong>set specific price ranges<\/strong>, <strong>add<\/strong> single-sided <strong>liquidity<\/strong> and <strong>do range order trading<\/strong>. <\/span><\/p>\n<p><strong>What happened <\/strong><\/p>\n<p><span style=\"font-weight: 400;\">On July 2, 2022, the pool was subject to an exploit, <strong>draining<\/strong> over <strong>$8M<\/strong> worth of assets. The hacker used a <strong>combination<\/strong> of<strong> flash-load<\/strong> and <strong>exploitation<\/strong> <strong>of owner verification<\/strong>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The project is <strong>closed source<\/strong>, so the information about the hack is limited. The <strong>only<\/strong> publicly available <a href=\"https:\/\/docsend.com\/view\/rc7w5xr3vxfh2h8i\"><strong>security audit<\/strong> <\/a>took place in October <strong>after<\/strong> the incident.<\/span><\/p>\n<p><b>Exploit Details<\/b><\/p>\n<p><span style=\"font-weight: 400;\">According to <a href=\"https:\/\/twitter.com\/Crema_Finance\/status\/1543638844410499073\"><strong>Crema Finance&#8217;s tweet<\/strong><\/a>, the CLLM depends on a <strong>tick account containing information about the price tick data.<\/strong> The attacker created a<strong> fake tick<\/strong> account and <strong>circumvented<\/strong> the <strong>owner check<\/strong> by writing the initialised tick address of the pool into the fake account. After that, he took a <strong>flash loan<\/strong> from Solend and used it to <strong>deposit liquidity<\/strong> to the Crema liquidity pool. As the<strong> tick price<\/strong> is related to the <strong>calculation of transaction fees<\/strong>, the attacker was able to <strong>claim<\/strong> <strong>lots of fees<\/strong> by spoofing in the fake tick account. Finally, he <strong>withdrew the original tokens<\/strong> deposited and r<strong>eturned the flash loan<\/strong>.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After the incident, Crema Finance <strong>suspended the protocol<\/strong> and <strong>offered<\/strong> the hacker an <strong>$800k<\/strong> white hat <strong>bounty<\/strong> via <a href=\"https:\/\/etherscan.io\/tx\/0xa38b894b2bb1c8a3eaf816d879a542e080443f7bf5a84214a00e6e509f9f6130\">on-chain message<\/a> to the hacker&#8217;s Ethereum address. After negotiations, the hacker <strong>agreed<\/strong> to take the <strong>45455 SOL<\/strong> bounty (approximately $1.5M at that time) and <strong>returned<\/strong> <strong>the rest<\/strong> to the protocol.<\/span><\/p>\n<p><b>In simple words,<\/b><span style=\"font-weight: 400;\"> everything points again to the<strong> common problem<\/strong> that the <strong>input<\/strong> <strong>accounts<\/strong> <strong>were not properly checked<\/strong>, similar to the <a title=\"2022 Solana Hacks Explained: Wormhole\" href=\"https:\/\/ackeeblockchain.com\/blog\/2022-solana-hacks-explained-wormhole\/\">Wormhole<\/a> and <a title=\"2022 Solana Hacks Explained: Cashio\" href=\"https:\/\/ackeeblockchain.com\/blog\/2022-solana-hacks-explained-cashio\/\">Cashio<\/a> cases, however as the protocol is closed source, some details may be missing.\u00a0<\/span><\/p>\n<p><strong>References<\/strong><\/p>\n<p><a href=\"https:\/\/twitter.com\/Crema_Finance\/status\/1543638844410499073\">1, <\/a><a href=\"https:\/\/www.certik.com\/resources\/blog\/4XzSJEeWC2bRppR9CeBckw-crema-finance-exploit\">2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Crema Finance is a liquidity pool based on CLMM (Concentrated Liquidity Market Maker) that allows liquidity providers to set specific price ranges, add single-sided liquidity and do range order trading. What happened On July 2, 2022, the pool was subject to an exploit, draining over $8M worth of assets. The hacker used a combination of flash-load and exploitation of owner verification. The&hellip;<\/p>\n","protected":false},"author":15,"featured_media":454,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[84,5],"tags":[86,6,19],"class_list":["post-453","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hacks","category-solana","tag-hack","tag-solana","tag-solana-security"],"aioseo_notices":[],"featured_image_src":"https:\/\/ackee.xyz\/blog\/wp-content\/uploads\/2023\/01\/Crema-600x400.png","featured_image_src_square":"https:\/\/ackee.xyz\/blog\/wp-content\/uploads\/2023\/01\/Crema-600x600.png","author_info":{"display_name":"Aleksandra Yudina","author_link":"https:\/\/ackee.xyz\/blog\/author\/aleksandra-yudina\/"},"_links":{"self":[{"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/posts\/453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/comments?post=453"}],"version-history":[{"count":0,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/posts\/453\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/media\/454"}],"wp:attachment":[{"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/media?parent=453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/categories?post=453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ackee.xyz\/blog\/wp-json\/wp\/v2\/tags?post=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}