我们如何为 TransitSwap 和 BabySwap 追回被盗资金

我们如何为 TransitSwap 和 BabySwap 追回被盗资金

引言

10月1日,BSC上的BabySwap和TransitSwap遭受攻击。一些攻击交易被一个机器人抢先执行。有趣的是,这个机器人存在Profanity工具漏洞,我们成功地恢复了它的私钥。我们还设法逆向工程了机器人合约,并将资金从机器人合约中提取到我们的安全账户。我们已将资金转移至TransitSwap,目前正在联系BabySwap。

时间线

BabySwap攻击的检测

2022年10月1日14:47(UTC),我们的内部系统报告一笔攻击交易。我们进一步分析表明,这是由于智能路由合约中的受控工厂导致的。然而,当时我们没有披露细节,因为项目仍然存在漏洞。我们通过Twitter DM和TG联系了BabySwap,但未收到回复。

在调查过程中,我们发现这笔交易是由一个机器人账户发出的,该账户抢先执行了原始攻击交易。此外,该账户的地址以八个零开头,看起来是由易受Profanity工具漏洞影响的Profanity工具生成的。

机器人私钥的恢复

2022年10月1日16:10(UTC),我们的工具在约20分钟内成功恢复了该机器人的私钥。对于恢复的私钥,我们将资金转移到了一个安全账户(这是我们救援的典型流程)。否则,其他恢复私钥的人可能会接管该账户,账户中的资金将面临风险。

从机器人中转移资金

挑战在于资金位于机器人部署的合约中,而不是机器人EOA账户本身。如何转移资金是一个挑战。

我们反编译了合约,发现合约中有一个提现函数(如下图所示)。

该函数可用于提取合约中的资金。第一个参数是代币地址,第二个参数应为零。

我们发送了一笔交易,成功从合约中提取了资金到机器人,然后将资金转移到我们的安全账户

又一次攻击来了!

几个小时后,我们的系统报告了对TransSwap的又一次攻击。有几笔来自不同地址的攻击交易,其中一笔交易再次被这个机器人抢先执行! 然而,由于机器人部署的合约不同,提取资金的函数也不同。

返还资金

经过内部商议,我们决定将资金返还给受攻击的项目(而不是机器人),原因如下

  • 首先,机器人通过攻击易受攻击的合约获得了这些资金。尽管机器人抢先执行了攻击交易(而不是最初发起攻击),我们仍然认为抢先执行攻击交易也是一种攻击

  • 其次,这些资金属于攻击的受害者,即受影响DeFi协议的用户。用户因DeFi协议的漏洞遭受了巨大的损失。他们应该收到攻击者的资金。

我们已将资金转至TransitFinance官方资金接收地址,并正在联系BabySwap。

救援更新

我们仍在进行易受攻击地址的救援挑战在于,在恢复私钥之前,无法确定一个地址是否易受攻击。尽管我们有优化的算法,但由于计算能力的限制,我们仍需要更多时间来完成整个救援。我们将稍后发布详细报告,详细阐述整个过程并回答以下问题。

  • 有多少地址易受攻击?
  • 该漏洞的影响是什么,即有多少资产因该漏洞而面临风险?
  • 该漏洞的攻击情况如何?

敬请关注,并注意安全。

要点

使DeFi项目安全并非易事。除了代码审计,我们认为社区应该采取积极的方法来监控项目状态,并在攻击发生之前阻止它

关于BlockSec

BlockSec是一家开创性的区块链安全公司,由一群全球顶尖的安全专家于2021年创立。公司致力于提高新兴Web3世界的安全性和可用性,以促进其大规模采用。为此,BlockSec提供智能合约和EVM链安全审计服务,用于安全开发和主动阻止威胁的Phalcon平台,用于资金追踪和调查的MetaSleuth平台,以及供Web3构建者在加密世界中高效冲浪的MetaDock扩展。

迄今为止,公司已为MetaMask、Uniswap Foundation、Compound、Forta和PancakeSwap等300多家知名客户提供服务,并在两轮融资中从Matrix Partners、Vitalbridge Capital和Fenbushi Capital等领先投资者的手中获得了数千万美元的资金。

官方网站:https://blocksec.com/

官方Twitter账户:https://twitter.com/BlockSecTeam

Sign up for the latest updates
Weekly Web3 Security Incident Roundup | Feb 9 – Feb 15, 2026

Weekly Web3 Security Incident Roundup | Feb 9 – Feb 15, 2026

During the week of February 9 to February 15, 2026, three blockchain security incidents were reported with total losses of ~$657K. All incidents occurred on the BNB Smart Chain and involved flawed business logic in DeFi token contracts. The primary causes included an unchecked balance withdrawal from an intermediary contract that allowed donation-based inflation of a liquidity addition targeted by a sandwich attack, a post-swap deflationary clawback that returned sold tokens to the caller while draining pool reserves to create a repeatable price-manipulation primitive, and a token transfer override that burned tokens directly from a Uniswap V2 pair's balance and force-synced reserves within the same transaction to artificially inflate the token price.

Top 10 "Awesome" Security Incidents in 2025

Top 10 "Awesome" Security Incidents in 2025

To help the community learn from what happened, BlockSec selected ten incidents that stood out most this year. These cases were chosen not only for the scale of loss, but also for the distinct techniques involved, the unexpected twists in execution, and the new or underexplored attack surfaces they revealed.

#10 Panoptic Incident: XOR Linearity Breaks the Position Fingerprint Scheme

#10 Panoptic Incident: XOR Linearity Breaks the Position Fingerprint Scheme

On August 29, 2025, Panoptic disclosed a Cantina bounty finding and confirmed that, with support from Cantina and Seal911, it executed a rescue operation on August 25 to secure roughly $400K in funds. The issue stemmed from a flaw in Panoptic’s position fingerprint calculation algorithm, which could have enabled incorrect position identification and downstream fund risk.