Cellframe Network suffered a flash loan attack, with a liquidity migration vulnerability leading to a loss of $76,000.

robot
Abstract generation in progress

Cellframe Network Flash Loan Attack Analysis

On June 1, 2023, at 10:07:55 (UTC+8), Cellframe Network suffered a hack on the Binance Smart Chain, where the attacker exploited a token quantity calculation vulnerability during the liquidity migration process to profit $76,112.

Web3 Security | Cellframe Network Attacked Due to Flash Loans Manipulating Pool Ratios Analysis

Attack Details

The attacker first obtains 1000 BNB and 500,000 New Cell tokens through Flash Loans. Subsequently, they exchange all the New Cell tokens for BNB, causing the amount of BNB in the trading pool to approach zero. Immediately after, the attacker exchanges 900 BNB for Old Cell tokens.

It is worth noting that the attacker had already added liquidity for Old Cell and BNB before carrying out the attack, obtaining Old lp.

The key to the attack lies in calling the liquidity migration function. At this point, there is almost no BNB in the new pool, while the old pool has almost no Old Cell tokens. The migration process involves removing the old liquidity and adding new liquidity according to the ratio of the new pool. Due to the scarcity of Old Cell tokens in the old pool, the amount of BNB obtained when removing liquidity increases, while the number of Old Cell tokens decreases.

Web3 Security | Cellframe Network Analyzed Incident of Attack Due to Flash Loan Manipulation of Pool Proportions

This allows users to obtain liquidity by only adding a small amount of BNB and New Cell tokens, while the excess BNB and Old Cell tokens are returned to the users. The attacker then removes the liquidity from the new pool and exchanges the returned Old Cell tokens for BNB, thus completing the profit.

Web3 Security | Cellframe Network Attacked Due to Flash Loans Manipulating Pool Ratios Analysis

Source of the Attack

The calculation issues during the liquidity migration process are the root cause of this attack. The attacker exploited the loophole in the migration mechanism by manipulating the token ratios in the pool.

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

Prevention Suggestions

  1. When migrating liquidity, one should fully consider the changes in the quantities of the two tokens in the old and new pools, as well as the current token prices.

  2. Avoid relying solely on the quantity of the two tokens in the trading pair for calculations, as this can be easily manipulated.

  3. Before deploying the code, it is essential to conduct a comprehensive and rigorous security audit.

Web3 Security | Analysis of the attack incident on Cellframe Network due to Flash Loans manipulating pool ratios

This incident once again emphasizes the need for DeFi projects to exercise extra caution when designing and implementing liquidity management mechanisms to guard against potential attack risks.

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

CELL-1.23%
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
  • 5
  • Repost
  • Share
Comment
0/400
AirdropHarvestervip
· 9h ago
This wave of shearing is going smoothly.
View OriginalReply0
ser_we_are_ngmivip
· 9h ago
Another Flash Loan, can't get enough of them.
View OriginalReply0
DeepRabbitHolevip
· 9h ago
也就这点钱 丢人丢到家了
Reply0
GateUser-7b078580vip
· 9h ago
Statistically speaking, 76112 USD is just a drop in the ocean for the entire BSC; it doesn't hurt or itch.
View OriginalReply0
LiquiditySurfervip
· 9h ago
There are sharks playing low depth surfing in the pool again.
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)