Merlin Labs Profit Inflation Vulnerability: Difference between revisions

From Quadriga Initiative Cryptocurrency Hacks, Scams, and Frauds Repository
Jump to navigation Jump to search
No edit summary
(Another 30 minutes complete. Additional sources merged in. Information moved around. New logo.)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Imported Case Study|source=https://www.quadrigainitiative.com/casestudy/merlinlabsprofitinflationvulnerability.php}}
{{Case Study Under Construction}}{{Unattributed Sources}}
{{Unattributed Sources}}


[[File:Merlinlabs.jpg|thumb|Merlin Labs]]The newly deployed (and not yet intended to be public) Merlin Labs smart contract allowed the attacker to profit a higher value in MERL by sending a smaller amount of BNB. This was obviously a good deal, and the attacker took full advantage of it before mixing their funds on Tornado.
[[File:Merlinlab.jpg|thumb|Merlin Lab Logo/Homepage]]The newly deployed (and not yet intended to be public) Merlin Labs smart contract allowed the attacker to profit a higher value in MERL by sending a smaller amount of BNB. This was obviously a good deal, and the attacker took full advantage of it before mixing their funds on Tornado.


As a result, Merlin Labs closed, and it appears that anyone who lost funds in this or previous exploits is out of luck.
As a result, Merlin Labs closed, and it appears that anyone who lost funds in this or previous exploits is out of luck.


This is a global/international case not involving a specific country.
This is a global/international case not involving a specific country.<ref name="decremist-2792" /><ref name="reddit-2793" /><ref name="vikingswapfinance-1141" /><ref name="openblocksecgithub-2342" /><ref name="bscscan-2794" /><ref name="unnamed-12515" /><ref name="rektnews-6296" /><ref name="blockthreat-6297" />
<ref name="blockthreat-2673" /><ref name="peckshieldtwitter-2789" /><ref name="rektnews-2790" /><ref name="reddit-2791" /><ref name="decremist-2792" /><ref name="reddit-2793" /><ref name="vikingswapfinance-1141" /><ref name="openblocksecgithub-2342" /><ref name="bscscan-2794" /><ref name="unknown-6295" /><ref name="rektnews-6296" /><ref name="blockthreat-6297" />


== About Merlin Labs ==
== About Merlin Labs ==
Line 14: Line 12:
"User security has always been Merlin Lab’s top priority." "It has been always a top priority and it is for the simple reason that without security the platform can't be run." "Our development team has implemented routine checks of our smart contracts and codes to continuously bring improved security standards into the Merlin ecosystem." "Merlin Labs was audited by Hacken on May 15th." "According to the assessment, the Customer's smart contracts are well-secured." "Our team performed an analysis of code functionality, manual audit, and automated checks with Mythril and Slither."
"User security has always been Merlin Lab’s top priority." "It has been always a top priority and it is for the simple reason that without security the platform can't be run." "Our development team has implemented routine checks of our smart contracts and codes to continuously bring improved security standards into the Merlin ecosystem." "Merlin Labs was audited by Hacken on May 15th." "According to the assessment, the Customer's smart contracts are well-secured." "Our team performed an analysis of code functionality, manual audit, and automated checks with Mythril and Slither."


"On June 29, 2021 Merlin profit inflation vulnerability was exploited which resulted in the loss of $330K."
== The Reality ==
 
"The third time’s a charm for Merlin Finance. Why do people keep going back?"
 
"A total of $330k was stolen, bringing their TVL (total value lost) to $1,560,000, and putting them on par with Value DeFi as one of the few protocols to be so unsafe that they have three positions onto the rekt leaderboard."
 
"Thank you for your patience. It has been identified that this was an economic exploit."
 
"The Merlin Dev team had deployed the Alpaca single asset vaults onto the Mainnet for testing this morning. This vault was not supposed to be publicly available or ready to launch to the public."
"The Merlin Dev team had deployed the Alpaca single asset vaults onto the Mainnet for testing this morning. This vault was not supposed to be publicly available or ready to launch to the public."


"Via the smart contract, a hacker deposited 0.1WBNB into the vault and then manually transferred 1000BNB into the contract to trick the contract into thinking it has received 1000BNB in rewards, which resulted in the minter producing MERL rewards."
== What Happened ==
"On June 29, 2021 Merlin profit inflation vulnerability was exploited which resulted in the loss of $330K."


