Merlin Labs Profit Inflation Vulnerability
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!
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.
| 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
- ↑ Merlinlab flash loans and Upgraded Security Strategy (Jul 24, 2021)
- ↑ Reddit - Dive into anything (Jul 24, 2021)
- ↑ VIking Swap Audit - Hacken (Jun 13, 2021)
- ↑ blocksec-incidents/2021.md at main · openblocksec/blocksec-incidents · GitHub (Aug 11, 2021)
- ↑ Address 0x2bADa393e53D0373788d15fD98CB5Fb1441645BD | BscScan (Aug 29, 2021)
- ↑ https://medium.com/@nelsonblue41/introduction-to-merlin-d489a40cf4d6 (Nov 30, 2023)
- ↑ Rekt - Merlin Labs - R3KT (Feb 8, 2022)
- ↑ https://www.blockthreat.io/p/blockthreat-week-26-2021 (Feb 8, 2022)
- ↑ 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)
- ↑ 10.0 10.1 peckshield - "Here is the root cause of today's @MerlinLab_ hack" - Twitter (Jul 24, 2021)
- ↑ BlockThreat - Week 26, 2021 - Blockchain Threat Intelligence (Jul 24, 2021)
- ↑ Rekt - Merlin Labs - R3KT (Jul 24, 2021)