Back to Blog

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

Code Auditing
January 16, 2022

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

攻击交易和根本原因

我们内部监控系统上报的交易引起了我们的注意。经过仔细调查,我们确认这是由于 swapExactTokensForTokens 函数中 route 参数(即路由)的访问控制问题,具体如下:

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

以下是攻击交易之一。

漏洞的隐蔽修复

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

结论

我们已经看到许多智能合约盲目信任传入参数的案例。这确实会造成严重的漏洞。

不要信任任何不受控制的参数!

关于 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
Building a Secure Stablecoin Payment Network: BlockSec Partners with Morph
Partnership

Building a Secure Stablecoin Payment Network: BlockSec Partners with Morph

BlockSec has partnered with Morph as an official audit partner for the $150M Morph Payment Accelerator. By offering exclusive discounts on smart contract audits and penetration testing, BlockSec provides institutional-grade security to payment builders, ensuring a safe and resilient foundation for the future of global stablecoin payments.

Weekly Web3 Security Incident Roundup | Mar 9 – Mar 15, 2026
Security Insights

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

This BlockSec weekly security report covers eight DeFi attack incidents detected between March 9 and March 15, 2026, across Ethereum and BNB Chain, with total estimated losses of approximately $1.66M. Incidents include a $1.01M AAVE incorrect liquidation caused by oracle misconfiguration, a $242K exploit on the deflationary token MT due to flawed trading restrictions, a $149K exploit on the burn-to-earn protocol DBXen from `_msgSender()` and `msg.sender` inconsistency, and a $131K attack on AM Token exploiting a flawed delayed-burn mechanism. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Venus Thena (THE) Incident: What Broke and What Was Missed

Venus Thena (THE) Incident: What Broke and What Was Missed

On March 15, 2026, an attacker bypassed the THE (Thena) supply cap on Venus Protocol (BNB Chain) through a donation attack, inflating a collateral position to 3.67x the intended limit and borrowing ~$14.9M in assets. Both sides lost money on-chain: Venus was left with ~$2.15M in bad debt after 254 liquidation bots competed across 8,048 transactions, while the attacker retained only ~$5.2M against a $9.92M investment. This deep dive examines what broke across three lines of defense (exposure limits, collateral valuation, and liquidation) and the monitoring gaps that left months of on-chain warning signals unacted upon.

Best Security Auditor for Web3

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

BlockSec Audit