"Merlin's reward system gave users Merlin tokens for every $ in performance fees they brought in. It was rewarding 35 MERL (~$500 at the time) for every BNB (worth ~$300). When calculating the profit of the strategy, it converted the received BNB to WBNB. The increase in WBNB balance was then seen as the profit. By sending BNB to the contract directly, it is also converted to WBNB and considered "profit". By depositing BNB in the contract, the attacker could harvest and all that BNB would be assumed to be rewardable profit. Straight to ETH, then Tornado and it’s gone."
"Merlin is officially closed."
This is a global/international case not involving a specific country.
The background of the exchange platform, service, or individuals involved, as it would have been seen or understood at the time of the events.
Include:
* Known history of when and how the service was started.
* What problems does the company or service claim to solve?
* What marketing materials were used by the firm or business?
* Audits performed, and excerpts that may have been included.
* Business registration documents shown (fake or legitimate).
* How were people recruited to participate?
* Public warnings and announcements prior to the event.
Don't Include:
* Any wording which directly states or implies that the business is/was illegitimate, or that a vulnerability existed.
* Anything that wasn't reasonably knowable at the time of the event.
There could be more than one section here. If the same platform is involved with multiple incidents, then it can be linked to a main article page.
== The Reality ==
This sections is included if a case involved deception or information that was unknown at the time. Examples include:
* When the service was actually started (if different than the "official story").
* Who actually ran a service and their own personal history.
* How the service was structured behind the scenes. (For example, there was no "trading bot".)
* Details of what audits reported and how vulnerabilities were missed during auditing.
== What Happened ==
The specific events of the loss and how it came about. What actually happened to cause the loss and some of the events leading up to it.
The specific events of the loss and how it came about. What actually happened to cause the loss and some of the events leading up to it.
{| class="wikitable"
{| class="wikitable"
Line 65: Line 25:
!Description
!Description
|-
|-
|June 29th, 2021 12:00:00 AM
|June 1st, 2021 1:31:26 PM MDT
|Promotion On Reddit
|Merlin Lab posts a Reddit post promoting their platform<ref name="reddit-2791" />.
|-
|June 29th, 2021
|Main Event
|Main Event
|Expand this into a brief description of what happened and the impact. If multiple lines are necessary, add them here.
|Expand this into a brief description of what happened and the impact. If multiple lines are necessary, add them here.
|-
|-
|
|June 29th, 2021 3:38:00 AM MDT
|
|Peckshield Root Cause Published
|
|Peckshield publishes the root cause for the vulnerability<ref name="peckshieldtwitter-2789" />.
|-
|July 18th, 2021 11:31:51 PM MDT
|BlockThreat Week 26
|The incident is included in BlockThreat for week 26 of 2021<ref name="blockthreat-2673" />.
|}
|}
== Technical Details ==
"A total of $330k was stolen, bringing their TVL (total value lost) to $1,560,000, and putting them on par with Value DeFi as one of the few protocols to be so unsafe that they have three positions onto the rekt leaderboard."
"Via the smart contract, a hacker deposited 0.1WBNB into the vault and then manually transferred 1000BNB into the contract to trick the contract into thinking it has received 1000BNB in rewards, which resulted in the minter producing MERL rewards."
"Merlin's reward system gave users Merlin tokens for every $ in performance fees they brought in. It was rewarding 35 MERL (~$500 at the time) for every BNB (worth ~$300). When calculating the profit of the strategy, it converted the received BNB to WBNB. The increase in WBNB balance was then seen as the profit. By sending BNB to the contract directly, it is also converted to WBNB and considered "profit". By depositing BNB in the contract, the attacker could harvest and all that BNB would be assumed to be rewardable profit. Straight to ETH, then Tornado and it’s gone."
Peckshield:<ref name="peckshieldtwitter-2789" />


== Total Amount Lost ==
== Total Amount Lost ==
Line 81: Line 58:
== Immediate Reactions ==
== Immediate Reactions ==
How did the various parties involved (firm, platform, management, and/or affected individual(s)) deal with the events? Were services shut down? Were announcements made? Were groups formed?
How did the various parties involved (firm, platform, management, and/or affected individual(s)) deal with the events? Were services shut down? Were announcements made? Were groups formed?
"The third time’s a charm for Merlin Finance. Why do people keep going back?"
"Thank you for your patience. It has been identified that this was an economic exploit."


