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:

Thẻ liên quan
链捕手ChainCatcher nhắc nhở: hãy nhìn nhận blockchain một cách tỉnh táo, nâng cao ý thức rủi ro, cảnh giác với việc phát hành và đầu cơ các token ảo. Mọi nội dung trên trang chỉ là thông tin thị trường hoặc quan điểm của các bên liên quan, không cấu thành bất kỳ hình thức tư vấn đầu tư nào. Nếu phát hiện nội dung nhạy cảm, hãy nhấp , chúng tôi sẽ xử lý kịp thời.
Bài viết nổi bật
BTC giảm mạnh 17% trong hai ngày, mất mốc 63000 đô la: một đợt bán tháo do Washington, Cục Dự trữ Liên bang và Công ty Tài chính phối hợp chỉ đạo
11-15

Thành công thu hồi tàu vũ trụ cấp cao, SpaceX lần đầu xuất hiện "đũa kẹp tàu vũ trụ", nhà phân tích: bước quan trọng nhất để hỗ trợ định giá hàng nghìn tỷ
11-15

Thị trường tiền mã hóa đã bước vào "cuối tuần đen tối", ai đã nhấn nút bán?
11-15










