COVER, a rookie in the DeFi insurance industry, was attacked. How can the insurance industry protect itself?
After entering September, with the sharp decline in the revenue of DeFi protocol liquidity mining, the DeFi market began to fall silent, and explorers moved to deeper and wider fields.
In November, with the blessing of Andre Cronje (AC), the founder of Yearn.finance, and the surge of governance tokens, the decentralized insurance Cover Protocol emerged, leading the DeFi insurance station under the spotlight.
There is a view that: "DeFi insurance projects can not only reduce the losses of policyholders, but also allow people to participate in DeFi with more confidence, and help to improve the DeFi ecosystem."
However, when the concept of DeFi insurance became more and more popular, Cover Protocol was attacked twice in a short period of time, and the price of its tokens experienced a thrilling roller coaster.
On December 28, 2020, the DeFi insurance project Cover Protocol was suspected of being hacked, and its token price plummeted from more than $700 to as low as $9 under the influence of the attack.Through tracking and analysis, PeckShield found that the attack was mainly due to business logic errors, which led to miscalculation of pledge user rewards and arbitrage selling in different DEXs.First, within a period of time, the attacker first gives Blacksmith some LP tokens, and then directly calls the function updatePool() to calculate the COVER reward through the abnormal pool.accRewardsPerToken;
Miner rewards are then recorded through the functions _claimCoverRewards() and _claimBonus() of lines 125 and 126;Finally, record the status of the miner, including the amount of pledge and the function rewardWriteoff and function bonusWriteoff shown in lines 128 to 131 of the code.Specifically, the current protocol uses pool.accRewardsPerToken to calculate miner.amount.mul(pool.accRewardsPerToken).div(CAL_MULTIPLIER) in line 130, since the pool type in line 118 is memory, and the function updatePool() in line 121 does not It was not updated, resulting in a final calculated rewardWriteoff that was smaller than expected.When the same user gets the staking reward next time, the staking contract such as Blacksmith will mint more COVER, which will greatly increase the number of minted coins. Currently, there are over 40,000,000,000,000,000,000 COVER minted in circulation.The second time the attacker was marked by the network as the address of the Grap Finance white hat. After making a profit, they returned the proceeds to the Cover team, destroyed the remaining COVER, and left a message: Next time, mind your own business.
Some comments said that the white hat Grap Finance is a DeFi hero and returned 4350 ETH to the COVER team. However, through smashing the market, many investors lost their money, which also caused a lot of controversy.For the DeFi insurance project, its original intention is to reduce risk losses for other DeFi projects. With the growth of the DeFi ecosystem and the continuous growth of locked positions, DeFi projects have been coveted by hackers, especially the emerging DeFi insurance projects, and security protection should be strengthened. Nowadays, due to its own vulnerabilities being attacked by hackers, it remains to be seen whether such an insurance project can help users resist risks.In the DeFi world, "Code is Law" is advocated. Project parties must not only maximize the code, but also prevent problems before they happen. DeFi protocol developers should self-check the code after an attack occurs. PeckShield reminds that if you don't understand this, you should find a professional auditing agency for auditing and research.