== Ultimate Outcome ==
== Ultimate Outcome ==
What was the end result? Was any investigation done? Were any individuals prosecuted? Was there a lawsuit? Was any tracing done?
 
 
"Merlin is officially closed."
 
The incident was included in Rekt:<ref name="rektnews-2790" />


== Total Amount Recovered ==
== Total Amount Recovered ==
Line 92: Line 79:
== Ongoing Developments ==
== Ongoing Developments ==
What parts of this case are still remaining to be concluded?
What parts of this case are still remaining to be concluded?
 
== General Prevention Policies ==
== Prevention Policies ==
It is impossible to prove that smart contracts are completely secure, and they should be treated in a similar manner to hot wallets. The majority of funds should be stored in multi-signature wallets with offline keys.
It is impossible to prove that smart contracts are completely secure, and they should be treated in a similar manner to hot wallets. The majority of funds should be stored in multi-signature wallets with offline keys.


Smart contract hot wallets can improve security through third party security auditing, or providing a bug bounty. Keep funds in the hot wallet minimal and expect losses. Smart contract insurance, setting up a self insurance treasury, or an industry insurance fund may also be possible, which could allow for greater live liquidity.
Smart contract hot wallets can improve security through third party security auditing, or providing a bug bounty. Keep funds in the hot wallet minimal and expect losses. Smart contract insurance, setting up a self insurance treasury, or an industry insurance fund may also be possible, which could allow for greater live liquidity.
== Individual Prevention Policies ==
{{Prevention:Individuals:Placeholder}}
{{Prevention:Individuals:End}}


