QUADRIGA INITIATIVE
CRYPTO WATCHDOG & FRAUD RECOVERY PLATFORM
A COMMUNITY-BASED, NOT-FOR-PROFIT
$1 230 000 USD
MAY 2021
GLOBAL
MERLIN LABS
DESCRIPTION OF EVENTS

"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."
"On May 26, 2021, 03:59:05 AM +UTC, less than 48 hrs after the Autoshark hack. Merlin Lab, another Bunny fork, [was] attacked in a similar fashion to the Bunny and the Autoshark hack." "As a result, the hacker was able to remove ~240 ETH (~680K USD)."
The attacker (1) "Added a small sum of deposit to the LINK-BNB Vault (with this transaction). (2) Sen[t] 180 CAKE to the LINK-BNB Vault contract. (this is important! this is the key that leads to the hack.) (3) Call[ed] getReward with the deposit of LINK-BNB Vault from the first step. (4) With the rather large amount of CAKE token in the wallet balance of the vault contract (sent by the hacker at step 2), returned a large amount of profit (see detailed analysis below). As a result, the system minted 100 MERLIN as a reward to the hacker. (5) Repeated 36 times. Got 49K of MERLIN token in total. (6) Swapped MERLIN token into 240 ETH and transferred out of BSC using Anyswap."
"No vaults were breached. All funds are safe. We have currently paused all Merlin minting. Vaults are auto-compounding as per usual, with their rewards being in the native token only."
"Just 8 hours after the first attack, [Merlin Labs] lost another ~200 ETH to a completely different exploit." "The second attack took advantage of a mistake in their new priceCalculator that mispriced only BAND."
"The incident was not a flashloan attack, as the development team had implemented security measures to mitigate the possibility of this. The incident related to an exploit of the getReward code as a large amount of CAKE tokens were manually transferred into the vault contract, which maniplated the minter to create excessive MERL as part of the vault reward. This led to a total of ~59,000 MERL minted during this process." "As this was not a flashloan exploit, a comparably much smaller amount of tokens were minted to other DeFi exploits. This means the team will rectify and rebalance the token economics to their true supply quickly with our below plans."
"The development team is rectifying the code and has engaged a White Hack Specialist consultant to work along with us in this process." This includes "[i]mplementation of Fair LP Price calculation (by Alpha Homora) and the use of Fair Asset Price via Decentralized Price Oracle — Chainlink. The combination of fair asset price and fiar asset reserves enables Merlin to derive the fair LP token price that is unmanipulatable and safe from attack vectors such as flash loan attacks." "Merlin has [also] implemented a stop on all external smart contracts to interact with Merlin's contract. This means we have mitigated the risk of any flash loan attack within our protocol."
"We have further advised Certik & Haechi of this incident and working with them on the updated code security." "Once a complete review has been completed for the Merlin vaults, we will enable Merlin minting again."
"All MERL token holders as at May-26–2021 10:29:54 AM +UTC will be eligible for the compensation plan. A compensation Merlin token — cMERL will be airdropped to the users. The details of this will be shared in a separate announcement. cMERL holders will be able to earn MERL & BNB rewards from our Compensation Pool funded by The Merlin Team Contribution. The duration of the pool will last for 6 weeks. Over the course of the following months, additional Development Team Funds will be used to perform burn and buyback activities to rectify token economics until true supply is reached." "In the coming weeks, the team will commit to launching our Lottery and additional Buyback and Burn contributions to aggressively facilitate the deflation of MERL."
The Merlin Labs smart contract featured two bugs. One of them was around the rewards minting mechanism, and the other was around incorrect pricing of one particular crypto-asset.
These were exploited by an attacker to make off with liquidity funds. The team launched a subsequent compensation plan for affected users.
HOW COULD THIS HAVE BEEN PREVENTED?
Merlin Labs was already audited, and history shows that this does not preclude the possibility of exploits existing.
The only safe storage of funds is an offline multi-signature setup.
Merlin | Audited High Yield Maximizer (Jun 17)
Rekt - Merlin Labs - REKT (Jun 17)
Rekt - Merlin Labs - REKT 2 (Jun 17)
Our Road Ahead (Jun 19)
Merlin Lab Performance Fee Minting Incident Analysis (Jun 19)
Binance Transaction Hash (Txhash) Details | BscScan (Jun 19)
Merlin Lab Enhanced Security Measures (Jun 19)
Merlin SC SecondReview Audit Report - Wayback Machine (Jun 19)
Merlin Lab Security Layers against Flash Loan Attacks : MerlinLab (Jun 19)
SlowMist Hacked - SlowMist Zone (May 18)
blocksec-incidents/2021.md at main · openblocksec/blocksec-incidents · GitHub (Aug 11)
@peckshield Twitter (Aug 11)
Reddit - Dive into anything (Jul 24)
https://medium.com/@nelsonblue41/introduction-to-merlin-d489a40cf4d6 (Nov 30)
