Cointime

Download App
iOS & Android

How a Fake Token Attack Drained $144,000 from Biswap Users on BSC

Validated Project

Summary

On July 1st, 2023, an attacker exploited a vulnerability in the Biswap V3Migrator contract on Binance Smart Chain (BSC) and stole about $144,000 worth of tokens from unsuspecting users. The attacker used a fake token attack to manipulate the parameters of the migration function and siphon off the liquidity from users who approved their liquidity provider (LP) tokens to the V3Migrator contract. The exploit was possible because the V3Migrator contract did not validate the parameters when migrating from Biswap V2 to Biswap V3. It could have resulted in losses of tens of millions of dollars for its users if this attack had not been stopped in time.

Transactions

The attacker executed three transactions to carry out the exploit:

https://bscscan.com//tx/0xe13ec0941580d3c286b46fa6566f20195bdd52b3d65fc7ff4a953a8fc774c6c4

https://bscscan.com//tx/0xe5c89e9ac217e4e16c2399f3597f7b5fbb73b45c1d3360788ee51ea2561def3a

https://bscscan.com//tx/0x8693a95f8481ba02ceaabed8e95b4e1eb8ac589c69c027c96b12ac5295714c3f

Attacker

The attacker’s address is [0xa1e31b29f94296fc85fac8739511360f279b1976].

Attacking Contract

The attacking contract is [0x1d448e9661c5abfc732ea81330c6439b0aa449b5]. This contract was deployed by the attacker on June 30th, 2023, one day before the exploit. The contract has a simple logic that calls the V3Migrator contract with different parameters.

Attacked Contract

The attacked contract is [0x839b0afd0a0528ea184448e890cbaaffd99c1dbf]. This is Biswap’s V3Migrator contract that was deployed on June 28th, 2023. The contract is supposed to help users migrate their LP tokens from Biswap V2 to Biswap V3.

Attacking Steps

The attacker exploited a flaw in the V3Migrator contract that allowed them to tamper with the parameters of the migration function. The attacking steps are as follows:

  1. Victims approved LP tokens for the Biswap V3Migrator contract;
  2. The attacker burned the victim’s V2 LP token and added V3 liquidity with fake tokens. At this step, the token0 and token1 of V2 LP were still in the V3Migrator contract;
  3. The attacker burned the fake V2 LP token and added V3 liquidity with token0 and token1 of V2 LP. Finally, the surplus token0 and token1 that were not used to add the V3 liquidity were transferred back to the attacker. At the same time, the V3 liquidity in this step also belonged to the attacker.

Root Cause

The root cause of the exploit is that Biswap’s V3Migrator contract did not validate the parameters when migrating from Biswap V2 to Biswap V3. Specifically, there is a significant issue in the contract:The contract does not verify that the token0 and token1 parameters match with the actual tokens in the V2 LP token;These issues allow the attacker to pass fake tokens and amounts to the migration function and steal the real tokens from the users who approved LP tokens to the V3Migrator contract.

Key Code

Asset Loss

0xa1e31b29f94296fc85fac8739511360f279b1976 get a profit of ~$144,000

Financial Flows

The attacker removed the liquidity and swapped tokens for $BNB

Finally, the attacker transferred 603 $BNB into Tornadocash for money laundering.

PoC

https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Biswap_exp.sol

Suggested Solution

Highly recommend users revoke their approval to Biswap V3Migrator from https://bscscan.com/tokenapprovalchecker

Conclusion

The Biswap exploit is another example of how fake token attacks can be used to exploit DEXes on BSC. The exploit shows the importance of validating the parameters and balances of contracts that handle user funds. Users should also be careful when approving their tokens to third-party contracts and check the source code and audits of the contracts before using them.

As the leading web3 AI security service provider, MetaTrust Labs was the first to discover this attack and report it to Biswap on Twitter on July 1st. MetaTrust Labs also provided Biswap with two suggestions to stop the attack and prevent further losses:

  • Ask users to revoke their approvals for the V3Migrator contract as soon as possible, so that the attacker could not access their LP tokens anymore;
  • Delete their own tweet that promoted the V3 migration and informed users about the benefits of migrating their LP tokens, as this tweet could mislead users into falling victim to the attack.

