Back to Blog

Coin98による脆弱性のサイレント修正方法

Code Auditing
January 16, 2022
3 min read

先週金曜日、当社の監視システムはBSC上のCoin98スマートコントラクト(0x8aaf408e06feed6a6a6182ea3c464035748b9b31 - 被害コントラクト)に対する攻撃を検出しました。Twitter経由でプロジェクトオーナーにDMを送りましたが、返答はありませんでした。当時、脆弱性はまだ存在していたため、公表しませんでした。数時間後、プロジェクトオーナーが脆弱性を修正した新しいコントラクトを作成したことが判明しました。そのため、ここで脆弱性と修正についてまとめることは安全です。

攻撃トランザクションと根本原因

当社の内部監視システムによって提起されたトランザクションが私たちの注意を引きました。慎重な調査の後、swapExactTokensForTokens関数のrouteパラメータ(つまりルーター)のアクセス制御によるものであることを確認しました。

このコントラクトはrouteを無条件に信頼し、ルーターのswapExactTokensForTokens関数を呼び出していました。これに先立ち、被害コントラクトが所有するすべてのトークンをrouteに承認していました。しかし、routeは攻撃者によって操作される可能性がありました。この場合、攻撃者は被害コントラクトのすべてのトークンを自身に転送し、WBNBと交換して利益を得ることができました。

以下は攻撃トランザクションの1つです。

脆弱性のステルス修正

先週金曜日にTwitterでプロジェクトオーナーにDMを送りましたが、返答はありませんでした。本日、コントラクトを再確認したところ、新しいスマートコントラクト(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などの著名な投資家から2回の資金調達で数千万米ドルを獲得しています。

公式ウェブサイト: 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