Cellframe Network was attacked by a flash loan attack, resulting in a profit of $76,000 for the hacker.

robot
Abstract generation in progress

Analysis of the Flash Loan Attack Incident on Cellframe Network

On June 1, 2023, at 10:07:55 (UTC+8), Cellframe Network was hacked on a certain smart chain due to a token quantity calculation issue during the liquidity migration process. It is reported that the hacker profited $76,112 from this attack.

Analysis of Attack Process

The attacker first obtained 1000 native tokens of a certain smart chain and 500,000 New Cell tokens through Flash Loans. Subsequently, the attacker exchanged all New Cell tokens for native tokens, causing the amount of native tokens in the trading pool to approach zero. Finally, the attacker exchanged 900 native tokens for Old Cell tokens.

It is worth noting that the attacker first added liquidity of the Old Cell and native tokens before launching the attack, obtaining the Old lp tokens.

Next, the attacker invoked the liquidity migration function. At this point, there are almost no native tokens in the new pool, and almost no Old Cell tokens in the old pool. The migration process includes the following steps:

  1. Remove old liquidity and return the corresponding amount of tokens to the user.
  2. Add new liquidity according to the proportion of the new pool.

Due to the lack of Old Cell tokens in the old pool, the amount of native tokens obtained when removing liquidity increases, while the number of Old Cell tokens decreases. This causes users to only need to add a small amount of native tokens and New Cell tokens to obtain liquidity, while the excess native tokens and Old Cell tokens are returned to the users.

Finally, the attacker removes the liquidity from the new pool and exchanges the Old Cell tokens returned from the migration for native tokens. At this point, there are a large number of Old Cell tokens in the old pool but no native tokens, and the attacker exchanges the Old Cell tokens back into native tokens, thereby completing the profit. The attacker then repeats the migration operation to further expand the earnings.

Web3 Security | Cellframe Network Analysis of Attack Incident Due to Flash Loans Manipulating Pool Ratios

Web3 Security | Analysis of the Attack Incident on Cellframe Network Due to Flash Loan Manipulation of Pool Ratios

Web3 Security | Cellframe Network Attacked Due to Flash Loan Manipulation of Pool Ratios

Web3 Security | Cellframe Network Analysis of Attack Incident Due to Flash Loan Manipulation of Pool Ratio

Root Cause of the Attack

The root cause of this attack lies in the calculation issues during the liquidity migration process. When migrating liquidity, the project party directly calculates based on the quantities of the two tokens in the trading pair, which makes this method susceptible to manipulation by attackers.

Web3 Security | Cellframe Network suffered an attack due to flash loan manipulation of pool ratios

Security Advice

  1. When migrating liquidity, one should comprehensively consider the changes in the quantities of the two tokens in the old and new pools as well as the current token prices, rather than simply calculating the number of tokens.

  2. A comprehensive security audit should be conducted before the code goes live to identify and fix potential vulnerabilities.

This incident reminds us once again that when designing and implementing complex financial operations, special attention needs to be paid to security and robustness to prevent potential attacks and vulnerabilities from being exploited.

Web3 Security | Analysis of the Attack Incident on Cellframe Network Due to Flash Loans Manipulating Pool Ratios

View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • 7
  • Share
Comment
0/400
NotGonnaMakeItvip
· 6h ago
Isn't it a particularly foolish thief?
View OriginalReply0
MEVHunterNoLossvip
· 6h ago
Hacker steals the job
View OriginalReply0
NFTRegrettervip
· 6h ago
It's Flash Loans again! It never ends.
View OriginalReply0
MidnightSnapHuntervip
· 6h ago
Hacker has less money and is probably thinking about money so much that they've gone crazy.
View OriginalReply0
SerumSurfervip
· 6h ago
70,000? The hacker probably can't be bothered to take action.
View OriginalReply0
TokenToastervip
· 6h ago
Another Flash Loans... The internet isn't safe.
View OriginalReply0
0xDreamChaservip
· 6h ago
Another project has failed.
View OriginalReply0
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)