If this attack had not been stopped in time, all of Biswap’s migration contracts would have suffered losses of tens of millions of dollars. This would have been a devastating blow to Biswap and its users, as well as a serious setback for the development of DEXes on BSC.

Follow Us

Twitter: @MetaTrustLabs

Website: metatrust.io

Comments

All Comments

Recommended for you

  • Ripple Prime Launches Perpetual Contract Trading Services for Institutional Clients

    According to Bloomberg, Ripple's main brokerage division, Ripple Prime, is launching perpetual contracts for real-world assets (RWA) aimed at institutional clients, covering over 100 reference markets including stocks, indices, ETFs, and commodities. This product is offered through Trade.xyz on Hyperliquid, continuing Ripple Prime's previous initiative to provide clients with access to cryptocurrency perpetual contract trading.

  • NYC Comptroller Urges Anthropic to Pause IPO Plans

    On October 15, New York City Comptroller Mark Levine stated in an interview that he has written to Anthropic CEO Dario Amodei, urging the company to suspend its planned initial public offering (IPO). In the letter, he called for Anthropic to pause its IPO plans until it can fully and transparently address concerns related to AI safety, governance, and development that the company itself has raised. Levine wrote that the company should focus on mitigating these risks rather than advancing the IPO. Currently, New York City has an investment exposure of less than $10 million in Anthropic through the private market.

  • US September PPI Rises 6.3% Year-on-Year, Exceeding Market Expectations

    The US Producer Price Index (PPI) for September recorded a year-on-year increase of 6.3%, the highest since May 2026, surpassing market expectations of 5.3%. The month-on-month PPI for September was reported at 1.3%, significantly higher than the market forecast of 0.5%. Additionally, US retail sales for September showed a month-on-month increase of 0.8%, also exceeding market expectations.

  • U.S. Initial Jobless Claims at 199,000 Last Week, Expected 200,000

    On October 15, the number of initial jobless claims in the U.S. last week was 199,000, expected to be 200,000, with the previous value revised from 197,000 to 198,000.

  • NYC Comptroller Urges Anthropic to Pause IPO Plans

    On October 15, New York City Comptroller Mark Levine stated in an interview that he has written to Anthropic CEO Dario Amodei, urging the company to pause its planned initial public offering (IPO). The letter calls for Anthropic to suspend its IPO plans until it can comprehensively and transparently address concerns related to AI safety, governance, and development that the company itself has raised. Levine wrote that the company should focus on mitigating these risks rather than moving forward with the IPO. Currently, New York City has an investment exposure of less than $10 million in Anthropic through the private market.

  • BTC Falls Below $81,000

    Market data shows that BTC has fallen below $81,000, currently priced at $80,997.1, with a 24-hour decline of 2.84%. The market is experiencing significant volatility, so please ensure proper risk management.

  • FTC Requests Documents from Anthropic and OpenAI

    On October 15, according to Axios: The U.S. Federal Trade Commission (FTC) has requested documents related to the incident from Anthropic and OpenAI. The FTC issued a civil subpoena to the AI companies on Wednesday.

  • Cook: Apple AI Approved in China, Testing Version Launching Late October

    On October 15, Apple CEO Tim Cook revealed in an interview in Shanghai that Apple AI has been approved in China. A testing version will be launched later in October, featuring initial functions such as real-time translation, writing assistance, and image removal, while Siri AI will not be included.

  • UBS: Fed Expected to Raise Rates for the Third Time in March 2027

    On October 15, UBS stated that it expects the Federal Reserve to implement its third rate hike in March 2027, revising its previous forecast that the rate hike cycle would conclude in December.

  • BTC Surpasses $81,000

    Market data shows that BTC has surpassed $81,000, currently priced at $81,002, with a 24-hour decline of 2.94%. The market is experiencing significant volatility, so please ensure proper risk management.