== References ==
== Platform Prevention Policies ==
<references><ref name="blockthreat-2673">[https://blockthreat.substack.com/p/blockthreat-week-26-2021 No Title] (Jul 24, 2021)</ref>
{{Prevention:Platforms:Placeholder}}


<ref name="peckshieldtwitter-2789">[https://twitter.com/peckshield/status/1409808532040343558 @peckshield Twitter] (Jul 24, 2021)</ref>
{{Prevention:Platforms:End}}


<ref name="rektnews-2790">[https://www.rekt.news/merlin3-rekt/ Rekt - Merlin Labs - R3KT] (Jul 24, 2021)</ref>
== Regulatory Prevention Policies ==
{{Prevention:Regulators:Placeholder}}


<ref name="reddit-2791">[https://www.reddit.com/r/MerlinLab/comments/nq2e80/merlin_lab_is_the_highest_apy_autocompounding/ Reddit - Dive into anything] (Jul 24, 2021)</ref>
{{Prevention:Regulators:End}}


== References ==
<references>
<ref name="blockthreat-2673">[https://blockthreat.substack.com/p/blockthreat-week-26-2021 BlockThreat - Week 26, 2021 - Blockchain Threat Intelligence] (Jul 24, 2021)</ref>
<ref name="peckshieldtwitter-2789">[https://twitter.com/peckshield/status/1409808532040343558 peckshield - "Here is the root cause of today's  @MerlinLab_ hack" - Twitter] (Jul 24, 2021)</ref>
<ref name="rektnews-2790">[https://www.rekt.news/merlin3-rekt/ Rekt - Merlin Labs - R3KT] (Jul 24, 2021)</ref>
<ref name="reddit-2791">[https://old.reddit.com/r/MerlinLab/comments/nq2e80/merlin_lab_is_the_highest_apy_autocompounding/ Merlin Lab is the highest APY auto-compounding yield aggregator on BSC. - Reddit Archive June 1st, 2021 1:33:22 PM MDT] (Jul 24, 2021)</ref>
<ref name="decremist-2792">[https://decremist.com/merlinlab-flash-loans-and-upgraded-security-strategy/ Merlinlab flash loans and Upgraded Security Strategy] (Jul 24, 2021)</ref>
<ref name="decremist-2792">[https://decremist.com/merlinlab-flash-loans-and-upgraded-security-strategy/ Merlinlab flash loans and Upgraded Security Strategy] (Jul 24, 2021)</ref>
<ref name="reddit-2793">[https://www.reddit.com/r/MerlinLab/comments/ndn0zn/yesterday_felt_like_just_a_few_millions_today/ Reddit - Dive into anything] (Jul 24, 2021)</ref>
<ref name="reddit-2793">[https://www.reddit.com/r/MerlinLab/comments/ndn0zn/yesterday_felt_like_just_a_few_millions_today/ Reddit - Dive into anything] (Jul 24, 2021)</ref>
<ref name="vikingswapfinance-1141">[https://www.vikingswap.finance/files/vikingHackenAudit.pdf VIking Swap Audit - Hacken] (Jun 13, 2021)</ref>
<ref name="vikingswapfinance-1141">[https://www.vikingswap.finance/files/vikingHackenAudit.pdf VIking Swap Audit - Hacken] (Jun 13, 2021)</ref>
<ref name="openblocksecgithub-2342">[https://github.com/openblocksec/blocksec-incidents/blob/main/defi/2021.md blocksec-incidents/2021.md at main · openblocksec/blocksec-incidents · GitHub] (Aug 11, 2021)</ref>
<ref name="openblocksecgithub-2342">[https://github.com/openblocksec/blocksec-incidents/blob/main/defi/2021.md blocksec-incidents/2021.md at main · openblocksec/blocksec-incidents · GitHub] (Aug 11, 2021)</ref>
<ref name="bscscan-2794">[https://bscscan.com/address/0x2bADa393e53D0373788d15fD98CB5Fb1441645BD Address 0x2bADa393e53D0373788d15fD98CB5Fb1441645BD | BscScan] (Aug 29, 2021)</ref>
<ref name="bscscan-2794">[https://bscscan.com/address/0x2bADa393e53D0373788d15fD98CB5Fb1441645BD Address 0x2bADa393e53D0373788d15fD98CB5Fb1441645BD | BscScan] (Aug 29, 2021)</ref>
 
<ref name="unnamed-12515">https://medium.com/@nelsonblue41/introduction-to-merlin-d489a40cf4d6 (Nov 30, 2023)</ref>
<ref name="unknown-6295">[v v] (Feb 8, 2022)</ref>
 
<ref name="rektnews-6296">[https://rekt.news/merlin3-rekt/ Rekt - Merlin Labs - R3KT] (Feb 8, 2022)</ref>
<ref name="rektnews-6296">[https://rekt.news/merlin3-rekt/ Rekt - Merlin Labs - R3KT] (Feb 8, 2022)</ref>
 
<ref name="blockthreat-6297">https://www.blockthreat.io/p/blockthreat-week-26-2021 (Feb 8, 2022)</ref>
<ref name="blockthreat-6297">[https://www.blockthreat.io/p/blockthreat-week-26-2021 https://www.blockthreat.io/p/blockthreat-week-26-2021] (Feb 8, 2022)</ref></references>
</references>

Latest revision as of 15:26, 30 November 2023

Notice: This page is a new case study and some aspects have not been fully researched. Some sections may be incomplete or reflect inaccuracies present in initial sources. Please check the References at the bottom for further information and perform your own additional assessment. Please feel free to contribute by adding any missing information or sources you come across. If you are new here, please read General Tutorial on Wikis or Anatomy of a Case Study for help getting started.

Notice: This page contains sources which are not attributed to any text. The unattributed sources follow the initial description. Please assist by visiting each source, reviewing the content, and placing that reference next to any text it can be used to support. Feel free to add any information that you come across which isn't present already. Sources which don't contain any relevant information can be removed. Broken links can be replaced with versions from the Internet Archive. See General Tutorial on Wikis, Anatomy of a Case Study, and/or Citing Your Sources Guide for additional information. Thanks for your help!

Merlin Lab Logo/Homepage

The newly deployed (and not yet intended to be public) Merlin Labs smart contract allowed the attacker to profit a higher value in MERL by sending a smaller amount of BNB. This was obviously a good deal, and the attacker took full advantage of it before mixing their funds on Tornado.

As a result, Merlin Labs closed, and it appears that anyone who lost funds in this or previous exploits is out of luck.

This is a global/international case not involving a specific country.[1][2][3][4][5][6][7][8]

About Merlin Labs

"Merlin Lab is the highest APY auto-compounding yield aggregator on BSC." Merlin is a way to "Auto-compound & Earn BTCB, ETH, BNB & extra MERL." "Merlin Lab’s vision is to create a suite of complementary DeFi products that will operate in a harmonious ecosystem."

"User security has always been Merlin Lab’s top priority." "It has been always a top priority and it is for the simple reason that without security the platform can't be run." "Our development team has implemented routine checks of our smart contracts and codes to continuously bring improved security standards into the Merlin ecosystem." "Merlin Labs was audited by Hacken on May 15th." "According to the assessment, the Customer's smart contracts are well-secured." "Our team performed an analysis of code functionality, manual audit, and automated checks with Mythril and Slither."

The Reality

"The Merlin Dev team had deployed the Alpaca single asset vaults onto the Mainnet for testing this morning. This vault was not supposed to be publicly available or ready to launch to the public."

What Happened

"On June 29, 2021 Merlin profit inflation vulnerability was exploited which resulted in the loss of $330K."

The specific events of the loss and how it came about. What actually happened to cause the loss and some of the events leading up to it.

Key Event Timeline - Merlin Labs Profit Inflation Vulnerability
Date Event Description
June 1st, 2021 1:31:26 PM MDT Promotion On Reddit Merlin Lab posts a Reddit post promoting their platform[9].
June 29th, 2021 Main Event Expand this into a brief description of what happened and the impact. If multiple lines are necessary, add them here.
June 29th, 2021 3:38:00 AM MDT Peckshield Root Cause Published Peckshield publishes the root cause for the vulnerability[10].
July 18th, 2021 11:31:51 PM MDT BlockThreat Week 26 The incident is included in BlockThreat for week 26 of 2021[11].

Technical Details

"A total of $330k was stolen, bringing their TVL (total value lost) to $1,560,000, and putting them on par with Value DeFi as one of the few protocols to be so unsafe that they have three positions onto the rekt leaderboard."

"Via the smart contract, a hacker deposited 0.1WBNB into the vault and then manually transferred 1000BNB into the contract to trick the contract into thinking it has received 1000BNB in rewards, which resulted in the minter producing MERL rewards."

"Merlin's reward system gave users Merlin tokens for every $ in performance fees they brought in. It was rewarding 35 MERL (~$500 at the time) for every BNB (worth ~$300). When calculating the profit of the strategy, it converted the received BNB to WBNB. The increase in WBNB balance was then seen as the profit. By sending BNB to the contract directly, it is also converted to WBNB and considered "profit". By depositing BNB in the contract, the attacker could harvest and all that BNB would be assumed to be rewardable profit. Straight to ETH, then Tornado and it’s gone."

Peckshield:[10]

Total Amount Lost

The total amount lost has been estimated at $330,000 USD.

How much was lost and how was it calculated? If there are conflicting reports, which are accurate and where does the discrepancy lie?

Immediate Reactions

How did the various parties involved (firm, platform, management, and/or affected individual(s)) deal with the events? Were services shut down? Were announcements made? Were groups formed?


"The third time’s a charm for Merlin Finance. Why do people keep going back?"


"Thank you for your patience. It has been identified that this was an economic exploit."

Ultimate Outcome

"Merlin is officially closed."

The incident was included in Rekt:[12]

Total Amount Recovered

There do not appear to have been any funds recovered in this case.

What funds were recovered? What funds were reimbursed for those affected users?

Ongoing Developments

What parts of this case are still remaining to be concluded?

General Prevention Policies

It is impossible to prove that smart contracts are completely secure, and they should be treated in a similar manner to hot wallets. The majority of funds should be stored in multi-signature wallets with offline keys.

Smart contract hot wallets can improve security through third party security auditing, or providing a bug bounty. Keep funds in the hot wallet minimal and expect losses. Smart contract insurance, setting up a self insurance treasury, or an industry insurance fund may also be possible, which could allow for greater live liquidity.

Individual Prevention Policies

No specific policies for individual prevention have yet been identified in this case.

For the full list of how to protect your funds as an individual, check our Prevention Policies for Individuals guide.

Platform Prevention Policies

Policies for platforms to take to prevent this situation have not yet been selected in this case.

For the full list of how to protect your funds as a financial service, check our Prevention Policies for Platforms guide.

Regulatory Prevention Policies

No specific regulatory policies have yet been identified in this case.

For the full list of regulatory policies that can prevent loss, check our Prevention Policies for Regulators guide.

References