Back to Blog

Coin98如何悄无声息地修复漏洞

Code Auditing
January 16, 2022
2 min read

上周五,我们的监控系统检测到针对 Coin98 智能合约(0x8aaf408e06feed6a6a6182ea3c464035748b9b31 — 受害合约)在 BSC 上的攻击。我们立即通过 Twitter 私信联系了项目方,但未收到回复。由于当时漏洞依然存在,我们未公开披露。几小时后,我们发现项目方已创建一个新合约,修复了该漏洞。因此,现在可以安全地在此总结该漏洞及其修复方案。

攻击交易与根本原因

我们内部监控系统检测到的交易引起了我们的注意。经过仔细调查,我们确认这是由于 swapExactTokensForTokens 函数中 route 参数(即路由,实际含义)的访问控制不当所致,如下所示:

此合约盲目信任 route,然后调用路由器的 swapExactTokensForTokens 函数。在此之前,它会批准受害合约拥有的所有代币给 route。然而,route 可以由攻击者提供。在这种情况下,攻击者就可以将受害合约的所有代币转移给自己,然后兑换成 WBNB 以获利。

以下是其中一次攻击交易:

漏洞的隐匿修复

上周五,我们通过 Twitter 私信联系了项目方,但未收到回复。今天我们再次检查合约,发现已部署了一个新的智能合约(0x83f25d16bdf91f51120032f264dad0e1ab1c8227)。这个新合约为 route 添加了白名单:

结论

我们见过许多合约盲目信任传入参数的案例。这确实会造成严重的 arehole。

请勿信任任何不受控的参数!

关于 BlockSec

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

迄今为止,公司已为 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
~$4.72M Lost: TAC, Transit Finance & More | BlockSec Weekly
Security Insights

~$4.72M Lost: TAC, Transit Finance & More | BlockSec Weekly

This BlockSec weekly security report covers 3 notable attack incidents identified between May 11 and May 17, 2026, across TRON, TON, and Ethereum, with total estimated losses of approximately $4.72M. Three incidents are analyzed in detail: the highlighted $1.88M Transit Finance exploit on TRON, where a deprecated swap bridge contract with lingering token approvals was exploited through arbitrary calldata forwarding; the $2.8M TAC TON-to-EVM bridge exploit caused by missing canonical wallet verification in the jetton deposit flow; and the $46.75K Boost Hook exploit on Ethereum, where spot price manipulation on a Uniswap V4 hook-based perpetual protocol forced the protocol to buy tokens at inflated prices using its own reserves.

~$15.9M Lost: Trusted Volumes, Wasabi & More | BlockSec Weekly
Security Insights

~$15.9M Lost: Trusted Volumes, Wasabi & More | BlockSec Weekly

This BlockSec bi-weekly security report covers 11 notable attack incidents identified between April 27 and May 10, 2026, across Sui, Ethereum, BNB Chain, Base, Blast, and Berachain, with total estimated losses of approximately $15.9M. Three incidents are analyzed in detail: the highlighted $1.14M Aftermath Finance exploit on Sui, where a signed/unsigned semantic mismatch in the builder-fee validation allowed an attacker to inject a negative fee that was converted into positive collateral during settlement; the $5.87M Trusted Volumes RFQ authorization mismatch on Ethereum; and the $5.7M Wasabi Protocol infrastructure-to-contract-control compromise across multiple EVM chains.

Newsletter - April 2026
Security Insights

Newsletter - April 2026

In April 2026, the DeFi ecosystem experienced three major security incidents. KelpDAO lost ~$290M due to an insecure 1-of-1 DVN bridge configuration exploited via RPC infrastructure compromise, Drift Protocol suffered ~$285M from a multisig governance takeover leveraging Solana's durable nonce mechanism, and Rhea Finance incurred ~$18.4M following a business logic flaw in its margin-trading module that allowed circular swap path manipulatio

Best Security Auditor for Web3

Validate design, code, and business logic before launch. Aligned with the highest industry security standards.

BlockSec Audit