Slow Fog Technology: Brief Analysis of the Cover Protocol Hack
Summary:
On December 29, due to a hacker attack, the price of Cover protocol tokens plummeted.
On December 29, 2020, according to Slow Mist's intelligence, the price of the Cover protocol plummeted. Below is a brief analysis of the entire attack process by the Slow Mist security team.
- In the Cover protocol's Blacksmith contract, users can stake BPT tokens through the deposit function;
- After the attacker performs the deposit - withdraw for the first time, they will update the pool through the updatePool function and use accRewardsPerToken to record the accumulated rewards;
- Subsequently, rewards will be distributed through the _claimCoverRewards function, and the rewardWriteoff parameter will be used for recording;
- After the attacker's first withdraw, a small portion of BPT will still be staked;
- At this point, the attacker will perform a second deposit and extract rewards through claimRewards;
- The issue lies in the specific calculation of rewardWriteoff. When the attacker performs the deposit - claimRewards for the second time, the Pool value taken is defined as memory. At this time, the Pool obtained in memory is the value updated when the attacker performed updatePool during the first withdraw;
- Since the Pool value obtained in memory is old, the corresponding recorded accRewardsPerToken is also old and will be assigned to the miner;
- When a new updatePool is performed later, since the lpTotal in the pool has already decreased after the attacker’s first withdraw, the final accRewardsPerToken obtained will increase;
- At this point, the accRewardsPerToken assigned to the attacker is old and a smaller value. The value obtained during the rewardWriteoff calculation will also be smaller, but the value used by the attacker during claimRewards is the updated accRewardsPerToken value;
- Therefore, during the specific reward calculation, due to the difference between these new and old parameters, a larger value will be calculated;
- Thus, when minting rewards based on the calculation results, more COVER tokens will be minted for the attacker, leading to an increase in the supply of COVER tokens.
The specific changes in the accRewardsPerToken parameter difference are shown in the figure below:

Related tags
ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click , and we will handle it promptly.
Popular articles
BTC plummeted 17% in two days, falling below 63,000 USD: a sell-off orchestrated by Washington, the Federal Reserve, and the Treasury Department
11-15

Successfully recovered the upper stage of the Starship, SpaceX first revealed the "chopstick clamp spacecraft," analysts: the most critical step to support a trillion-dollar valuation
11-15

Cryptocurrency welcomes a "Black Weekend," who pressed the sell button?
11-15










